From eba256f974c0e1334bbd2fefff24232538a3fea4 Mon Sep 17 00:00:00 2001 From: Saransh Date: Tue, 5 Jul 2022 18:18:49 +0530 Subject: [PATCH 1/8] chore: migrate to hatchling --- noxfile.py | 12 ---- pyproject.toml | 169 ++++++++++++++++++++++++++++++++++++++++++++----- setup.cfg | 64 ------------------- setup.py | 41 ------------ 4 files changed, 154 insertions(+), 132 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/noxfile.py b/noxfile.py index c1540350..6b37d768 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,4 +1,3 @@ -import shutil from pathlib import Path import nox @@ -45,14 +44,3 @@ def docs(session): session.run("python", "-m", "http.server", "8001", "-d", "_build/html") else: print("Unsupported argument to docs") - - -@nox.session -def build(session): - """Build an SDist and wheel.""" - build_p = DIR.joinpath("build") - if build_p.exists(): - shutil.rmtree(build_p) - - session.install("build") - session.run("python", "-m", "build") diff --git a/pyproject.toml b/pyproject.toml index 15a5d72a..27db536b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,124 @@ [build-system] requires = [ - "setuptools>=42.0", - "setuptools_scm[toml]>=3.4" + "hatchling>=1.4.1", +] +build-backend = "hatchling.build" + +[project] +name = "vector" +description = "Vector classes and utilities" +readme = { file = "README.md", content-type = "text/markdown" } +maintainers = [ {name = "The Scikit-HEP admins", email = "scikit-hep-admins@googlegroups.com"} ] +license = "BSD-3-Clause" +requires-python = ">=3.6" +keywords = [ + "vector", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Scientific/Engineering :: Physics", + "Typing :: Typed", +] +dependencies = [ + "importlib-metadata>=0.22;python_version<\"3.8\"", + "numpy>=1.13.3", + "packaging>=19.0", + "typing-extensions;python_version<\"3.8\"", +] +dynamic = [ + "version", +] + +[[project.authors]] +name = "Jim Pivarski, Henry Schreiner, Eduardo Rodrigues" +email = "eduardo.rodrigues@cern.ch" + +[project.optional-dependencies] +all = [ + "awkward", + "awkward>=1.2.0", + "awkward>=1.2.0", + "ipykernel", + "myst-parser>0.13", + "nbsphinx", + "nbsphinx", + "numba>=0.50; python_version>=\"3.6\"", + "pytest-cov>=3.0.0", + "pytest-cov>=3.0.0", + "pytest>=6", + "pytest>=6", + "spark-parser", + "sphinx-math-dollar", + "Sphinx>=4.0", + "sphinx_book_theme>=0.0.42", + "sphinx_copybutton", + "uncompyle6", + "xdoctest>=1.0.0", + "xdoctest>=1.0.0", +] +awkward = [ + "awkward>=1.2.0", +] +dev = [ + "awkward>=1.2.0", + "numba>=0.50; python_version>=\"3.6\"", + "pytest-cov>=3.0.0", + "pytest>=6", + "xdoctest>=1.0.0", +] +docs = [ + "awkward", + "ipykernel", + "myst-parser>0.13", + "nbsphinx", + "nbsphinx", + "sphinx-math-dollar", + "Sphinx>=4.0", + "sphinx_book_theme>=0.0.42", + "sphinx_copybutton", +] +test = [ + "pytest-cov>=3.0.0", + "pytest>=6", + "xdoctest>=1.0.0", +] +test_extras = [ + "spark-parser", + "uncompyle6", +] + +[project.entry-points.numba_extensions] +init = "vector:register_numba" + +[project.urls] +"Bug Tracker" = "https://github.com/scikit-hep/vector/issues" +Changelog = "https://vector.readthedocs.io/en/latest/changelog.html" +Discussions = "https://github.com/scikit-hep/vector/discussions" +Documentation = "https://vector.readthedocs.io/" +Homepage = "https://github.com/scikit-hep/vector" + +[tool.hatch.version] +path = "vector/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/src", ] -build-backend = "setuptools.build_meta" [tool.setuptools_scm] write_to = "src/vector/version.py" @@ -11,23 +126,44 @@ write_to = "src/vector/version.py" [tool.pytest.ini_options] minversion = "6.0" xfail_strict = true -addopts = ["-ra", "--strict-markers", "--strict-config"] -testpaths = ["tests"] -markers = ["slow", "numba", "awkward", "dis"] +addopts = [ + "-ra", + "--strict-markers", + "--strict-config", +] +testpaths = [ + "tests", +] +markers = [ + "slow", + "numba", + "awkward", + "dis", +] log_cli_level = "DEBUG" -filterwarnings = ["error", "ignore::DeprecationWarning", "ignore::UserWarning"] +filterwarnings = [ + "error", + "ignore::DeprecationWarning", + "ignore::UserWarning", +] [tool.isort] profile = "black" [tool.mypy] -files = ["src/vector"] +files = [ + "src/vector", +] python_version = "3.8" strict = true warn_return_any = false show_error_codes = true warn_unreachable = true -enable_error_code = ["ignore-without-code", "truthy-bool", "redundant-expr"] +enable_error_code = [ + "ignore-without-code", + "truthy-bool", + "redundant-expr", +] [[tool.mypy.overrides]] module = "vector._compute.*.*" @@ -35,14 +171,17 @@ disallow_untyped_defs = false disallow_untyped_calls = false [[tool.mypy.overrides]] -module = ["numba.*", "awkward.*"] +module = [ + "numba.*", + "awkward.*", +] ignore_missing_imports = true [tool.check-manifest] ignore = [ - ".*", - "environment.yml", - "src/vector/version.py", - "docs/**", - "noxfile.py", + ".*", + "environment.yml", + "src/vector/version.py", + "docs/**", + "noxfile.py", ] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index eb50558e..00000000 --- a/setup.cfg +++ /dev/null @@ -1,64 +0,0 @@ -[metadata] -name = vector -description = Vector classes and utilities -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/scikit-hep/vector -author = Jim Pivarski, Henry Schreiner, Eduardo Rodrigues -author_email = eduardo.rodrigues@cern.ch -maintainer = The Scikit-HEP admins -maintainer_email = scikit-hep-admins@googlegroups.com -license = BSD-3-Clause -license_file = LICENSE -platforms = - Any -classifiers = - Development Status :: 3 - Alpha - Intended Audience :: Developers - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Scientific/Engineering - Typing :: Typed -keywords = - vector -project_urls = - Documentation = https://vector.readthedocs.io/ - Bug Tracker = https://github.com/scikit-hep/vector/issues - Discussions = https://github.com/scikit-hep/vector/discussions - Changelog = https://vector.readthedocs.io/en/latest/changelog.html - -[options] -packages = find: -install_requires = - numpy>=1.13.3 - packaging>=19.0 - importlib-metadata>=0.22;python_version<"3.8" - typing-extensions;python_version<"3.8" -python_requires = >=3.6 -include_package_data = True -package_dir = - =src -zip_safe = False - -[options.packages.find] -where = src - -[options.entry_points] -numba_extensions = - init = vector:register_numba - -[flake8] -extend-ignore = E501, E203, D103, D102, D101, D100, D107, D105, D205, D400, D401, D104, D412 -extend-select = B9 -per-file-ignores = - tests/*: T - noxfile.py: T diff --git a/setup.py b/setup.py deleted file mode 100644 index 63f030d1..00000000 --- a/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2019-2020, Jonas Eschle, Jim Pivarski, Eduardo Rodrigues, and Henry Schreiner. -# -# Distributed under the 3-clause BSD license, see accompanying file LICENSE -# or https://github.com/scikit-hep/vector for details. - -from setuptools import setup - -extras = { - "awkward": ["awkward>=1.2.0"], - "test": [ - "pytest>=6", - "pytest-cov>=3.0.0", - "xdoctest>=1.0.0", - ], - "test_extras": [ - "uncompyle6", - "spark-parser", - ], - "docs": [ - "nbsphinx", - "myst-parser>0.13", - "Sphinx>=4.0", - "sphinx_copybutton", - "sphinx_book_theme>=0.0.42", - "nbsphinx", - "sphinx-math-dollar", - "ipykernel", - "awkward", - ], -} - -extras["dev"] = [ - *extras["awkward"], - *extras["test"], - 'numba>=0.50; python_version>="3.6"', -] - -extras["all"] = sum(extras.values(), []) - -setup(extras_require=extras) From 6681c79f17316822ffdb319a5df48c618771eb36 Mon Sep 17 00:00:00 2001 From: Saransh Date: Tue, 5 Jul 2022 19:41:11 +0530 Subject: [PATCH 2/8] chore: add .flake8 and remove setup.cfg pre-commit hook --- .flake8 | 6 ++++++ .pre-commit-config.yaml | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..3d970d62 --- /dev/null +++ b/.flake8 @@ -0,0 +1,6 @@ +[flake8] +extend-select = B9 +extend-ignore = E501, E203, D103, D102, D101, D100, D107, D105, D205, D400, D401, D104, D412 +per-file-ignores = + tests/*: T + noxfile.py: T diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 178f7795..551345e4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,11 +34,6 @@ repos: hooks: - id: isort - - repo: https://github.com/asottile/setup-cfg-fmt - rev: v1.20.1 - hooks: - - id: setup-cfg-fmt - - repo: https://github.com/mgedmin/check-manifest rev: "0.48" hooks: From 91cd84e9d79cbddb8f83a45278d5f373379d246c Mon Sep 17 00:00:00 2001 From: Saransh Date: Wed, 6 Jul 2022 00:23:21 +0530 Subject: [PATCH 3/8] Fix `pyproject.toml` --- pyproject.toml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 27db536b..f948f8d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [build-system] requires = [ "hatchling>=1.4.1", + "hatch-vcs", ] build-backend = "hatchling.build" @@ -50,17 +51,12 @@ email = "eduardo.rodrigues@cern.ch" [project.optional-dependencies] all = [ - "awkward", - "awkward>=1.2.0", "awkward>=1.2.0", "ipykernel", "myst-parser>0.13", "nbsphinx", - "nbsphinx", "numba>=0.50; python_version>=\"3.6\"", "pytest-cov>=3.0.0", - "pytest-cov>=3.0.0", - "pytest>=6", "pytest>=6", "spark-parser", "sphinx-math-dollar", @@ -69,7 +65,6 @@ all = [ "sphinx_copybutton", "uncompyle6", "xdoctest>=1.0.0", - "xdoctest>=1.0.0", ] awkward = [ "awkward>=1.2.0", @@ -86,7 +81,6 @@ docs = [ "ipykernel", "myst-parser>0.13", "nbsphinx", - "nbsphinx", "sphinx-math-dollar", "Sphinx>=4.0", "sphinx_book_theme>=0.0.42", @@ -112,17 +106,15 @@ Discussions = "https://github.com/scikit-hep/vector/discussions" Documentation = "https://vector.readthedocs.io/" Homepage = "https://github.com/scikit-hep/vector" -[tool.hatch.version] -path = "vector/__init__.py" +[tool.hatch] +version.source = "vcs" +build.hooks.vcs.version-file = "src/vector/version.py" [tool.hatch.build.targets.sdist] include = [ "/src", ] -[tool.setuptools_scm] -write_to = "src/vector/version.py" - [tool.pytest.ini_options] minversion = "6.0" xfail_strict = true From 1c7bfc8c9cd1339d65669e620b32b0e020e8be72 Mon Sep 17 00:00:00 2001 From: Saransh Date: Wed, 6 Jul 2022 00:38:39 +0530 Subject: [PATCH 4/8] Remove `MANIFEST.in` --- MANIFEST.in | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index fb6240d3..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include LICENSE README.md pyproject.toml setup.py setup.cfg -recursive-include src *.typed *.pyi -recursive-include tests *.py *.pkl From e62ab03515417c4b83f0a28edb7581f5b0e1d38e Mon Sep 17 00:00:00 2001 From: Saransh Date: Wed, 6 Jul 2022 01:05:44 +0530 Subject: [PATCH 5/8] Fix broken tests --- .pre-commit-config.yaml | 6 ------ noxfile.py | 7 +++++++ pyproject.toml | 23 +---------------------- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 551345e4..8f1dd6f6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,12 +34,6 @@ repos: hooks: - id: isort - - repo: https://github.com/mgedmin/check-manifest - rev: "0.48" - hooks: - - id: check-manifest - stages: [manual] - - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.961 hooks: diff --git a/noxfile.py b/noxfile.py index 6b37d768..a031946e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -44,3 +44,10 @@ def docs(session): session.run("python", "-m", "http.server", "8001", "-d", "_build/html") else: print("Unsupported argument to docs") + + +@nox.session +def build(session): + """Build an SDist and wheel.""" + session.install("build") + session.run("python", "-m", "build") diff --git a/pyproject.toml b/pyproject.toml index f948f8d2..65c9eeed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "hatchling>=1.4.1", + "hatchling", "hatch-vcs", ] build-backend = "hatchling.build" @@ -50,22 +50,6 @@ name = "Jim Pivarski, Henry Schreiner, Eduardo Rodrigues" email = "eduardo.rodrigues@cern.ch" [project.optional-dependencies] -all = [ - "awkward>=1.2.0", - "ipykernel", - "myst-parser>0.13", - "nbsphinx", - "numba>=0.50; python_version>=\"3.6\"", - "pytest-cov>=3.0.0", - "pytest>=6", - "spark-parser", - "sphinx-math-dollar", - "Sphinx>=4.0", - "sphinx_book_theme>=0.0.42", - "sphinx_copybutton", - "uncompyle6", - "xdoctest>=1.0.0", -] awkward = [ "awkward>=1.2.0", ] @@ -110,11 +94,6 @@ Homepage = "https://github.com/scikit-hep/vector" version.source = "vcs" build.hooks.vcs.version-file = "src/vector/version.py" -[tool.hatch.build.targets.sdist] -include = [ - "/src", -] - [tool.pytest.ini_options] minversion = "6.0" xfail_strict = true From 17ef85404b5af9d158aa23a6dff7464c1239c452 Mon Sep 17 00:00:00 2001 From: Saransh Date: Wed, 6 Jul 2022 01:15:42 +0530 Subject: [PATCH 6/8] Remove manifest hook from CI --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3c12023..633e604d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,6 @@ jobs: with: python-version: 3.x - uses: pre-commit/action@v3.0.0 - with: - extra_args: --hook-stage manual check-manifest checks: runs-on: ubuntu-latest From 422f05309b7d3eae3b99d0496777565245627107 Mon Sep 17 00:00:00 2001 From: Saransh Date: Wed, 6 Jul 2022 02:19:20 +0530 Subject: [PATCH 7/8] `test_extras` -> `testextras` --- .github/workflows/ci.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 633e604d..76e61430 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: run: python -m pip list - name: Check compute features - run: python -m pip install .[test,test_extras] + run: python -m pip install .[test,testextras] - name: Test package run: python -m pytest -ra -m dis diff --git a/pyproject.toml b/pyproject.toml index 65c9eeed..8d816823 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ test = [ "pytest>=6", "xdoctest>=1.0.0", ] -test_extras = [ +testextras = [ "spark-parser", "uncompyle6", ] From ef9dea97c85fa706e7567d97bc8c3c1355d7028f Mon Sep 17 00:00:00 2001 From: Saransh Date: Thu, 7 Jul 2022 18:58:09 +0530 Subject: [PATCH 8/8] `test_extras` -> `test-extras` --- .github/workflows/ci.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76e61430..a56f1ca5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: run: python -m pip list - name: Check compute features - run: python -m pip install .[test,testextras] + run: python -m pip install .[test,test-extras] - name: Test package run: python -m pytest -ra -m dis diff --git a/pyproject.toml b/pyproject.toml index 8d816823..835b38c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ test = [ "pytest>=6", "xdoctest>=1.0.0", ] -testextras = [ +test-extras = [ "spark-parser", "uncompyle6", ]