Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
421d175
New repository initialized by cvs2svn.
Feb 28, 2003
5664513
Initial commit
agustinhenze Jul 31, 2013
c7ba5bd
Initial commit
Jun 13, 2017
c83207d
Initial commit
pombredanne Jan 18, 2020
7ab4312
Merge branch 'dlt-master'
pombredanne Jan 18, 2020
77ce5e4
Check for deps in local thirdparty directory #31
JonoYang Aug 31, 2021
fa13562
Merge pull request #32 from nexB/install-from-thirdparty-dir
JonoYang Aug 31, 2021
1bcaaa5
Enforce use of requirements.txt #34
JonoYang Sep 1, 2021
e9067c8
Add scripts from scancode-toolkit/etc/release/ #33
JonoYang Sep 2, 2021
0e1f56b
Normalize license in load_pkginfo_data #33
JonoYang Sep 2, 2021
288532d
Add --init option to configure #33
JonoYang Sep 2, 2021
a5ae4f3
Update README.rst #33
JonoYang Sep 2, 2021
593e237
Use venv as virtual environment directory name #37
JonoYang Sep 3, 2021
9342bc1
Update configure.bat #33
JonoYang Sep 3, 2021
45e4a2a
Add placeholder requirements.txt files #33
JonoYang Sep 3, 2021
944fbae
Handle multiple options in configure #33
JonoYang Sep 3, 2021
3532b22
Fix path to aboutcode in utils_thirdparty.py #33
JonoYang Sep 4, 2021
9c78ddb
Update release notes in README.rst
JonoYang Sep 4, 2021
ebcfb93
Handle ExpressionParseError #33
JonoYang Sep 4, 2021
6ab9c10
Update README.rst
pombredanne Sep 7, 2021
bfdc6ff
Address review comments #33
JonoYang Sep 7, 2021
8583d7f
Merge pull request #39 from nexB/update-skeleton
JonoYang Sep 8, 2021
71d8dad
Update READMEs
JonoYang Sep 8, 2021
d3b8524
Merge pull request #40 from nexB/add-scripts-readme
JonoYang Sep 8, 2021
d2bafb9
Fixed #41 - Handled encoding issue when generating ABOUT files
chinyeungli Sep 15, 2021
c41196a
Merge pull request #42 from nexB/41_fix_encoding_error
chinyeungli Oct 4, 2021
5671563
Treat text files as text
pombredanne Oct 5, 2021
14f6a2d
Add helper to publish files in GH releases
pombredanne Oct 5, 2021
1a2a144
Add code to use curl if wget is not installed
chinyeungli Oct 6, 2021
7aa7d4c
Do not issue warning if thirdparty dir is missing
pombredanne Oct 8, 2021
51d0c5c
Merge pull request #45 from nexB/open-as-text
pombredanne Oct 11, 2021
b46d84f
Handle as_text correctly in cache
pombredanne Oct 11, 2021
255a898
Handle as_text correctly in cache
pombredanne Oct 11, 2021
7b76f4a
Merge origin/as_text-cache
pombredanne Oct 15, 2021
3a5307c
Merge pull request #47 from nexB/as_text-cache
pombredanne Oct 15, 2021
e5833d1
Add support for Python 3.10
pombredanne Oct 18, 2021
0a0ef12
Adopt black style
pombredanne Oct 29, 2021
31ed446
Drop Ubuntu 16 add Python 3.10
pombredanne Oct 29, 2021
00aaa26
Merge pull request #48 from nexB/update-system
pombredanne Oct 29, 2021
2ce7c7a
Disable Python 3.10 tests on macOS 10.14
pombredanne Oct 29, 2021
1fa3699
Merge pull request #49 from nexB/update-system
pombredanne Oct 29, 2021
2cc2c5a
Add code to remove the symlink before creating
chinyeungli Nov 10, 2021
61af9f9
Merge remote-tracking branch 'puppeter/basic' into adopt-vers-spec
pombredanne Nov 23, 2021
6b2320a
Improve handling licenses without scancode
pombredanne Nov 26, 2021
6ccff2b
Add support for deb and rpm containers
pombredanne Nov 26, 2021
6962f8b
Support licenses when ScanCode is not installed
pombredanne Nov 26, 2021
04c5de3
Merge remote-tracking branch 'rubygems/master' into refinements
pombredanne Dec 6, 2021
dd188e4
Merge pull request #14 from nexB/refinements
pombredanne Jan 10, 2022
2f77f97
Improve wheel build
pombredanne Jan 12, 2022
784e701
Aligne with latest ScanCode TK updates
pombredanne Jan 12, 2022
a7c2efd
Do not ignore setup.py
pombredanne Jan 12, 2022
b1dabd8
Update scripts
pombredanne Jan 12, 2022
0fca296
Merge latest skeleton
pombredanne Feb 9, 2022
4004ebe
Do not use pytest 7.0.0 which is buggy
pombredanne Feb 14, 2022
b15b6b7
Update `configure` to work with space in installation path
chinyeungli Feb 17, 2022
311b0a1
Remove echo statement
chinyeungli Feb 17, 2022
5351f0b
automate pypi release on a tag
TG1999 Feb 17, 2022
96b6405
Refine GH Action definition
pombredanne Feb 18, 2022
635df78
Format GH action yaml
pombredanne Feb 18, 2022
6bbeddd
Use verbose name for job
pombredanne Feb 18, 2022
840ccef
Add black codestyle test for skeleton
keshav-space Feb 22, 2022
35af643
Update configure.bat
chinyeungli Feb 23, 2022
70a2d2f
Merge pull request #55 from nexB/configure_for_path_with_spaces_on_wi…
pombredanne Feb 23, 2022
c7084ee
Merge pull request #56 from keshav-space/main
pombredanne Feb 23, 2022
9558c0c
Deprecate windows-2016 images for azure CI
AyanSinhaMahapatra Feb 23, 2022
e19a520
Remove macos 10.14 job from azure-pipelines.yml
JonoYang Mar 1, 2022
cb17d70
Merge pull request #57 from nexB/deprecate-win-2016-ci
JonoYang Mar 1, 2022
7eb4ca8
Merge pull request #58 from nexB/remove-mac-1014
JonoYang Mar 1, 2022
47da14b
Do not use Python 3.6 on Windows 2022 jobs
JonoYang Mar 1, 2022
c4678dc
Merge pull request #59 from nexB/win2022-py36
JonoYang Mar 1, 2022
ad17a42
Deprecate windows-2016 images for azure CI
AyanSinhaMahapatra Feb 23, 2022
cad3164
Remove macos 10.14 job from azure-pipelines.yml
JonoYang Mar 1, 2022
d659e09
Do not use Python 3.6 on Windows 2022 jobs
JonoYang Mar 1, 2022
b408c85
Merge pull request #60 from nexB/update-signoff
pombredanne Mar 4, 2022
c5251f4
Run tests on macOS 11
pombredanne Mar 4, 2022
a118fe7
Align configuration scripts on POSIX and Windows
pombredanne Mar 4, 2022
e810da3
Update README
pombredanne Mar 4, 2022
243f7cb
Refactor and streamline thirdparty utilities
pombredanne Mar 5, 2022
931f610
Cleanup whitespaces
pombredanne Mar 5, 2022
6e43a7a
Add usage instructions to README.rst
JonoYang Mar 9, 2022
ae73ce3
Merge pull request #61 from nexB/update-readme
JonoYang Mar 9, 2022
6238b83
Merge branch 'main' of https://github.com/nexB/skeleton into main
pombredanne Mar 9, 2022
b272e3b
Format code
pombredanne Mar 9, 2022
907e540
Merge pull request #62 from nexB/better-tpp-scripts
pombredanne Mar 9, 2022
1e4d3bc
Reorg setup sections
pombredanne Mar 9, 2022
03d4799
Do not depend on click. Use argparse.
pombredanne Mar 9, 2022
f0d5a29
Correct configure scripts
pombredanne Mar 9, 2022
6ed9983
Remove remnants of configure --init
pombredanne Mar 9, 2022
bf6bbaa
Pytyon 3.6 is not available on Windows 2022
pombredanne Mar 11, 2022
4ab834f
Add long_description_content_type
pombredanne Mar 11, 2022
4ef463f
Run fewer Azure jobs
pombredanne Mar 14, 2022
e921052
Add RTD css templates
AyanSinhaMahapatra Mar 22, 2022
bd2df2a
Add GitHub action for doc build tests
AyanSinhaMahapatra Mar 24, 2022
3e2d801
Fix conf.py to fix doc build
AyanSinhaMahapatra Mar 24, 2022
c76dff4
Merge pull request #63 from nexB/add-rtd-templates
AyanSinhaMahapatra Mar 24, 2022
eb57889
Add docs option in configure
AyanSinhaMahapatra Mar 24, 2022
2841270
Merge pull request #64 from nexB/add-docs-in-configure
AyanSinhaMahapatra Mar 29, 2022
5556e71
Add documentation contribute page
AyanSinhaMahapatra Mar 30, 2022
f3d1fcd
Merge pull request #65 from nexB/add-docs-contrib
AyanSinhaMahapatra Mar 30, 2022
5431ee5
Properly check for existance of thirdparty dir
JonoYang Apr 28, 2022
435e9ee
Merge pull request #66 from nexB/check-for-thirdparty-dir
JonoYang Apr 28, 2022
b02d5d5
Merge remote-tracking branch 'uni/main' into main
pombredanne Apr 29, 2022
c44c442
Improve GH action documentation
pombredanne Apr 29, 2022
99ba101
Use Python 3.9 as a base for actions
pombredanne Apr 29, 2022
00f4fe7
Remove variable from string in fetch_thirdparty.py
JonoYang Apr 29, 2022
5d48c1c
Improve thirdparty scripts
pombredanne May 2, 2022
6a3c5b0
Update thirdparty fetching utilities
pombredanne May 7, 2022
f2c5a48
Merge branch 'master' into latest-skeleton
pombredanne May 9, 2022
39190dc
Merge latest skeleton
pombredanne May 9, 2022
be774ae
Use correct doc settings
pombredanne May 10, 2022
b9cdafa
Remove dep on six
pombredanne May 10, 2022
b11a5ed
Sync config with SCTK
pombredanne May 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
A Simple Python Project Skeleton
================================
This repo attempts to standardize our python repositories using modern python
packaging and configuration techniques. Using this `blog post`_ as inspiration, this
repository will serve as the base for all new python projects and will be adopted to all
our existing ones as well.
This repo attempts to standardize the structure of the Python-based project's
repositories using modern Python packaging and configuration techniques.
Using this `blog post`_ as inspiration, this repository serves as the base for
all new Python projects and is mergeable in existing repositories as well.

