From 185588eeadb17e5f3cbc971ae7a6509e41e5b2a6 Mon Sep 17 00:00:00 2001 From: sbonner0 Date: Tue, 30 Apr 2024 11:09:40 +0100 Subject: [PATCH] Update the packaging to use pyproject.toml --- .flake8 | 13 +++ pyproject.toml | 79 +++++++++++++++++++ setup.cfg | 35 -------- setup.py | 13 --- .../kg_topology_toolbox}/__init__.py | 0 .../kg_topology_toolbox}/topology_toolbox.py | 0 .../kg_topology_toolbox}/utils.py | 0 7 files changed, 92 insertions(+), 48 deletions(-) create mode 100644 .flake8 create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py rename {kg_topology_toolbox => src/kg_topology_toolbox}/__init__.py (100%) rename {kg_topology_toolbox => src/kg_topology_toolbox}/topology_toolbox.py (100%) rename {kg_topology_toolbox => src/kg_topology_toolbox}/utils.py (100%) diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..b7d7cb4 --- /dev/null +++ b/.flake8 @@ -0,0 +1,13 @@ +######################### +# Flake8 Configuration # +# (.flake8) # +######################### +[flake8] +ignore = + # line too long + E501 + # line break before binary operator + W503 + # whitespace before ':' + E203 +max-line-length = 90 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cf0bbe7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,79 @@ +[build-system] +requires = ["setuptools>=61.0.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "kg-topology-toolbox" +version = "0.1.0" +authors = [ + {name = "Alberto Cattaneo"}, + {name = "Daniel Justus"}, + {name = "Thomas Martynec"}, + {name = "Stephen Bonner"}, +] +description = "A Python toolbox for Knowledge Graph topology metrics." +readme = "README.md" +license = {text = "MIT License"} +requires-python = ">=3.8" +dependencies = [ + 'numpy >= 1.24.4', + 'pandas >= 2.0.3', + 'scipy >= 1.10.1', +] + +[project.optional-dependencies] +dev = [ + 'black', + 'flake8', + 'isort', + 'mypy', + 'pandas-stubs >= 2.0.3.230814', + 'pytest >= 8.1.1', + 'pytest-cov', + 'sphinx >= 7.1.2', + 'sphinx_rtd_theme', + 'sphinx_autodoc_typehints', + 'sphinx-automodapi', + 'myst-parser', +] + +[project.urls] +repository = "https://github.com/graphcore-research/kg-topology-toolbox" + +[tool.setuptools.packages.find] +where = ["src"] +exclude = ["tests"] +namespaces = true + +[tool.black] +target-version = ["py38", "py39", "py310", "py311"] + +[tool.isort] +profile = "black" + +[tool.mypy] +pretty = true +show_error_codes = true +strict = true +check_untyped_defs = true +plugins = ["numpy.typing.mypy_plugin"] + +[[tool.mypy.overrides]] +module = "scipy.*" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "setuptools.*" +ignore_missing_imports = true + +[tool.pytest] +addopts = ["--no-cov-on-fail"] + +[tool.coverage.report] +skip_covered = true +show_missing = true +exclude_lines = [ + "pragma: no cover", + "raise NotImplementedError", + "assert False", +] \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index cc7a78f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,35 +0,0 @@ -[options] -packages = kg_topology_toolbox - -[mypy] -pretty = true -show_error_codes = true -strict = true -check_untyped_defs = true -plugins = numpy.typing.mypy_plugin - -[mypy-scipy.*] -ignore_missing_imports = True - -[mypy-setuptools.*] -ignore_missing_imports = True - -[flake8] -# See https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html -max-line-length = 90 -extend-ignore = E203,E501,W503 - -[isort] -profile = black - -[tool:pytest] -addopts = --no-cov-on-fail - -[coverage:report] -skip_covered = true -show_missing = true -exclude_lines = - pragma: no cover - raise NotImplementedError - assert False - \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 57b8521..0000000 --- a/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2023 Graphcore Ltd. All rights reserved. - -from pathlib import Path - -import setuptools - -setuptools.setup( - name="kg-topology-toolbox", - description="A Python toolbox for Knowledge Graph topology metrics.", - version="0.1", - python_requires=">=3.8", - install_requires=Path("requirements.txt").read_text().rstrip("\n").split("\n"), -) diff --git a/kg_topology_toolbox/__init__.py b/src/kg_topology_toolbox/__init__.py similarity index 100% rename from kg_topology_toolbox/__init__.py rename to src/kg_topology_toolbox/__init__.py diff --git a/kg_topology_toolbox/topology_toolbox.py b/src/kg_topology_toolbox/topology_toolbox.py similarity index 100% rename from kg_topology_toolbox/topology_toolbox.py rename to src/kg_topology_toolbox/topology_toolbox.py diff --git a/kg_topology_toolbox/utils.py b/src/kg_topology_toolbox/utils.py similarity index 100% rename from kg_topology_toolbox/utils.py rename to src/kg_topology_toolbox/utils.py