From e2844e5baba42530e437d29c6541b5e7d7010bfe Mon Sep 17 00:00:00 2001 From: Thomas Sundvoll Date: Mon, 3 Jun 2024 11:02:27 +0200 Subject: [PATCH] Migrate setup.py to pyproject.toml --- pyproject.toml | 77 ++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 32 ------------------ setup.py | 70 ---------------------------------------- src/isar/__init__.py | 7 ++-- 4 files changed, 79 insertions(+), 107 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 889be8c5..972f1173 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,4 +2,81 @@ requires = ["setuptools>=64.0", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" +[project] +name = "isar" +authors = [{ name = "Equinor ASA", email = "fg_robots_dev@equinor.com" }] +description = "Integration and Supervisory control of Autonomous Robots" +readme = "README.md" +requires-python = ">=3.11" +license = { file = "LICENSE" } +classifiers = [ + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Software Development :: Libraries", +] +dependencies = [ + "alitra>=1.1.3", + "azure-identity", + "azure-keyvault-secrets", + "azure-storage-blob", + "backoff", + "click", + "dacite", + "fastapi-azure-auth", + "fastapi", + "injector", + "numpy", + "opencensus-ext-azure", + "opencensus-ext-logging", + "opencensus-ext-requests", + "paho-mqtt", + "pydantic_settings", + "pydantic", + "PyJWT", + "python-dotenv", + "PyYAML", + "requests-toolbelt", + "requests", + "transitions", + "uvicorn", +] +dynamic = ["version"] + +[project.urls] +repository = "https://github.com/equinor/isar.git" + +[project.optional-dependencies] +dev = [ + "black", + "flake8", + "mypy", + "myst-parser", + "pre-commit", + "pytest-dotenv", + "pytest-mock", + "pytest-xdist", + "pytest", + "requests-mock", + "sphinx", +] + [tool.setuptools_scm] +# This section is empty but required for dynamic versioning. + +[tool.mypy] +no_strict_optional = true +no_site_packages = true +ignore_missing_imports = true +exclude = ["build"] +files = ["src", "tests"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +log_cli = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 378cfcd5..00000000 --- a/setup.cfg +++ /dev/null @@ -1,32 +0,0 @@ -[tool:isort] -line_length = 88 -multi_line_output = 3 -include_trailing_comma = True -force_grid_wrap = 0 -use_parentheses = True - -[mypy] -follow_imports = normal -no_strict_optional = True -no_site_packages = True -ignore_missing_imports = True -ignore_missing_imports_per_module = True - -[flake8] -filename = - ./src/*, - ./tests/*, -exclude = .git, __pycache__, *.egg-info, *.json, *.conf, *.env, -per-file-ignores = - __init__.py: F401, -ignore = - W503 -max-line-length = 88 - -[tool:pytest] -python_files = test_*.py -python_classes = Test -python_functions = test* test_* -testpaths = tests -log_cli = true -norecursedirs = integration diff --git a/setup.py b/setup.py deleted file mode 100644 index abd5384d..00000000 --- a/setup.py +++ /dev/null @@ -1,70 +0,0 @@ -from setuptools import find_packages, setup - -setup( - name="isar", - description="Integration and Supervisory control of Autonomous Robots", - long_description=open("README.md").read(), - long_description_content_type="text/markdown", - author="Equinor ASA", - author_email="fg_robots_dev@equinor.com", - url="https://github.com/equinor/isar", - packages=find_packages(where="src"), - package_dir={"": "src"}, - package_data={ - "isar": [ - "config/logging.conf", - ] - }, - classifiers=[ - "Environment :: Other Environment", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "Programming Language :: Python", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Physics", - "Topic :: Software Development :: Libraries", - ], - include_package_data=True, - install_requires=[ - "alitra>=1.1.3", - "azure-identity", - "azure-keyvault-secrets", - "azure-storage-blob", - "backoff", - "click", - "dacite", - "fastapi-azure-auth", - "fastapi", - "injector", - "opencensus-ext-logging", - "opencensus-ext-requests", - "opencensus-ext-azure", - "numpy", - "paho-mqtt", - "pydantic", - "pydantic_settings", - "PyJWT", - "python-dotenv", - "PyYAML", - "requests-toolbelt", - "requests", - "transitions", - "uvicorn", - ], - extras_require={ - "dev": [ - "black", - "flake8", - "mypy", - "myst-parser", - "pre-commit", - "pytest-dotenv", - "pytest-mock", - "pytest-xdist", - "pytest", - "requests-mock", - "sphinx", - ] - }, - python_requires=">=3.11", -) diff --git a/src/isar/__init__.py b/src/isar/__init__.py index b8d76573..22b39161 100644 --- a/src/isar/__init__.py +++ b/src/isar/__init__.py @@ -1,6 +1,3 @@ -from importlib.metadata import PackageNotFoundError, distribution +from importlib.metadata import version -try: - __version__ = distribution(__name__).version -except PackageNotFoundError: - pass # package is not installed +__version__ = version(__package__ or __name__)