.. _blog post: https://blog.jaraco.com/a-project-skeleton-for-python-projects/


Usage
=====

Expand Down Expand Up @@ -36,9 +37,16 @@ This is also the workflow to use when updating the skeleton files in any given r

More usage instructions can be found in ``docs/skeleton-usage.rst``.


Release Notes
=============

- 2022-03-04:
- Synchronize configure and configure.bat scripts for sanity
- Update CI operating system support with latest Azure OS images
- Streamline utility scripts in etc/scripts/ to create, fetch and manage third-party dependencies
There are now fewer scripts. See etc/scripts/README.rst for details

- 2021-09-03:
- ``configure`` now requires pinned dependencies via the use of ``requirements.txt`` and ``requirements-dev.txt``
- ``configure`` can now accept multiple options at once
Expand Down
8 changes: 8 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ jobs:
test_suites:
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: macos11_cpython
image_name: macos-11
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
test_suites:
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-win.yml
parameters:
job_name: win2019_cpython
Expand Down
155 changes: 84 additions & 71 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ set -e
# Source this script for initial configuration
# Use configure --help for details
#
# NOTE: please keep in sync with Windows script configure.bat
#
# This script will search for a virtualenv.pyz app in etc/thirdparty/virtualenv.pyz
# Otherwise it will download the latest from the VIRTUALENV_PYZ_URL default
################################
Expand All @@ -32,10 +34,8 @@ DEV_REQUIREMENTS="--editable .[testing] --constraint requirements.txt --constrai
# where we create a virtualenv
VIRTUALENV_DIR=venv

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

