summaryrefslogtreecommitdiff
path: root/pyproject.toml
diff options
context:
space:
mode:
authorJeffrey C. Lerman <Jeffrey.Lerman@gmail.com>2023-01-17 13:33:44 -0800
committerGitHub <noreply@github.com>2023-01-17 22:33:44 +0100
commitbfcc54bbb98a1298d5ca55f781e315cd785b225a (patch)
tree424bd5ec39aa26263c9016224a4cac4a83eb14de /pyproject.toml
parent9b778b39a7759a9c94d5437e1d5f02196bdc9c51 (diff)
downloadrdflib-bfcc54bbb98a1298d5ca55f781e315cd785b225a.tar.gz
build: move to poetry for dependency management; consolidate more settings into pyproject.toml (#2187)
Replaced setuptools with poetry which provides simpler dependency management, dependency locking and virtual environment management. This makes it easier for new developers to get a sane development environment (i.e. just `poetry install`) and also makes our CI pipeline more reproducable as now most development tools and libraries will only change through dependabot which will reduce the build failures on main and make breaking changes in dependencies more visible with dependabot PRs. Other changes: - moved isort, mypy and coverage config from setup.cfg to pyproject.toml - Changes in the generated rdflib wheel: - removed wheel extras related to development (i.e. `tests`, `docs`, `dev`) as poetry dependency groups should be used instead. - Added an extra group `lxml` with a dependency on lxml. - Added version ranges to dependencies, and tests to ensure these version ranges are valid. - Changes to tests: - Change pyparsing related tests so they work with older pyparsing. - Made the html5lib related tests conditional on html5lib existing. - Runtime changes: - Use importlib.metadata to set `__version__`. - Changed the devcontainer and related config to avoid contamination and interference with the host environment. Co-authored-by: Iwan Aucamp <aucampia@gmail.com> Co-authored-by: Edmond Chuc <edmond.chuc@outlook.com>
Diffstat (limited to 'pyproject.toml')
-rw-r--r--pyproject.toml145
1 files changed, 145 insertions, 0 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 48cd08db..88ade542 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,80 @@
+[tool.poetry]
+name = "rdflib"
+version = "6.3.0a0"
+description = """RDFLib is a Python library for working with RDF, \
+a simple yet powerful language for representing information."""
+authors = ["Daniel 'eikeon' Krech <eikeon@eikeon.com>"]
+maintainers = ["RDFLib Team <rdflib-dev@googlegroups.com>"]
+repository = "https://github.com/RDFLib/rdflib"
+documentation = "https://rdflib.readthedocs.org/"
+license = "BSD-3-Clause"
+classifiers=[
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "License :: OSI Approved :: BSD License",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ "Operating System :: OS Independent",
+ "Natural Language :: English"
+]
+readme = "README.md"
+
+[tool.poetry.scripts]
+rdfpipe = 'rdflib.tools.rdfpipe:main'
+csv2rdf = 'rdflib.tools.csv2rdf:main'
+rdf2dot = 'rdflib.tools.rdf2dot:main'
+rdfs2dot = 'rdflib.tools.rdfs2dot:main'
+rdfgraphisomorphism = 'rdflib.tools.graphisomorphism:main'
+
+[tool.poetry.dependencies]
+python = "^3.7"
+isodate = "^0.6.0"
+pyparsing = ">=2.1.0,<4"
+importlib-metadata = {version = "^4.0.0", python = ">=3.7,<3.8"}
+berkeleydb = {version = "^18.1.0", optional = true}
+networkx = {version = "^2.0.0", optional = true}
+html5lib = {version = "^1.0", optional = true}
+lxml = {version = "^4.3.0", optional = true}
+
+[tool.poetry.group.dev.dependencies]
+black = "22.12.0"
+isort = "^5.10.0"
+mypy = "0.991"
+lxml-stubs = "^0.4.0"
+
+[tool.poetry.group.tests.dependencies]
+pytest = "^7.1.3"
+pytest-cov = "^4.0.0"
+coverage = {version = "^7.0.1", extras = ["toml"]}
+types-setuptools = "^65.6.0.3"
+setuptools = "^65.6.3"
+
+[tool.poetry.group.docs.dependencies]
+sphinx = ">4.0.0"
+myst-parser = "^0.18.0"
+sphinxcontrib-apidoc = "^0.3.0"
+sphinxcontrib-kroki = "^1.3.0"
+sphinx-autodoc-typehints = "^1.17.1"
+
+[tool.poetry.group.flake8.dependencies]
+flake8 = ">=4.0.1" # flakeheaven is incompatible with flake8 >=5.0 (https://github.com/flakeheaven/flakeheaven/issues/132)
+flakeheaven = "^3.2.1"
+pep8-naming = "^0.13.2"
+
+[tool.poetry.extras]
+berkeleydb = ["berkeleydb"]
+networkx = ["networkx"]
+html = ["html5lib"]
+lxml = ["lxml"]
+
+[build-system]
+requires = ["poetry-core>=1.4.0"]
+build-backend = "poetry.core.masonry.api"
+
[tool.flakeheaven]
format = "grouped"
baseline = ".flakeheaven.baseline"
@@ -45,6 +122,7 @@ exclude = '''
| \.pytest_cache
| \.tox
| \.venv
+ | \.var
| \.github
| _build
| htmlcov
@@ -82,3 +160,70 @@ log_format = "%(asctime)s.%(msecs)03d %(levelname)-8s %(name)-12s %(filename)s:%
log_date_format = "%Y-%m-%dT%H:%M:%S"
log_cli_format = "%(asctime)s.%(msecs)03d %(levelname)-8s %(name)-12s %(filename)s:%(lineno)s:%(funcName)s %(message)s"
log_cli_date_format = "%Y-%m-%dT%H:%M:%S"
+
+[tool.isort]
+profile = "black"
+py_version = 37
+line_length = 88
+src_paths= ["rdflib", "test"]
+supported_extensions = ["pyw", "pyi", "py"]
+skip = [
+ '.eggs', # exclude a few common directories in the
+ '.git', # root of the project
+ '.hg',
+ '.mypy_cache',
+ '.pytest_cache',
+ '.tox',
+ '.venv',
+ '.var',
+ '.github',
+ '_build',
+ 'htmlcov',
+ 'benchmarks',
+ 'examples', # No need to isort examples
+ 'test_reports',
+ 'rdflib.egg-info',
+ 'buck-out',
+ 'build',
+ 'dist',
+ 'venv',
+]
+
+[tool.mypy]
+files = ['rdflib', 'test', 'devtools']
+python_version = "3.7"
+warn_unused_configs = true
+ignore_missing_imports = true
+disallow_subclassing_any = false
+warn_unreachable = true
+warn_unused_ignores = true
+no_implicit_optional = false
+
+[[tool.mypy.overrides]]
+module = "pyparsing.*"
+# This is here because of an upstream issue with pyparsing:
+# https://github.com/pyparsing/pyparsing/issues/385
+# Once the issue is fixed this should be removed.
+follow_imports = "skip"
+
+[tool.coverage.run]
+branch = true
+source = ["rdflib"]
+omit = ["*/_type_checking.py"]
+
+[tool.coverage.report]
+exclude_lines = [
+ # Have to re-enable the standard pragma
+ "pragma: no cover",
+
+ # TYPE_CHECKING guarded code only affects type checkers.
+ "^ *if (False|TYPE_CHECKING):",
+ # constant used in protocols and abstract methods, does not run anything
+ # and has no side effects.
+ '^ +\.\.\.$',
+
+ # Don't complain if non-runnable code isn't run:
+ "if 0:",
+ "if __name__ == .__main__.:",
+ "if __name__==.__main__.:"
+]