Skip to content

Commit 30c9805

Browse files
authored
Drop unsupported Python versions
* Upgrade pre-commit dependencies * Rename codecov config file * Update manifest file * Update tests configuration * Update contributor's agreement link * Do not create universal wheels * Migrate to pyproject.toml * Update requirements files * Run docs CI job separately * Pin sphinx version to support Python 3.8 * Add make rules for pip-compile commands * Add GitHub workflow for uploading to PyPI * Bump version
1 parent e96f0ff commit 30c9805

File tree

19 files changed

+358
-160
lines changed

19 files changed

+358
-160
lines changed
File renamed without changes.

.coveragerc

Lines changed: 0 additions & 6 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

.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: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,65 +7,57 @@ on:
77
- "master"
88
jobs:
99
test:
10-
name: "Test ${{ matrix.toxenv }}"
11-
runs-on: "ubuntu-20.04"
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', '**/dev.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-report xml:coverage.xml
39+
tox -- --cov metsrw --cov-report xml:coverage.xml
5040
- name: "Upload coverage report"
5141
if: github.repository == 'artefactual-labs/mets-reader-writer'
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
@@ -82,7 +74,10 @@ jobs:
8274
- name: "Set up Python"
8375
uses: "actions/setup-python@v4"
8476
with:
85-
python-version: "3.8"
77+
python-version: "3.12"
78+
cache-dependency-path: |
79+
requirements.txt
80+
requirements-dev.txt
8681
- name: "Install tox"
8782
run: |
8883
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

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ For more information on contribution guidelines and standards, see the CONTRIBUT
4444

4545
## Contributor's Agreement
4646

47-
In order for the Archivematica development team to accept any patches or code commits, contributors must first sign this [Contributor's Agreement](https://wiki.archivematica.org/images/2/25/Contributor_agreement.txt).
47+
In order for the Archivematica development team to accept any patches or code commits, contributors must first sign this [Contributor's Agreement](https://wiki.archivematica.org/images/e/e6/Archivematica-CLA-firstname-lastname-YYYY.pdf).
4848
The Archivematica contributor's agreement is based almost verbatim on the [Apache Foundation](http://apache.org )'s individual [contributor license](http://www.apache.org/licenses/icla.txt).
4949

5050
If you have any questions or concerns about the Contributor's Agreement, please email us at [email protected] to discuss them.
@@ -61,7 +61,7 @@ This ensures our resources are devoted to making our project the best they can b
6161

6262
### How do I send in an agreement?
6363

64-
Please print out, read, sign, and scan the [contributor agreement](https://wiki.archivematica.org/images/2/25/Contributor_agreement.txt) and email it to [email protected]
64+
Please print out, read, sign, and scan the [contributor agreement](https://wiki.archivematica.org/images/e/e6/Archivematica-CLA-firstname-lastname-YYYY.pdf) and email it to [email protected]
6565
Alternatively, you may send an original signed agreement to:
6666

6767
Artefactual Systems Inc.

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
include metsrw/resources/*
2-
include LICENSE
2+
include LICENSE
3+
include README.md

Makefile

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1-
.PHONY: clean package package-deps package-source package-upload package-wheel
1+
.DEFAULT_GOAL := help
22

3-
package-deps:
4-
pip install --upgrade twine wheel
3+
.PHONY: clean package package-deps package-distribution package-upload pip-compile pip-upgrade
54

6-
package-source:
7-
python setup.py sdist
5+
package-deps: ## Upgrade dependencies for packaging
6+
python3 -m pip install --upgrade build twine
87

9-
package-wheel: package-deps
10-
python setup.py bdist_wheel --universal
8+
package-distribution: package-deps ## Create distribution packages
9+
python3 -m build
1110

12-
package-check: package-source package-wheel ## Check the distribution is valid
13-
twine check dist/*
11+
package-check: package-distribution ## Check the distribution is valid
12+
python3 -m twine check --strict dist/*
1413

15-
package-upload: package-deps package-check
16-
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/
1716

1817
package: package-upload
1918

20-
clean:
19+
clean: ## Clean the package directory
2120
rm -rf metsrw.egg-info/
2221
rm -rf build/
2322
rm -rf dist/
23+
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
33+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

metsrw/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
LOGGER = logging.getLogger(__name__)
4343
LOGGER.addHandler(logging.NullHandler())
44-
__version__ = "0.4.0"
44+
__version__ = "0.5.0"
4545

4646
__all__ = [
4747
"Agent",

0 commit comments

Comments
 (0)