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/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3c12023..a56f1ca5 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 @@ -80,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,test-extras] - name: Test package run: python -m pytest -ra -m dis diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 178f7795..8f1dd6f6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,17 +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: - - id: check-manifest - stages: [manual] - - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.961 hooks: 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 diff --git a/noxfile.py b/noxfile.py index c1540350..a031946e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,4 +1,3 @@ -import shutil from pathlib import Path import nox @@ -50,9 +49,5 @@ def docs(session): @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..835b38c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,33 +1,140 @@ [build-system] requires = [ - "setuptools>=42.0", - "setuptools_scm[toml]>=3.4" + "hatchling", + "hatch-vcs", ] -build-backend = "setuptools.build_meta" +build-backend = "hatchling.build" -[tool.setuptools_scm] -write_to = "src/vector/version.py" +[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] +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", + "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.source = "vcs" +build.hooks.vcs.version-file = "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 +142,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)