# extra arguments passed to pip
PIP_EXTRA_ARGS=" "
Expand All @@ -50,11 +50,14 @@ VIRTUALENV_PYZ_URL=https://bootstrap.pypa.io/virtualenv.pyz
CFG_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin


################################
# 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 "
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty"
fi
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi"
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"


################################
Expand All @@ -65,56 +68,50 @@ fi


################################
# find a proper Python to run
# Use environment variables or a file if available.
# Otherwise the latest Python by default.
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
# check for a file named PYTHON_EXECUTABLE
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
else
PYTHON_EXECUTABLE=python3
fi
fi
# Main command line entry point
main() {
CFG_REQUIREMENTS=$REQUIREMENTS
NO_INDEX="--no-index"

# We are using getopts to parse option arguments that start with "-"
while getopts :-: optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
help ) cli_help;;
clean ) find_python && clean;;
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS";;
init ) NO_INDEX="";;
esac;;
esac
done

PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"

################################
cli_help() {
echo An initial configuration script
echo " usage: ./configure [options]"
echo
echo The default is to configure for regular use. Use --dev for development.
echo Use the --init option if starting a new project and the project
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
echo and requirements.txt and/or requirements-dev.txt has not been generated.
echo
echo The options are:
echo " --clean: clean built and installed files and exit."
echo " --dev: configure the environment for development."
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
echo " --help: display this help message and exit."
echo
echo By default, the python interpreter version found in the path is used.
echo Alternatively, the PYTHON_EXECUTABLE environment variable can be set to
echo configure another Python executable interpreter to use. If this is not
echo set, a file named PYTHON_EXECUTABLE containing a single line with the
echo path of the Python executable to use will be checked last.
set +e
exit
find_python
create_virtualenv "$VIRTUALENV_DIR"
install_packages "$CFG_REQUIREMENTS"
. "$CFG_BIN_DIR/activate"
}


