diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 66cf544..e0afaa4 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -9,5 +9,3 @@ on: jobs: tests: uses: pylhc/.github/.github/workflows/cron.yml@master - with: - extra-dependencies: test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 74b02fd..5970e25 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,5 +13,3 @@ on: # Runs on any push event to any branch except master (the coverage workflow jobs: tests: uses: pylhc/.github/.github/workflows/tests.yml@master - with: - extra-dependencies: test \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8b0e213 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,72 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.version] +path = "sdds/__init__.py" + +[tool.hatch.build.targets.sdist] +exclude = [ + "/.github", + "/doc", + "/tests", +] + +[tool.hatch.build.targets.wheel] +packages = ["sdds"] + +[project] +name = "sdds" +readme = "README.md" +description = "SDDS file handling." +authors = [ + {name = "OMC Team", email = "pylhc@github.com"}, # see zenodo file / commits for details +] +license = "MIT" +dynamic = ["version"] +requires-python = ">=3.9" + +keywords = [ + "SDDS", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Scientific/Engineering", + "Topic :: Software Development :: Libraries :: Python Modules", + "Typing :: Typed", +] + +dependencies = [ + "numpy >= 1.24", +] + +[project.optional-dependencies] +test = [ + "pytest>=7.0", + "pytest-cov>=2.9", +] +doc = [ + "sphinx >= 7.0", + "sphinx_rtd_theme >= 2.0", +] + +all = [ + "sdds[test]", + "sdds[doc]", +] + +[project.urls] +homepage = "https://github.com/pylhc/sdds" +repository = "https://github.com/pylhc/sdds" +documentation = "https://pylhc.github.io/sdds/" +changelog = "https://github.com/pylhc/sdds/blob/master/CHANGELOG.md" diff --git a/setup.py b/setup.py deleted file mode 100644 index 16523bb..0000000 --- a/setup.py +++ /dev/null @@ -1,70 +0,0 @@ -import pathlib - -import setuptools - -MODULE_NAME = "sdds" -# The directory containing this file -TOPLEVEL_DIR = pathlib.Path(__file__).parent.absolute() -ABOUT_FILE = TOPLEVEL_DIR / MODULE_NAME / "__init__.py" -README = TOPLEVEL_DIR / "README.md" - - -def about_package(init_posixpath: pathlib.Path) -> dict: - """ - Return package information defined with dunders in __init__.py as a dictionary, when - provided with a PosixPath to the __init__.py file. - """ - about_text: str = init_posixpath.read_text() - return { - entry.split(" = ")[0]: entry.split(" = ")[1].strip('"') - for entry in about_text.strip().split("\n") - if entry.startswith("__") - } - - -ABOUT_SDDS = about_package(ABOUT_FILE) - -with README.open("r") as docs: - long_description = docs.read() - -# Dependencies for the package itself -DEPENDENCIES = [ - "numpy>=1.19.0", -] - -# Extra dependencies -EXTRA_DEPENDENCIES = { - "test": ["pytest>=5.2", "pytest-cov>=2.6", "attrs>=19.2.0"], - "doc": ["sphinx", "sphinx_rtd_theme"], -} -EXTRA_DEPENDENCIES.update({"all": [elem for list_ in EXTRA_DEPENDENCIES.values() for elem in list_]}) - - -setuptools.setup( - name=ABOUT_SDDS["__title__"], - version=ABOUT_SDDS["__version__"], - description=ABOUT_SDDS["__description__"], - long_description=long_description, - long_description_content_type="text/markdown", - author=ABOUT_SDDS["__author__"], - author_email=ABOUT_SDDS["__author_email__"], - url=ABOUT_SDDS["__url__"], - license="MIT", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "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", - "Topic :: Scientific/Engineering", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - packages=setuptools.find_packages(include=(MODULE_NAME,)), - install_requires=DEPENDENCIES, - tests_require=EXTRA_DEPENDENCIES["test"], - extras_require=EXTRA_DEPENDENCIES, -)