From ac89efecb8dec13d925ee028f4e72953bb491632 Mon Sep 17 00:00:00 2001 From: Felix Soubelet <19598248+fsoubelet@users.noreply.github.com> Date: Tue, 13 Aug 2024 14:32:21 +0200 Subject: [PATCH] Migrate to pyproject.toml, update for numpy 2.0 (#39) * move to pyproject file * remove setup.py * not needed anymore * files included by default by Hatch since they are not ignored by VSC * ensure last empty line * switch to np.nan for numpy 2.0 compatibility * and bump patch version for release * and add to changelog * update authors metadata as discussed --- .github/workflows/coverage.yml | 2 +- .github/workflows/documentation.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/tests.yml | 1 - CHANGELOG.md | 4 + MANIFEST.in | 1 - pylhc_submitter/__init__.py | 2 +- .../sixdesk_tools/post_process_da.py | 2 +- pyproject.toml | 84 +++++++++++++++++++ setup.cfg | 3 - setup.py | 80 ------------------ 11 files changed, 93 insertions(+), 90 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 0cf7fcb..e185847 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,4 +13,4 @@ jobs: with: src-dir: pylhc_submitter pytest-options: -m "not cern_network" - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index ace3140..e1195b9 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -11,4 +11,4 @@ on: # Runs on any push event in a PR or any push event to master jobs: documentation: - uses: pylhc/.github/.github/workflows/documentation.yml@master \ No newline at end of file + uses: pylhc/.github/.github/workflows/documentation.yml@master diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bc21fe3..95fcfb7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,4 +8,4 @@ on: # Runs everytime a release is added to the repository jobs: deploy: uses: pylhc/.github/.github/workflows/publish.yml@master - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 084d017..2bf54b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,4 +15,3 @@ jobs: uses: pylhc/.github/.github/workflows/tests.yml@master with: pytest-options: -m "not cern_network" - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5634de0..59adc2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # `pylhc-submitter` Changelog +## Version 2.0.4 + +- Fixed use of `np.NaN` to ensure compatibility with `numpy 2.0`. + ## Version 2.0.3 - Fixing `job_submitter`: Do not transfer any output files, when the `output_destination` is given. diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 79cd94c..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include pylhc_submitter/sixdesk_tools/mask_* \ No newline at end of file diff --git a/pylhc_submitter/__init__.py b/pylhc_submitter/__init__.py index 50e35ee..e036bbc 100644 --- a/pylhc_submitter/__init__.py +++ b/pylhc_submitter/__init__.py @@ -10,7 +10,7 @@ __title__ = "pylhc_submitter" __description__ = "pylhc-submitter contains scripts to simplify the creation and submission of jobs to HTCondor at CERN" __url__ = "https://github.com/pylhc/submitter" -__version__ = "2.0.3" +__version__ = "2.0.4" __author__ = "pylhc" __author_email__ = "pylhc@github.com" __license__ = "MIT" diff --git a/pylhc_submitter/sixdesk_tools/post_process_da.py b/pylhc_submitter/sixdesk_tools/post_process_da.py index 0db74c2..0198bcb 100644 --- a/pylhc_submitter/sixdesk_tools/post_process_da.py +++ b/pylhc_submitter/sixdesk_tools/post_process_da.py @@ -261,7 +261,7 @@ def _plot_seeds(ax, df_da: TfsDataFrame, da_col: str, interpolated: bool) -> Tup seed_mask = df_da[SEED] == seed angles = np.deg2rad(df_da.loc[seed_mask, ANGLE]) da_data = df_da.loc[seed_mask, da_col] - da_data.loc[da_data == 0] = np.NaN + da_data.loc[da_data == 0] = np.nan if interpolated: seed_h, _, _ = _interpolated_line( ax, diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..618b689 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,84 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.version] +path = "pylhc_submitter/__init__.py" + +[tool.hatch.build.targets.sdist] +exclude = [ + "/.github", + "/doc", + "/tests", +] + +[tool.hatch.build.targets.wheel] +packages = ["pylhc_submitter"] + +[project] +name = "pylhc_submitter" +readme = "README.md" +description = "pylhc-submitter contains scripts to simplify the creation and submission of jobs to HTCondor at CERN" +authors = [ + {name = "OMC Team", email = "pylhc@github.com"}, # see zenodo file / commits for details +] +license = "MIT" +dynamic = ["version"] +requires-python = ">=3.9" + +classifiers = [ + "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 :: Software Development :: Libraries :: Python Modules", + "Typing :: Typed", +] + +dependencies = [ + "numpy >= 1.24", + "scipy >= 1.10", + "pandas >= 2.1", + "tfs-pandas >= 3.8", + "matplotlib >= 3.8", + "htcondor >= 8.9.2 ; sys_platform=='linux'", # no bindings for macOS or windows on PyPI + "generic-parser >= 1.1", +] + +[project.optional-dependencies] +test = [ + "pytest>=7.0", + "pytest-cov>=2.9", + "pytest-mpl>=0.15", +] +doc = [ + "sphinx >= 7.0", + "sphinx_rtd_theme >= 2.0", +] + +all = [ + "pylhc_submitter[test]", + "pylhc_submitter[doc]", +] + +[project.urls] +homepage = "https://github.com/pylhc/submitter" +repository = "https://github.com/pylhc/submitter" +documentation = "https://pylhc.github.io/submitter/" +changelog = "https://github.com/pylhc/submitter/blob/master/CHANGELOG.md" + +# ----- Testing ----- # + +[tool.pytest.ini_options] +markers = [ + "cern_network: tests that require access to afs or the technical network", +] +# Helpful for pytest-debugging (leave commented out on commit): +# log_cli=true +# log_level=DEBUG diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 594cefb..0000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[tool:pytest] -markers= - cern_network: tests that require access to afs or the technical network diff --git a/setup.py b/setup.py deleted file mode 100644 index c40d86b..0000000 --- a/setup.py +++ /dev/null @@ -1,80 +0,0 @@ -import pathlib - -import setuptools - -# The directory containing this file -MODULE_NAME = "pylhc_submitter" -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_PYLHC_SUBMITTER = about_package(ABOUT_FILE) - -with README.open("r") as docs: - long_description = docs.read() - -# Dependencies for the module itself -DEPENDENCIES = [ - "numpy>=1.19", - "pandas>=1.0", - "htcondor>=8.9.2 ; sys_platform=='linux'", # no bindings for macOS or windows on PyPI - "tfs-pandas>=3.0", - "generic-parser>=1.0.8", - "scipy>=1.4.0", - "matplotlib>=3.2.0", -] - -EXTRA_DEPENDENCIES = { - "test": [ - "pytest>=5.2", - "pytest-cov>=2.7", - ], - "doc": ["sphinx", "sphinx_rtd_theme"], -} -EXTRA_DEPENDENCIES.update( - {"all": [elem for list_ in EXTRA_DEPENDENCIES.values() for elem in list_]} -) - - -setuptools.setup( - name=ABOUT_PYLHC_SUBMITTER["__title__"], - version=ABOUT_PYLHC_SUBMITTER["__version__"], - description=ABOUT_PYLHC_SUBMITTER["__description__"], - long_description=long_description, - long_description_content_type="text/markdown", - author=ABOUT_PYLHC_SUBMITTER["__author__"], - author_email=ABOUT_PYLHC_SUBMITTER["__author_email__"], - url=ABOUT_PYLHC_SUBMITTER["__url__"], - python_requires=">=3.7", - license=ABOUT_PYLHC_SUBMITTER["__license__"], - classifiers=[ - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Programming Language :: Python", - "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", - ], - packages=setuptools.find_packages(exclude=["tests*", "doc"]), - include_package_data=True, - install_requires=DEPENDENCIES, - tests_require=EXTRA_DEPENDENCIES["test"], - extras_require=EXTRA_DEPENDENCIES, -)