From 2c53915a6ce4fbd910fdf8a9156c560b6b79bd74 Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Mon, 13 Jan 2025 21:12:00 +0000 Subject: [PATCH 1/8] WIP: Migrating project metadata to pyproject.toml Using pytest to replace "setup.py test" (in progress) --- pyproject.toml | 66 ++++++++++++++++++++++++++++++++++++++++ requirements-dev.txt | 1 + setup.py | 71 +------------------------------------------- tox.ini | 5 +++- 4 files changed, 72 insertions(+), 71 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5c50678..11b6198 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,73 @@ +[project] +name = "prov" +version = "2.0.1" +description = "A library for W3C Provenance Data Model supporting PROV-JSON, PROV-XML and PROV-O (RDF)" +readme = "README.rst" +authors = [ + { name = "Trung Dong Huynh", email = "trungdong@donggiang.com" } +] +keywords = ["provenance", "graph", "model", "PROV", "PROV-DM", "PROV-JSON", "W3C", "PROV-XML", "PROV-N", "PROV-O", "RDF"] +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "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", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Security", + "Topic :: System :: Logging", +] +requires-python = ">=3.8" +dependencies = [ + "networkx>=2.0", + # Supporting graphic outputs (e.g. PNG, SVG, PDF) - a local graphviz is required + "pydot>=1.2.0", + "python-dateutil>=2.2", # TODO: is this really needed? +] + +[project.optional-dependencies] +rdf = [ + "rdflib>=4.2.1,<7", +] +xml = [ + "lxml>=3.3.5", +] + +[project.urls] +Homepage = "https://github.com/trungdong/prov" +Documentation = "https://prov.readthedocs.io" +Repository = "https://github.com/trungdong/prov" +Issues = "https://github.com/trungdong/prov/issues" +Changelog = "https://prov.readthedocs.io/en/latest/history.html" + [build-system] requires = ["setuptools>=40.8.0", "wheel"] # PEP 508 specifications. build-backend = "setuptools.build_meta" +[dependency-groups] +dev = [ + "black>=24.10.0", + "bumpversion>=0.6.0", + "coverage>=7.6.10", + "flake8>=7.1.1", + "pytest>=8.3.4", + "setuptools>=75.8.0", + "sphinx>=8.1.3", + "tox>=4.23.2", + "wheel>=0.45.1", +] + [tool.black] line-length = 88 target-version = ['py36'] diff --git a/requirements-dev.txt b/requirements-dev.txt index 6cc6ae4..0c39c7e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -5,4 +5,5 @@ black flake8 sphinx tox +setuptools wheel diff --git a/setup.py b/setup.py index 5d70e65..c94d050 100755 --- a/setup.py +++ b/setup.py @@ -1,74 +1,5 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from setuptools import setup, find_packages -import pathlib - -here = pathlib.Path(__file__).parent.resolve() - -long_description = (here / "README.rst").read_text(encoding="utf-8") - -requirements = ["python-dateutil>=2.2", "networkx>=2.0", "lxml>=3.3.5", "rdflib>=4.2.1,<7"] - -test_requirements = ["pydot>=1.2.0"] +from setuptools import setup setup( - name="prov", - version="2.0.1", - description="A library for W3C Provenance Data Model supporting PROV-JSON, " - "PROV-XML and PROV-O (RDF)", - long_description=long_description, - author="Trung Dong Huynh", - author_email="trungdong@donggiang.com", - url="https://github.com/trungdong/prov", - project_urls={ - "Bug Reports": "https://github.com/trungdong/prov/issues", - "Source": "https://github.com/trungdong/prov", - }, - packages=find_packages(where="src"), - package_dir={"": "src"}, - python_requires=">=3.6, <4", scripts=["scripts/prov-convert", "scripts/prov-compare"], - include_package_data=True, - install_requires=requirements, - extras_require={ - "dot": ["pydot>=1.2.0"], - }, - license="MIT", - zip_safe=False, - keywords=[ - "provenance", - "graph", - "model", - "PROV", - "PROV-DM", - "PROV-JSON", - "W3C", - "PROV-XML", - "PROV-N", - "PROV-O", - "RDF", - ], - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: Information Technology", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Operating System :: OS Independent", - "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", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Scientific/Engineering :: Information Analysis", - "Topic :: Security", - "Topic :: System :: Logging", - ], - test_suite="prov.tests", - tests_require=test_requirements, ) diff --git a/tox.ini b/tox.ini index c29c2c1..72a5133 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,10 @@ setenv = commands = check-manifest --ignore 'tox.ini,.coveragerc,.editorconfig,tests/**,cla/**,requirements*.txt,Makefile,.readthedocs.yml' python setup.py check -m -r -s - python setup.py test + pytest deps = check-manifest >= 0.42 readme_renderer + pytest + rdflib>=4.2.1,<7 + lxml>=3.3.5 From 65115f8b019d33533f3baba291e24ebb93ac953b Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Mon, 13 Jan 2025 21:36:44 +0000 Subject: [PATCH 2/8] Moved settings out of setup.cfg --- .bumpversion.cfg | 7 +++++++ setup.cfg | 13 ------------- 2 files changed, 7 insertions(+), 13 deletions(-) create mode 100644 .bumpversion.cfg diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..6dd5041 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,7 @@ +[bumpversion] +current_version = 2.0.1 +commit = True +tag = True +tag_name = {new_version} + +[bumpversion:file:src/prov/__init__.py] diff --git a/setup.cfg b/setup.cfg index 4a8ebf6..e4e5eb3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,16 +1,3 @@ -[bumpversion] -current_version = 2.0.1 -commit = True -tag = True -tag_name = {new_version} - -[bumpversion:file:setup.py] - -[bumpversion:file:src/prov/__init__.py] - -[metadata] -description-file = README.rst - [flake8] max-line-length = 88 extend-ignore = E203, W503 From 561da7c65b184d11bb8b8a75c8ef2afd2e5e6887 Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Mon, 13 Jan 2025 21:41:48 +0000 Subject: [PATCH 3/8] Removed support for EOL Python 3.8 --- .github/workflows/CI.yml | 2 +- HISTORY.rst | 8 ++++++-- pyproject.toml | 3 +-- tox.ini | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ca8dfef..61c0676 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/HISTORY.rst b/HISTORY.rst index 6129e30..8156583 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,12 +3,16 @@ History ------- +New changes +^^^^^^^^^^^ +* Removed support for EOL Python 3.8 + 2.0.1 (2024-06-10) ^^^^^^^^^^^^^^^^^^ * Removed support for EOL Python 3.6 and 3.7 * Minor documentation update (#153) -* Stopped using deepcopy when duplicating Namespace (#158 -* Restricting rdflib package version to "<7" (#156 +* Stopped using deepcopy when duplicating Namespace (#158) +* Restricting rdflib package version to "<7" (#156) * Raise an exception when an empty URI is registered as a namespace (#142) * Ensure rdflib 6+ returns bytes when serializing tests (fixed #151) * Removed fancy label output for bundle diff --git a/pyproject.toml b/pyproject.toml index 11b6198..542b622 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,6 @@ classifiers = [ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -28,7 +27,7 @@ classifiers = [ "Topic :: Security", "Topic :: System :: Logging", ] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ "networkx>=2.0", # Supporting graphic outputs (e.g. PNG, SVG, PDF) - a local graphviz is required diff --git a/tox.ini b/tox.ini index 72a5133..8590b87 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = python3.8, python3.9, python3.10, python3.11, python3.12, pypy3 +envlist = python3.9, python3.10, python3.11, python3.12, pypy3 # Define the minimal tox version required to run; # if the host tox is less than this the tool with create an environment and @@ -16,7 +16,7 @@ isolated_build = true setenv = PYTHONPATH = {toxinidir}:{toxinidir}/src/prov commands = - check-manifest --ignore 'tox.ini,.coveragerc,.editorconfig,tests/**,cla/**,requirements*.txt,Makefile,.readthedocs.yml' + check-manifest --ignore 'tox.ini,.bumpversion.cfg,.coveragerc,.editorconfig,tests/**,cla/**,requirements*.txt,Makefile,.readthedocs.yml' python setup.py check -m -r -s pytest deps = From 96a17f1d83e42639d0e3f832d6f247f36e9f21d8 Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Mon, 13 Jan 2025 22:13:45 +0000 Subject: [PATCH 4/8] Replaced the deprecated `pkgutil.find_loader` --- src/prov/tests/test_dot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prov/tests/test_dot.py b/src/prov/tests/test_dot.py index 63daeed..981ac8b 100644 --- a/src/prov/tests/test_dot.py +++ b/src/prov/tests/test_dot.py @@ -6,9 +6,9 @@ import unittest # Skipping SVG tests if pydot is not installed -from pkgutil import find_loader +from importlib.util import find_spec -if find_loader("pydot") is not None: +if find_spec("pydot") is not None: from prov.dot import prov_to_dot from prov.tests.test_model import AllTestsBase From 6ee5888b0f00a1301a9b7376d61dc03fcb0dbe68 Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Tue, 14 Jan 2025 10:36:12 +0000 Subject: [PATCH 5/8] Single-sourcing the project version from `prov.__version__` --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 542b622..7b16705 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "prov" -version = "2.0.1" +dynamic = ["version"] description = "A library for W3C Provenance Data Model supporting PROV-JSON, PROV-XML and PROV-O (RDF)" readme = "README.rst" authors = [ @@ -54,6 +54,9 @@ Changelog = "https://prov.readthedocs.io/en/latest/history.html" requires = ["setuptools>=40.8.0", "wheel"] # PEP 508 specifications. build-backend = "setuptools.build_meta" +[tool.setuptools.dynamic] +version = {attr = "prov.__version__"} + [dependency-groups] dev = [ "black>=24.10.0", From 8ccca3b72a6f520fa2104f269502b5e302f3113d Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Tue, 14 Jan 2025 10:55:56 +0000 Subject: [PATCH 6/8] Removed requirements.txt and requirements-dev.txt, which are no longer required --- .readthedocs.yml | 4 +++- CONTRIBUTING.rst | 10 +++++----- requirements-dev.txt | 9 --------- requirements.txt | 5 ----- tox.ini | 2 +- 5 files changed, 9 insertions(+), 21 deletions(-) delete mode 100644 requirements-dev.txt delete mode 100644 requirements.txt diff --git a/.readthedocs.yml b/.readthedocs.yml index 913671a..9904e7d 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,4 +8,6 @@ formats: all python: version: 3 install: - - requirements: requirements.txt \ No newline at end of file + - extra_requirements: + - xml + - rdf diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b04ca02..369a226 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -68,6 +68,8 @@ Ready to contribute? Here's how to set up `prov` for local development. $ cd prov/ $ pip install -r requirements-dev.txt +(NOTE: To be updated. The above step is no longer correct.) + 4. Create a branch for local development:: $ git checkout -b name-of-your-bugfix-or-feature @@ -97,8 +99,6 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python 3.6+ and for PyPy3. - Check https://travis-ci.org/trungdong/prov/pull_requests - and make sure that the tests pass for all supported Python versions. - (See `pyenv `_ for help on setting up - multiple versions of Python locally for testing.) +3. The pull request should work for Python 3.9+ and for PyPy3. + Look for the automated checks at the bottom of your pull request and make sure that + the tests pass for all supported Python versions. diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 0c39c7e..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,9 +0,0 @@ --r requirements.txt -bumpversion -coverage -black -flake8 -sphinx -tox -setuptools -wheel diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4932666..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -lxml>=3.3.5 -networkx>=2.0 -python-dateutil>=2.2 -pydot>=1.2.0 -rdflib>=4.2.1,<7 diff --git a/tox.ini b/tox.ini index 8590b87..8fa42a8 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ isolated_build = true setenv = PYTHONPATH = {toxinidir}:{toxinidir}/src/prov commands = - check-manifest --ignore 'tox.ini,.bumpversion.cfg,.coveragerc,.editorconfig,tests/**,cla/**,requirements*.txt,Makefile,.readthedocs.yml' + check-manifest --ignore 'tox.ini,.bumpversion.cfg,.coveragerc,.editorconfig,tests/**,cla/**,Makefile,.readthedocs.yml' python setup.py check -m -r -s pytest deps = From 8edf2c1416ffa48befb4ab9fad733d14aebf0363 Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Tue, 14 Jan 2025 11:54:15 +0000 Subject: [PATCH 7/8] Reinstated testing with unittest due to pytest's incompatible test discovery --- pyproject.toml | 3 +-- tox.ini | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7b16705..aae356d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,6 @@ dev = [ "bumpversion>=0.6.0", "coverage>=7.6.10", "flake8>=7.1.1", - "pytest>=8.3.4", "setuptools>=75.8.0", "sphinx>=8.1.3", "tox>=4.23.2", @@ -72,7 +71,7 @@ dev = [ [tool.black] line-length = 88 -target-version = ['py36'] +target-version = ["py39", "py310", "py311", "py312"] include = '\.pyi?$' exclude = ''' ( diff --git a/tox.ini b/tox.ini index 8fa42a8..c8ea4a7 100644 --- a/tox.ini +++ b/tox.ini @@ -18,10 +18,9 @@ setenv = commands = check-manifest --ignore 'tox.ini,.bumpversion.cfg,.coveragerc,.editorconfig,tests/**,cla/**,Makefile,.readthedocs.yml' python setup.py check -m -r -s - pytest + python -m unittest discover -s src/ deps = check-manifest >= 0.42 readme_renderer - pytest rdflib>=4.2.1,<7 lxml>=3.3.5 From ddcebf5f84f222b9dc12c755ace53c05d168b266 Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Tue, 14 Jan 2025 12:26:47 +0000 Subject: [PATCH 8/8] Added the build option to .readthedocs.yml --- .readthedocs.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 913671a..998928c 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,11 +1,15 @@ version: 2 +build: + os: ubuntu-22.04 + tools: + python: "3.12" + sphinx: configuration: docs/conf.py formats: all python: - version: 3 install: - - requirements: requirements.txt \ No newline at end of file + - requirements: requirements.txt