clean() {
# Remove cleanable file and directories and files from the root dir.
echo "* Cleaning ..."
for cln in $CLEANABLE;
do rm -rf "${CFG_ROOT_DIR:?}/${cln:?}";
done
set +e
exit
################################
# Find a proper Python to run
# Use environment variables or a file if available.
# Otherwise the latest Python by default.
find_python() {
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
# check for a file named PYTHON_EXECUTABLE
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
else
PYTHON_EXECUTABLE=python3
fi
fi
}


################################
create_virtualenv() {
# create a virtualenv for Python
# Note: we do not use the bundled Python 3 "venv" because its behavior and
Expand Down Expand Up @@ -145,6 +142,7 @@ create_virtualenv() {
}


################################
install_packages() {
# install requirements in virtualenv
# note: --no-build-isolation means that pip/wheel/setuptools will not
Expand All @@ -162,28 +160,43 @@ install_packages() {


################################
# Main command line entry point
CFG_DEV_MODE=0
CFG_REQUIREMENTS=$REQUIREMENTS
NO_INDEX="--no-index"

# We are using getopts to parse option arguments that start with "-"
while getopts :-: optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
help ) cli_help;;
clean ) clean;;
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
init ) NO_INDEX="";;
esac;;
esac
done

PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"

create_virtualenv "$VIRTUALENV_DIR"
install_packages "$CFG_REQUIREMENTS"
. "$CFG_BIN_DIR/activate"
cli_help() {
echo An initial configuration script
echo " usage: ./configure [options]"
echo
echo The default is to configure for regular use. Use --dev for development.
echo Use the --init option if starting a new project and the project
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
echo and requirements.txt and/or requirements-dev.txt has not been generated.
echo
echo The options are:
echo " --clean: clean built and installed files and exit."
echo " --dev: configure the environment for development."
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
echo " --help: display this help message and exit."
echo
echo By default, the python interpreter version found in the path is used.
echo Alternatively, the PYTHON_EXECUTABLE environment variable can be set to
echo configure another Python executable interpreter to use. If this is not
echo set, a file named PYTHON_EXECUTABLE containing a single line with the
echo path of the Python executable to use will be checked last.
set +e
exit
}


################################
clean() {
# Remove cleanable file and directories and files from the root dir.
echo "* Cleaning ..."
for cln in $CLEANABLE;
do rm -rf "${CFG_ROOT_DIR:?}/${cln:?}";
done
set +e
exit
}


main

set +e
19 changes: 13 additions & 6 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
@rem # Source this script for initial configuration
@rem # Use configure --help for details

@rem # NOTE: please keep in sync with POSIX script configure

@rem # This script will search for a virtualenv.pyz app in etc\thirdparty\virtualenv.pyz
@rem # Otherwise it will download the latest from the VIRTUALENV_PYZ_URL default
@rem ################################
Expand Down Expand Up @@ -49,10 +51,11 @@ 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
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" & %INDEX_ARG%
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"


@rem ################################
Expand All @@ -64,7 +67,6 @@ if not defined CFG_QUIET (

@rem ################################
@rem # Main command line entry point
set CFG_DEV_MODE=0
set "CFG_REQUIREMENTS=%REQUIREMENTS%"
set "NO_INDEX=--no-index"

Expand All @@ -74,7 +76,6 @@ if not "%1" == "" (
if "%1" EQU "--clean" (goto clean)
if "%1" EQU "--dev" (
set "CFG_REQUIREMENTS=%DEV_REQUIREMENTS%"
set CFG_DEV_MODE=1
)
if "%1" EQU "--init" (
set "NO_INDEX= "
Expand All @@ -87,7 +88,7 @@ set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% %NO_INDEX%"


@rem ################################
@rem # find a proper Python to run
@rem # Find a proper Python to run
@rem # Use environment variables or a file if available.
@rem # Otherwise the latest Python by default.
if not defined PYTHON_EXECUTABLE (
Expand All @@ -99,6 +100,8 @@ if not defined PYTHON_EXECUTABLE (
)
)


@rem ################################
:create_virtualenv
@rem # create a virtualenv for Python
@rem # Note: we do not use the bundled Python 3 "venv" because its behavior and
Expand Down Expand Up @@ -143,6 +146,7 @@ if %ERRORLEVEL% neq 0 (
)


@rem ################################
:install_packages
@rem # install requirements in virtualenv
@rem # note: --no-build-isolation means that pip/wheel/setuptools will not
Expand All @@ -157,6 +161,9 @@ if %ERRORLEVEL% neq 0 (
%PIP_EXTRA_ARGS% ^
%CFG_REQUIREMENTS%


@rem ################################
:create_bin_junction
@rem # Create junction to bin to have the same directory between linux and windows
if exist "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin" (
rmdir /s /q "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin"
Expand All @@ -171,7 +178,6 @@ exit /b 0


@rem ################################

:cli_help
echo An initial configuration script
echo " usage: configure [options]"
Expand All @@ -195,11 +201,12 @@ exit /b 0
exit /b 0


@rem ################################
:clean
@rem # Remove cleanable file and directories and files from the root dir.
echo "* Cleaning ..."
for %%F in (%CLEANABLE%) do (
rmdir /s /q "%CFG_ROOT_DIR%\%%F" >nul 2>&1
del /f /q "%CFG_ROOT_DIR%\%%F" >nul 2>&1
)
exit /b 0
exit /b 0
Loading