Skip to content

Commit

Permalink
Merge pull request #116 from nexB/update-skeleton
Browse files Browse the repository at this point in the history
Update skeleton
  • Loading branch information
keshav-space authored Aug 31, 2023
2 parents 205da7e + 0b297fd commit 9c783c7
Show file tree
Hide file tree
Showing 24 changed files with 1,516 additions and 716 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI Documentation

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-20.04

strategy:
max-parallel: 4
matrix:
python-version: [3.9]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Give permission to run scripts
run: chmod +x ./docs/scripts/doc8_style_check.sh

- name: Install Dependencies
run: pip install -e .[docs]

- name: Check Sphinx Documentation build minimally
working-directory: ./docs
run: sphinx-build -E -W source build

- name: Check for documentation style errors
working-directory: ./docs
run: ./scripts/doc8_style_check.sh


1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.py[cod]

# virtualenv and other misc bits
/src/*.egg-info
*.egg-info
/dist
/build
Expand Down
11 changes: 11 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
# Required
version: 2

# Build in latest ubuntu/python
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build PDF & ePub
formats:
- epub
- pdf

# Where the Sphinx conf.py file is located
sphinx:
configuration: docs/source/conf.py
Expand Down
86 changes: 86 additions & 0 deletions CODE_OF_CONDUCT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Contributor Covenant Code of Conduct
====================================

Our Pledge
----------

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our
project and our community a harassment-free experience for everyone,
regardless of age, body size, disability, ethnicity, gender identity and
expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

Our Standards
-------------

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual
attention or advances
- Trolling, insulting/derogatory comments, and personal or political
attacks
- Public or private harassment
- Publishing others’ private information, such as a physical or
electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

Our Responsibilities
--------------------

Project maintainers are responsible for clarifying the standards of
acceptable behavior and are expected to take appropriate and fair
corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct, or to ban
temporarily or permanently any contributor for other behaviors that they
deem inappropriate, threatening, offensive, or harmful.

Scope
-----

This Code of Conduct applies both within project spaces and in public
spaces when an individual is representing the project or its community.
Examples of representing a project or community include using an
official project e-mail address, posting via an official social media
account, or acting as an appointed representative at an online or
offline event. Representation of a project may be further defined and
clarified by project maintainers.

Enforcement
-----------

Instances of abusive, harassing, or otherwise unacceptable behavior may
be reported by contacting the project team at pombredanne@gmail.com
or on the Gitter chat channel at https://gitter.im/aboutcode-org/discuss .
All complaints will be reviewed and investigated and will result in a
response that is deemed necessary and appropriate to the circumstances.
The project team is obligated to maintain confidentiality with regard to
the reporter of an incident. Further details of specific enforcement
policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in
good faith may face temporary or permanent repercussions as determined
by other members of the project’s leadership.

Attribution
-----------

This Code of Conduct is adapted from the `Contributor Covenant`_ ,
version 1.4, available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

.. _Contributor Covenant: https://www.contributor-covenant.org
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/skeleton for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#

# Python version can be specified with `$ PYTHON_EXE=python3.x make conf`
PYTHON_EXE?=python3
VENV=venv
ACTIVATE?=. ${VENV}/bin/activate;

dev:
@echo "-> Configure the development envt."
./configure --dev

isort:
@echo "-> Apply isort changes to ensure proper imports ordering"
${VENV}/bin/isort --sl -l 100 src tests setup.py

black:
@echo "-> Apply black code formatter"
${VENV}/bin/black -l 100 src tests setup.py

doc8:
@echo "-> Run doc8 validation"
@${ACTIVATE} doc8 --max-line-length 100 --ignore-path docs/_build/ --quiet docs/

valid: isort black

check:
@echo "-> Run pycodestyle (PEP8) validation"
@${ACTIVATE} pycodestyle --max-line-length=100 --exclude=.eggs,venv,lib,thirdparty,docs,migrations,settings.py,.cache .
@echo "-> Run isort imports ordering validation"
@${ACTIVATE} isort --sl --check-only -l 100 setup.py src tests .
@echo "-> Run black validation"
@${ACTIVATE} black --check --check -l 100 src tests setup.py

clean:
@echo "-> Clean the Python env"
./configure --clean

test:
@echo "-> Run the test suite"
${VENV}/bin/pytest -vvs

docs:
rm -rf docs/_build/
@${ACTIVATE} sphinx-build docs/ docs/_build/

.PHONY: conf dev check valid black isort clean test docs
26 changes: 18 additions & 8 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:

- template: etc/ci/azure-posix.yml
parameters:
job_name: ubuntu18_cpython
image_name: ubuntu-18.04
job_name: ubuntu20_cpython
image_name: ubuntu-20.04
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
test_suites:
all: |
Expand All @@ -19,8 +19,8 @@ jobs:
- template: etc/ci/azure-posix.yml
parameters:
job_name: ubuntu20_cpython
image_name: ubuntu-20.04
job_name: ubuntu22_cpython
image_name: ubuntu-22.04
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
test_suites:
all: |
Expand All @@ -29,8 +29,8 @@ jobs:
- template: etc/ci/azure-posix.yml
parameters:
job_name: macos1015_cpython
image_name: macos-10.15
job_name: macos11_cpython
image_name: macOS-11
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
test_suites:
all: |
Expand All @@ -39,8 +39,18 @@ jobs:
- template: etc/ci/azure-posix.yml
parameters:
job_name: macos11_cpython
image_name: macos-11
job_name: macos12_cpython
image_name: macOS-12
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
test_suites:
all: |
source venv/bin/activate
pytest -n 2 -vvs
- template: etc/ci/azure-posix.yml
parameters:
job_name: macos13_cpython
image_name: macOS-13
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
test_suites:
all: |
Expand Down
20 changes: 15 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ CLI_ARGS=$1
# Requirement arguments passed to pip and used by default or with --dev.
REQUIREMENTS="--editable . --constraint requirements.txt"
DEV_REQUIREMENTS="--editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"
DOCS_REQUIREMENTS="--editable .[docs] --constraint requirements.txt"

# where we create a virtualenv
VIRTUALENV_DIR=venv

# Cleanable files and directories to delete with the --clean option
CLEANABLE="build venv"
CLEANABLE="build dist venv .cache .eggs"

# extra arguments passed to pip
PIP_EXTRA_ARGS=" "
Expand All @@ -51,13 +52,20 @@ CFG_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin


################################
# Install with or without and index. With "--no-index" this is using only local wheels
# This is an offline mode with no index and no network operations
# NO_INDEX="--no-index "
NO_INDEX=""


################################
# Thirdparty package locations and index handling
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
if [ -f "$CFG_ROOT_DIR/thirdparty" ]; then
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty"
# Find packages from the local thirdparty directory if present
THIRDPARDIR=$CFG_ROOT_DIR/thirdparty
if [[ "$(echo $THIRDPARDIR/*.whl)x" != "$THIRDPARDIR/*.whlx" ]]; then
PIP_EXTRA_ARGS="$NO_INDEX --find-links $THIRDPARDIR"
fi
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"


################################
Expand Down Expand Up @@ -177,10 +185,12 @@ while getopts :-: optchar; do
help ) cli_help;;
clean ) find_python && clean;;
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS";;
docs ) CFG_REQUIREMENTS="$DOCS_REQUIREMENTS";;
esac;;
esac
done


PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS"

find_python
Expand Down
10 changes: 6 additions & 4 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
@rem # Requirement arguments passed to pip and used by default or with --dev.
set "REQUIREMENTS=--editable . --constraint requirements.txt"
set "DEV_REQUIREMENTS=--editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"
set "DOCS_REQUIREMENTS=--editable .[docs] --constraint requirements.txt"

@rem # where we create a virtualenv
set "VIRTUALENV_DIR=venv"

@rem # Cleanable files and directories to delete with the --clean option
set "CLEANABLE=build venv"
set "CLEANABLE=build dist venv .cache .eggs"

@rem # extra arguments passed to pip
set "PIP_EXTRA_ARGS= "
Expand All @@ -51,11 +52,10 @@ set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"

@rem ################################
@rem # Thirdparty package locations and index handling
@rem # Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
@rem # Find packages from the local thirdparty directory
if exist "%CFG_ROOT_DIR%\thirdparty" (
set PIP_EXTRA_ARGS=--find-links "%CFG_ROOT_DIR%\thirdparty"
)
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"


@rem ################################
Expand All @@ -68,7 +68,6 @@ if not defined CFG_QUIET (
@rem ################################
@rem # Main command line entry point
set "CFG_REQUIREMENTS=%REQUIREMENTS%"
set "NO_INDEX=--no-index"

:again
if not "%1" == "" (
Expand All @@ -77,6 +76,9 @@ if not "%1" == "" (
if "%1" EQU "--dev" (
set "CFG_REQUIREMENTS=%DEV_REQUIREMENTS%"
)
if "%1" EQU "--docs" (
set "CFG_REQUIREMENTS=%DOCS_REQUIREMENTS%"
)
shift
goto again
)
Expand Down
Loading

0 comments on commit 9c783c7

Please sign in to comment.