Skip to content

Commit 50cf5cd

Browse files
authored
Merge pull request #92 from nexB/update-skeleton-files
Update skeleton files
2 parents 849b990 + 2e1ed01 commit 50cf5cd

20 files changed

+322
-113
lines changed

.github/workflows/docs-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717

1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v4
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222

.github/workflows/pypi-release.yml

+76-20
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,83 @@
1-
name: Release library as a PyPI wheel and sdist on GH release creation
1+
name: Create library release archives, create a GH release and publish PyPI wheel and sdist on tag in main branch
2+
3+
4+
# This is executed automatically on a tag in the main branch
5+
6+
# Summary of the steps:
7+
# - build wheels and sdist
8+
# - upload wheels and sdist to PyPI
9+
# - create gh-release and upload wheels and dists there
10+
# TODO: smoke test wheels and sdist
11+
# TODO: add changelog to release text body
12+
13+
# WARNING: this is designed only for packages building as pure Python wheels
214

315
on:
4-
release:
5-
types: [created]
16+
workflow_dispatch:
17+
push:
18+
tags:
19+
- "v*.*.*"
620

721
jobs:
8-
build-and-publish-to-pypi:
22+
build-pypi-distribs:
923
name: Build and publish library to PyPI
1024
runs-on: ubuntu-20.04
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: Set up Python
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: 3.9
32+
33+
- name: Install pypa/build
34+
run: python -m pip install build --user
35+
36+
- name: Build a binary wheel and a source tarball
37+
run: python -m build --sdist --wheel --outdir dist/
38+
39+
- name: Upload built archives
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: pypi_archives
43+
path: dist/*
44+
45+
46+
create-gh-release:
47+
name: Create GH release
48+
needs:
49+
- build-pypi-distribs
50+
runs-on: ubuntu-20.04
51+
52+
steps:
53+
- name: Download built archives
54+
uses: actions/download-artifact@v3
55+
with:
56+
name: pypi_archives
57+
path: dist
58+
59+
- name: Create GH release
60+
uses: softprops/action-gh-release@v1
61+
with:
62+
draft: true
63+
files: dist/*
64+
65+
66+
create-pypi-release:
67+
name: Create PyPI release
68+
needs:
69+
- create-gh-release
70+
runs-on: ubuntu-20.04
71+
1172
steps:
12-
- uses: actions/checkout@master
13-
- name: Set up Python
14-
uses: actions/setup-python@v1
15-
with:
16-
python-version: 3.9
17-
- name: Install pypa/build
18-
run: python -m pip install build --user
19-
- name: Build a binary wheel and a source tarball
20-
run: python -m build --sdist --wheel --outdir dist/
21-
.
22-
- name: Publish distribution to PyPI
23-
if: startsWith(github.ref, 'refs/tags')
24-
uses: pypa/gh-action-pypi-publish@master
25-
with:
26-
password: ${{ secrets.PYPI_API_TOKEN }}
27-
73+
- name: Download built archives
74+
uses: actions/download-artifact@v3
75+
with:
76+
name: pypi_archives
77+
path: dist
78+
79+
- name: Publish to PyPI
80+
if: startsWith(github.ref, 'refs/tags')
81+
uses: pypa/gh-action-pypi-publish@release/v1
82+
with:
83+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.py[cod]
33

44
# virtualenv and other misc bits
5+
/src/*.egg-info
56
*.egg-info
67
/dist
78
/build

.readthedocs.yml

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
# Required
66
version: 2
77

8+
# Build in latest ubuntu/python
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
14+
# Build PDF & ePub
15+
formats:
16+
- epub
17+
- pdf
18+
819
# Where the Sphinx conf.py file is located
920
sphinx:
1021
configuration: docs/source/conf.py

Makefile

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) nexB Inc. and others. All rights reserved.
4+
# ScanCode is a trademark of nexB Inc.
5+
# SPDX-License-Identifier: Apache-2.0
6+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
7+
# See https://github.com/nexB/skeleton for support or download.
8+
# See https://aboutcode.org for more information about nexB OSS projects.
9+
#
10+
11+
# Python version can be specified with `$ PYTHON_EXE=python3.x make conf`
12+
PYTHON_EXE?=python3
13+
VENV=venv
14+
ACTIVATE?=. ${VENV}/bin/activate;
15+
16+
dev:
17+
@echo "-> Configure the development envt."
18+
./configure --dev
19+
20+
isort:
21+
@echo "-> Apply isort changes to ensure proper imports ordering"
22+
${VENV}/bin/isort --sl -l 100 src tests setup.py
23+
24+
black:
25+
@echo "-> Apply black code formatter"
26+
${VENV}/bin/black -l 100 src tests setup.py
27+
28+
doc8:
29+
@echo "-> Run doc8 validation"
30+
@${ACTIVATE} doc8 --max-line-length 100 --ignore-path docs/_build/ --quiet docs/
31+
32+
valid: isort black
33+
34+
check:
35+
@echo "-> Run pycodestyle (PEP8) validation"
36+
@${ACTIVATE} pycodestyle --max-line-length=100 --exclude=.eggs,venv,lib,thirdparty,docs,migrations,settings.py,.cache .
37+
@echo "-> Run isort imports ordering validation"
38+
@${ACTIVATE} isort --sl --check-only -l 100 setup.py src tests .
39+
@echo "-> Run black validation"
40+
@${ACTIVATE} black --check --check -l 100 src tests setup.py
41+
42+
clean:
43+
@echo "-> Clean the Python env"
44+
./configure --clean
45+
46+
test:
47+
@echo "-> Run the test suite"
48+
${VENV}/bin/pytest -vvs
49+
50+
docs:
51+
rm -rf docs/_build/
52+
@${ACTIVATE} sphinx-build docs/ docs/_build/
53+
54+
.PHONY: conf dev check valid black isort clean test docs

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FetchCode: Utilities to fetch code from purls, URLs and version control repos.
1+
FetchCode: Utilities to fetch code from purls, URLs and version control repos.
22
================================================================================
33

44
FetchCode is a library to reliably fetch code via HTTP, FTP and version control
5-
systems. It can work using plain HTTP and FTP URLs, as well as
5+
systems. It can work using plain HTTP and FTP URLs, as well as
66
`Package URLs <https://github.com/package-url>`_ and version control (VCS) URLs
77
as used in Python pip and as specified in `SPDX Package Download Location
88
<https://spdx.github.io/spdx-spec/3-package-information/#37-package-download-location>`_

azure-pipelines.yml

+21-13
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,56 @@ jobs:
99

1010
- template: etc/ci/azure-posix.yml
1111
parameters:
12-
job_name: ubuntu18_cpython
13-
image_name: ubuntu-18.04
14-
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
12+
job_name: ubuntu20_cpython
13+
image_name: ubuntu-20.04
14+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
1515
test_suites:
1616
all: venv/bin/pytest -n 2 -vvs
1717

1818
- template: etc/ci/azure-posix.yml
1919
parameters:
20-
job_name: ubuntu20_cpython
21-
image_name: ubuntu-20.04
22-
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
20+
job_name: ubuntu22_cpython
21+
image_name: ubuntu-22.04
22+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
23+
test_suites:
24+
all: venv/bin/pytest -n 2 -vvs
25+
26+
- template: etc/ci/azure-posix.yml
27+
parameters:
28+
job_name: macos11_cpython
29+
image_name: macOS-11
30+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
2331
test_suites:
2432
all: venv/bin/pytest -n 2 -vvs
2533

2634
- template: etc/ci/azure-posix.yml
2735
parameters:
2836
job_name: macos12_cpython
29-
image_name: macos-12
30-
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
37+
image_name: macOS-12
38+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
3139
test_suites:
3240
all: venv/bin/pytest -n 2 -vvs
3341

3442
- template: etc/ci/azure-posix.yml
3543
parameters:
36-
job_name: macos11_cpython
37-
image_name: macos-11
38-
python_versions: ['3.7', '3.8', '3.9', '3.10']
44+
job_name: macos13_cpython
45+
image_name: macOS-13
46+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
3947
test_suites:
4048
all: venv/bin/pytest -n 2 -vvs
4149

4250
- template: etc/ci/azure-win.yml
4351
parameters:
4452
job_name: win2019_cpython
4553
image_name: windows-2019
46-
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
54+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
4755
test_suites:
4856
all: venv\Scripts\pytest -n 2 -vvs
4957

5058
- template: etc/ci/azure-win.yml
5159
parameters:
5260
job_name: win2022_cpython
5361
image_name: windows-2022
54-
python_versions: ['3.7', '3.8', '3.9', '3.10']
62+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
5563
test_suites:
5664
all: venv\Scripts\pytest -n 2 -vvs

configure

+13-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ DOCS_REQUIREMENTS="--editable .[docs] --constraint requirements.txt"
3636
VIRTUALENV_DIR=venv
3737

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

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

5454

55+
################################
56+
# Install with or without and index. With "--no-index" this is using only local wheels
57+
# This is an offline mode with no index and no network operations
58+
# NO_INDEX="--no-index "
59+
NO_INDEX=""
60+
61+
5562
################################
5663
# Thirdparty package locations and index handling
57-
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
58-
if [ -d "$CFG_ROOT_DIR/thirdparty" ]; then
59-
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty"
64+
# Find packages from the local thirdparty directory if present
65+
THIRDPARDIR=$CFG_ROOT_DIR/thirdparty
66+
if [[ "$(echo $THIRDPARDIR/*.whl)x" != "$THIRDPARDIR/*.whlx" ]]; then
67+
PIP_EXTRA_ARGS="$NO_INDEX --find-links $THIRDPARDIR"
6068
fi
61-
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"
6269

6370

6471
################################
@@ -183,6 +190,7 @@ while getopts :-: optchar; do
183190
esac
184191
done
185192

193+
186194
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS"
187195

188196
find_python

configure.bat

+2-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ set "DOCS_REQUIREMENTS=--editable .[docs] --constraint requirements.txt"
3434
set "VIRTUALENV_DIR=venv"
3535

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

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

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

6160

6261
@rem ################################
@@ -69,7 +68,6 @@ if not defined CFG_QUIET (
6968
@rem ################################
7069
@rem # Main command line entry point
7170
set "CFG_REQUIREMENTS=%REQUIREMENTS%"
72-
set "NO_INDEX=--no-index"
7371

7472
:again
7573
if not "%1" == "" (

0 commit comments

Comments
 (0)