Skip to content

Commit 6abd88f

Browse files
authored
Drop unsupported Python versions
* Upgrade pre-commit dependencies * Rename codecov config file * Add manifest file * Update tests configuration * Migrate to pyproject.toml * Update requirements files * Remove vcrpy * Do not create universal wheels * Add make rules for pip-compile commands * Add GitHub workflow for uploading to PyPI
1 parent 2722386 commit 6abd88f

File tree

75 files changed

+3476
-110529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3476
-110529
lines changed
File renamed without changes.

.coveragerc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.flake8

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[flake8]
2+
exclude = .tox, .git, __pycache__, .cache, build, dist, *.pyc, *.egg-info, .eggs
3+
# Error codes:
4+
# - https://flake8.pycqa.org/en/latest/user/error-codes.html
5+
# - https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
6+
# - https://github.com/PyCQA/flake8-bugbear#list-of-warnings
7+
#
8+
# E203: whitespace before `,`, `;` or `:`
9+
# E402: module level import not at top of file
10+
# E501: line too long
11+
# W503: line break before binary operator
12+
ignore =
13+
E203,
14+
E402,
15+
E501,
16+
W503

.gitattributes

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: "Release"
3+
on: "workflow_dispatch"
4+
jobs:
5+
build:
6+
name: "Build"
7+
runs-on: "ubuntu-22.04"
8+
steps:
9+
- name: "Check out repository"
10+
uses: "actions/checkout@v4"
11+
- name: "Set up Python"
12+
uses: "actions/setup-python@v4"
13+
with:
14+
python-version: "3.9"
15+
- name: "Build distribution packages"
16+
run: make package-check
17+
- name: "Save distribution directory"
18+
uses: "actions/upload-artifact@v3"
19+
with:
20+
name: "distribution"
21+
path: |
22+
dist
23+
upload:
24+
name: "Upload"
25+
needs: "build"
26+
runs-on: "ubuntu-22.04"
27+
environment: "release"
28+
permissions:
29+
id-token: "write"
30+
steps:
31+
- name: "Restore distribution directory"
32+
uses: "actions/download-artifact@v3"
33+
with:
34+
name: "distribution"
35+
path: |
36+
dist
37+
- name: "Upload distribution packages to PyPI"
38+
uses: "pypa/gh-action-pypi-publish@release/v1"

.github/workflows/test.yml

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,58 @@ on:
66
branches:
77
- "master"
88
jobs:
9-
tox:
10-
name: "Test ${{ matrix.toxenv }}"
11-
runs-on: "ubuntu-20.04"
9+
test:
10+
name: "Test Python ${{ matrix.python-version }}"
11+
runs-on: "ubuntu-22.04"
1212
strategy:
13+
fail-fast: false
1314
matrix:
14-
include:
15-
- python-version: "3.6"
16-
toxenv: "py36"
17-
- python-version: "3.7"
18-
toxenv: "py37"
19-
- python-version: "3.8"
20-
toxenv: "py38"
21-
- python-version: "3.9"
22-
toxenv: "py39"
15+
python-version: [
16+
"3.8",
17+
"3.9",
18+
"3.10",
19+
"3.11",
20+
"3.12",
21+
]
2322
steps:
2423
- name: "Check out repository"
25-
uses: "actions/checkout@v3"
24+
uses: "actions/checkout@v4"
2625
- name: "Set up Python ${{ matrix.python-version }}"
2726
uses: "actions/setup-python@v4"
2827
with:
2928
python-version: "${{ matrix.python-version }}"
30-
- name: "Get pip cache dir"
31-
id: "pip-cache"
32-
run: |
33-
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
34-
- name: "Cache pip packages"
35-
uses: "actions/cache@v3"
36-
with:
37-
path: "${{ steps.pip-cache.outputs.dir }}"
38-
key: "${{ runner.os }}-pip-${{ hashFiles('**/base.txt', '**/local.txt', '**/production.txt') }}"
39-
restore-keys: |
40-
${{ runner.os }}-pip-
29+
cache: "pip"
30+
cache-dependency-path: |
31+
requirements.txt
32+
requirements-dev.txt
4133
- name: "Install tox"
4234
run: |
4335
python -m pip install --upgrade pip
44-
pip install tox
36+
pip install tox tox-gh-actions
4537
- name: "Run tox"
46-
env:
47-
TOXENV: ${{ matrix.toxenv }}
4838
run: |
49-
tox -- --cov amclient --cov-config .coveragerc --cov-report xml:coverage.xml
39+
tox -- --cov amclient --cov-report xml:coverage.xml
5040
- name: "Upload coverage report"
5141
if: github.repository == 'artefactual-labs/amclient'
5242
uses: "codecov/codecov-action@v3"
5343
with:
5444
files: ./coverage.xml
55-
fail_ci_if_error: true
45+
fail_ci_if_error: false
5646
verbose: true
57-
name: ${{ matrix.toxenv }}
58-
flags: ${{ matrix.toxenv }}
5947
lint:
6048
name: "Lint"
6149
runs-on: "ubuntu-22.04"
6250
steps:
6351
- name: "Check out repository"
64-
uses: "actions/checkout@v3"
52+
uses: "actions/checkout@v4"
6553
- name: "Set up Python"
6654
uses: "actions/setup-python@v4"
6755
with:
68-
python-version: "3.8"
56+
python-version: "3.12"
57+
cache: "pip"
58+
cache-dependency-path: |
59+
requirements.txt
60+
requirements-dev.txt
6961
- name: "Install tox"
7062
run: |
7163
python -m pip install --upgrade pip

