diff --git a/codecov.yml b/.codecov.yml similarity index 100% rename from codecov.yml rename to .codecov.yml diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index c4d0a91..0000000 --- a/.coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[run] -branch = True -source = fixity diff --git a/tox.ini b/.flake8 similarity index 50% rename from tox.ini rename to .flake8 index b370cc0..28052a5 100644 --- a/tox.ini +++ b/.flake8 @@ -1,26 +1,3 @@ -[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: @@ -28,7 +5,7 @@ exclude = .tox, .git, __pycache__, .cache, build, dist, *.pyc, *.egg-info, .eggs # - 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dfc1780..78fd697 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/.gitignore b/.gitignore index f156243..f1c259e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,11 @@ **/fixity.db *~ .coverage + +# Tox files +.tox/ + +# Build output +build/ +dist/ +*.egg-info/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1bfd3ea..07bab0c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..53e32c5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include LICENSE +include README.md +include TRADEMARK diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b44c884 --- /dev/null +++ b/Makefile @@ -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 diff --git a/fixity/__init__.py b/fixity/__init__.py index e69de29..285927e 100644 --- a/fixity/__init__.py +++ b/fixity/__init__.py @@ -0,0 +1,5 @@ +__version__ = "0.6.0" + +__all__ = [ + "__version__", +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6eac28d --- /dev/null +++ b/pyproject.toml @@ -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 = "info@artefactual.com"} +] +maintainers = [ + {name = "Artefactual Systems Inc.", email = "info@artefactual.com"} +] + +[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 +""" diff --git a/requirements-dev.txt b/requirements-dev.txt index cf1fde8..711ccfc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -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 diff --git a/requirements.txt b/requirements.txt index e8218b6..ccb9231 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.py b/setup.py deleted file mode 100644 index d4f904e..0000000 --- a/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -from setuptools import setup - -setup( - name="fixity", - version="0.6.0", - packages=["fixity"], - url="https://github.com/artefactual/fixity", - author="Artefactual Systems", - author_email="info@artefactual.com", - entry_points={"console_scripts": ["fixity = fixity.fixity:main"]}, - classifiers=[ - "License :: OSI Approved :: GNU Affero General Public License v3", - "Programming Language :: Python :: 3", - "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", - ], - python_requires=">=3.8", -)