Skip to content

Commit

Permalink
Migrate package setup to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
replaceafill committed Nov 8, 2023
1 parent b5bbde8 commit 0238a01
Show file tree
Hide file tree
Showing 13 changed files with 266 additions and 54 deletions.
File renamed without changes.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

25 changes: 1 addition & 24 deletions tox.ini → .flake8
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
[tox]
skipsdist = True
envlist = py{38,39,310,311,312},linting

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
skip_install = True
deps = -rrequirements-dev.txt
whitelist_externals = pytest
commands = pytest {posargs}

[testenv:linting]
basepython = python3
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure

[flake8]
exclude = .tox, .git, __pycache__, .cache, build, dist, *.pyc, *.egg-info, .eggs
# Error codes:
# - https://flake8.pycqa.org/en/latest/user/error-codes.html
# - https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
# - https://github.com/PyCQA/flake8-bugbear#list-of-warnings
#
# E203: whitespace before ‘,’, ‘;’, or ‘:’
# E203: whitespace before `,`, `;` or `:`
# E402: module level import not at top of file
# E501: line too long
# W503: line break before binary operator
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
uses: "actions/setup-python@v4"
with:
python-version: "3.12"
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- name: "Install tox"
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
**/fixity.db
*~
.coverage

# Tox files
.tox/

# Build output
build/
dist/
*.egg-info/
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
rev: v3.12.0
hooks:
- id: reorder-python-imports
args: [--py38-plus]
- repo: https://github.com/ambv/black
rev: "23.7.0"
- repo: https://github.com/psf/black
rev: "23.10.1"
hooks:
- id: black
args: [--safe, --quiet]
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include LICENSE
include README.md
include TRADEMARK
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.PHONY: clean package package-deps package-source package-upload package-wheel

package-deps:
pip install --upgrade twine wheel

package-source:
python setup.py sdist

package-wheel: package-deps
python setup.py bdist_wheel

package-check: package-source package-wheel ## Check the distribution is valid
twine check dist/*

package-upload: package-deps package-check
twine upload dist/* --repository-url https://upload.pypi.org/legacy/

package: package-upload

clean:
rm -rf metsrw.egg-info/
rm -rf build/
rm -rf dist/

pip-compile:
pip-compile --allow-unsafe --output-file=requirements.txt pyproject.toml
pip-compile --allow-unsafe --extra=dev --output-file=requirements-dev.txt pyproject.toml

pip-upgrade:
pip-compile --allow-unsafe --upgrade --output-file=requirements.txt pyproject.toml
pip-compile --allow-unsafe --upgrade --extra=dev --output-file=requirements-dev.txt pyproject.toml
5 changes: 5 additions & 0 deletions fixity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__version__ = "0.6.0"

__all__ = [
"__version__",
]
110 changes: 110 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[build-system]
requires = [
"setuptools>=68",
"wheel>=0.41",
]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = [""]
include = ["fixity*"]
namespaces = false

[project]
name = "fixity"
dynamic = [
"version",
"readme",
]
description = "Command line tool to check fixity for AIPs stored in the Archivematica Storage Service."
requires-python = ">=3.8"
license = {file = "LICENSE"}
dependencies = [
"requests",
"SQLAlchemy",
]
keywords = [
"archivematica",
"preservation",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
authors = [
{name = "Artefactual Systems Inc.", email = "[email protected]"}
]
maintainers = [
{name = "Artefactual Systems Inc.", email = "[email protected]"}
]

[project.urls]
homepage = "https://github.com/artefactual/fixity/"
repository = "https://github.com/artefactual/fixity/"
issues = "https://github.com/archivematica/Issues/issues"

[project.scripts]
fixity = "fixity.fixity:main"

[project.optional-dependencies]
dev = [
"coverage",
"pip-tools",
"pytest-cov",
"pytest",
"vcrpy",
]

[tool.setuptools.dynamic]
version = {attr = "fixity.__version__"}
readme = {file = ["README.md"], content-type = "text/markdown"}

[tool.pytest.ini_options]
python_files = [
"test_*.py",
]
testpaths = [
"tests",
]

[tool.coverage.run]
source = [
"fixity",
]
branch = true
omit = [
"tests/*",
]

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{38,39,310,311,312}, linting
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
[testenv]
skip_install = true
deps = -r {toxinidir}/requirements-dev.txt
commands = pytest {posargs}
[testenv:linting]
basepython = python3
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure
"""
81 changes: 80 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,83 @@
-r requirements.txt
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --allow-unsafe --extra=dev --output-file=requirements-dev.txt pyproject.toml
#
build==1.0.3
# via pip-tools
certifi==2023.7.22
# via requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via pip-tools
coverage[toml]==7.3.2
# via
# fixity (pyproject.toml)
# pytest-cov
exceptiongroup==1.1.3
# via pytest
greenlet==3.0.1
# via sqlalchemy
idna==3.4
# via
# requests
# yarl
importlib-metadata==6.8.0
# via build
iniconfig==2.0.0
# via pytest
multidict==6.0.4
# via yarl
packaging==23.2
# via
# build
# pytest
pip-tools==7.3.0
# via fixity (pyproject.toml)
pluggy==1.3.0
# via pytest
pyproject-hooks==1.0.0
# via build
pytest==7.4.3
# via
# fixity (pyproject.toml)
# pytest-cov
pytest-cov==4.1.0
# via fixity (pyproject.toml)
pyyaml==6.0.1
# via vcrpy
requests==2.31.0
# via fixity (pyproject.toml)
sqlalchemy==2.0.23
# via fixity (pyproject.toml)
tomli==2.0.1
# via
# build
# coverage
# pip-tools
# pyproject-hooks
# pytest
typing-extensions==4.8.0
# via sqlalchemy
urllib3==1.26.18
# via
# requests
# vcrpy
vcrpy==5.1.0
# via fixity (pyproject.toml)
wheel==0.41.3
# via pip-tools
wrapt==1.15.0
# via vcrpy
yarl==1.9.2
# via vcrpy
zipp==3.17.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
pip==23.3.1
# via pip-tools
setuptools==68.2.2
# via pip-tools
22 changes: 21 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --allow-unsafe --output-file=requirements.txt pyproject.toml
#
certifi==2023.7.22
# via requests
charset-normalizer==3.3.2
# via requests
greenlet==3.0.1
# via sqlalchemy
idna==3.4
# via requests
requests==2.31.0
SQLAlchemy==1.4.49
# via fixity (pyproject.toml)
sqlalchemy==2.0.23
# via fixity (pyproject.toml)
typing-extensions==4.8.0
# via sqlalchemy
urllib3==2.0.7
# via requests
21 changes: 0 additions & 21 deletions setup.py

This file was deleted.

0 comments on commit 0238a01

Please sign in to comment.