.pre-commit-config.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
repos:
22
- repo: https://github.com/asottile/pyupgrade
3-
rev: v2.31.0
3+
rev: v3.15.0
44
hooks:
55
- id: pyupgrade
6-
args: [--py3-plus, --py36-plus]
6+
args: [--py38-plus]
77
- repo: https://github.com/asottile/reorder_python_imports
8-
rev: v2.6.0
8+
rev: v3.12.0
99
hooks:
1010
- id: reorder-python-imports
11-
args: [--py3-plus, --py36-plus]
12-
- repo: https://github.com/ambv/black
13-
rev: 22.8.0
11+
args: [--py38-plus]
12+
- repo: https://github.com/psf/black
13+
rev: "23.10.1"
1414
hooks:
1515
- id: black
1616
args: [--safe, --quiet]
17-
language_version: python3
1817
- repo: https://github.com/pycqa/flake8
19-
rev: 5.0.4
18+
rev: "6.1.0"
2019
hooks:
2120
- id: flake8
22-
language_version: python3
21+
additional_dependencies:
22+
- flake8-bugbear==23.9.16
23+
- flake8-comprehensions==3.14.0

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include LICENSE
2+
include README.md
3+
include TRADEMARK

Makefile

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
.DEFAULT_GOAL := help
22

3-
.PHONY: clean package package-deps package-source package-upload package-wheel
3+
.PHONY: clean package package-deps package-distribution package-upload pip-compile pip-upgrade
44

5-
package-deps: ## Upgrade dependencies for packaging
6-
python3 -m pip install --upgrade twine wheel
5+
package-deps: ## Upgrade dependencies for packaging
6+
python3 -m pip install --upgrade build twine
77

8-
package-source: ## Package the source code
9-
python3 setup.py sdist
8+
package-distribution: package-deps ## Create distribution packages
9+
python3 -m build
1010

11-
package-wheel: package-deps ## Package a Python wheel
12-
python3 setup.py bdist_wheel --universal
11+
package-check: package-distribution ## Check the distribution is valid
12+
python3 -m twine check --strict dist/*
1313

14-
package-check: package-source package-wheel ## Check the distribution is valid
15-
twine check dist/*
16-
17-
package-upload: package-deps package-check ## Upload package
18-
twine upload dist/* --repository-url https://upload.pypi.org/legacy/
14+
package-upload: package-deps package-check ## Upload distribution packages
15+
python3 -m twine upload dist/* --repository-url https://upload.pypi.org/legacy/
1916

2017
package: package-upload
2118

@@ -24,5 +21,13 @@ clean: ## Clean the package directory
2421
rm -rf build/
2522
rm -rf dist/
2623

27-
help: ## Print this help message.
24+
pip-compile: ## Compile pip requirements
25+
pip-compile --allow-unsafe --output-file=requirements.txt pyproject.toml
26+
pip-compile --allow-unsafe --extra=dev --output-file=requirements-dev.txt pyproject.toml
27+
28+
pip-upgrade: ## Upgrade pip requirements
29+
pip-compile --allow-unsafe --upgrade --output-file=requirements.txt pyproject.toml
30+
pip-compile --allow-unsafe --upgrade --extra=dev --output-file=requirements-dev.txt pyproject.toml
31+
32+
help: ## Print this help message
2833
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

amclient/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44

55
# If the additional module commands need to be included they can also be
66
# included here.
7-
__all__ = []
7+
__all__ = [
8+
"AMClient",
9+
]

0 commit comments

Comments
 (0)