-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate setup.cfg
to pyproject.toml
and refactor pyproject.toml
#685
Merged
marvinpfoertner
merged 20 commits into
probabilistic-numerics:main
from
marvinpfoertner:pep-621-refactor
Mar 29, 2022
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
546141f
Migrate `setup.cfg` to PEP 621 Project Metadata in `pyproject.toml`
marvinpfoertner 7df5a6d
Add URLs in `pyproject.toml` testing config
marvinpfoertner e7f9e58
Update `black` configuration
marvinpfoertner edbf194
Update `isort` configuration
marvinpfoertner a7e71ac
Add headers for formatting and linting configuration
marvinpfoertner 42244be
Move formatting configuration section
marvinpfoertner 88c7acc
Rearrange linting configuration
marvinpfoertner e21167f
Add maintainers and authors
marvinpfoertner 7f4fc95
Bugfix in `tool.setuptools.platforms`
marvinpfoertner eeea58a
Bugfix in package collection
marvinpfoertner 955d39c
Bugfix in `project.optional-dependencies`
marvinpfoertner c1056e7
Don't need requirements.txt anymore
marvinpfoertner 3c0f9d7
One line per package dependency
marvinpfoertner a3d7651
Bugfix in `[project.version]`
marvinpfoertner cfe0a16
Remove authors and maintainers
marvinpfoertner 4f1c0cb
Bugfix: `optional-dependencies` is generated dynamically
marvinpfoertner fa66639
Fix warning in build process: Add `homepage` URL
marvinpfoertner 0cd5215
Update sphinx requirement from <4.5,>=3.0 to >=3.0,<4.6 (#688)
dependabot[bot] 822a0cb
Resolve pylint line-too-long for linops (#682)
PrSh27 717e0bb
Merge remote-tracking branch 'origin/main' into pep-621-refactor
marvinpfoertner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,82 @@ | ||
# For more information about this pyproject.toml file, see | ||
# PEP 518: https://www.python.org/dev/peps/pep-0518/ | ||
################################################################################ | ||
# PEP 621 Project Metadata # | ||
################################################################################ | ||
|
||
# see https://peps.python.org/pep-0621/ | ||
|
||
[project] | ||
name = "probnum" | ||
description = "Probabilistic Numerics in Python." | ||
readme = "README.md" | ||
requires-python = ">=3.8,<3.11" | ||
license = {file = "LICENSE.txt"} | ||
keywords = [ | ||
"probabilistic-numerics", | ||
"machine-learning", | ||
"numerical-methods", | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
] | ||
dependencies = [ | ||
"numpy>=1.20", "numpy>=1.21.3; python_version>='3.10'", | ||
"scipy>=1.4", "scipy>=1.8.0; python_version>='3.10'", | ||
] | ||
dynamic = [ | ||
"version", | ||
"optional-dependencies", | ||
] | ||
|
||
# TODO (pypa/setuptools#3221): Optional dependencies that reference one another | ||
# don't seem to be supported yet. Migrate the optional dependencies in `setup.py` | ||
# here, once this is supported. | ||
# [project.optional-dependencies] | ||
# ... | ||
# full = [ | ||
# "%(jax)s", | ||
# "%(zoo)s", | ||
# "%(pls_calib)s", | ||
# ] | ||
|
||
[project.urls] | ||
homepage = "https://probnum.readthedocs.io/en/stable/" | ||
github = "https://github.com/probabilistic-numerics/probnum" | ||
documentation = "https://probnum.readthedocs.io/en/stable/" | ||
benchmarks = "https://probabilistic-numerics.github.io/probnum-benchmarks/benchmarks/" | ||
|
||
################################################################################ | ||
# PEP 518 Build System Configuration # | ||
################################################################################ | ||
|
||
# see https://peps.python.org/pep-0518/ | ||
|
||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"setuptools>=61", | ||
"wheel", | ||
"setuptools_scm[toml]>=6.0", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
# see https://setuptools.pypa.io/en/stable/userguide/pyproject_config.html#setuptools-specific-configuration | ||
|
||
[tool.setuptools] | ||
platforms = [ | ||
"any", | ||
] | ||
zip-safe = false | ||
packages = ["probnum"] | ||
package-dir = { "" = "src" } | ||
include-package-data = true | ||
|
||
[tool.setuptools.dynamic] | ||
version = { attr = "probnum._version.version" } | ||
|
||
[tool.setuptools_scm] | ||
local_scheme = "dirty-tag" | ||
write_to = "src/probnum/_version.py" | ||
|
@@ -20,7 +88,13 @@ write_to_template = """ | |
version = \"{version}\" | ||
""" | ||
|
||
# PyTest configuration | ||
################################################################################ | ||
# Testing Configuration # | ||
################################################################################ | ||
|
||
# see https://docs.pytest.org/en/stable/reference/customize.html | ||
# see https://docs.pytest.org/en/stable/reference/reference.html#ini-options-ref | ||
|
||
[tool.pytest.ini_options] | ||
addopts = [ | ||
"--verbose", | ||
|
@@ -44,28 +118,22 @@ filterwarnings = [ | |
"ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning:flatbuffers.*" | ||
] | ||
|
||
################################################################################ | ||
# Linting Configuration # | ||
################################################################################ | ||
|
||
# Configuration of the black code style checker | ||
# For more information about Black's usage of this file, see | ||
# https://github.com/psf/black#pyprojecttoml | ||
[tool.black] | ||
include = '\.pyi?$' | ||
exclude = ''' | ||
/( | ||
\.eggs | ||
| \.git | ||
| \.hg | ||
| \.mypy_cache | ||
| \.tox | ||
| \.venv | ||
| _build | ||
| buck-out | ||
| build | ||
| dist | ||
)/ | ||
''' | ||
[tool.pylint.master] | ||
extension-pkg-whitelist = [ | ||
"numpy", | ||
] | ||
load-plugins = [ | ||
"pylint.extensions.check_elif", | ||
"pylint.extensions.docparams", | ||
"pylint.extensions.docstyle", | ||
"pylint.extensions.overlapping_exceptions", | ||
"pylint.extensions.mccabe", | ||
] | ||
|
||
# Pylint configuration | ||
[tool.pylint.messages_control] | ||
disable = [ | ||
# Exceptions suggested by Black: | ||
|
@@ -84,18 +152,6 @@ disable = [ | |
[tool.pylint.format] | ||
max-line-length = "88" | ||
|
||
[tool.pylint.master] | ||
extension-pkg-whitelist = [ | ||
"numpy", | ||
] | ||
load-plugins = [ | ||
"pylint.extensions.check_elif", | ||
"pylint.extensions.docparams", | ||
"pylint.extensions.docstyle", | ||
"pylint.extensions.overlapping_exceptions", | ||
"pylint.extensions.mccabe", | ||
] | ||
|
||
[tool.pylint.design] | ||
max-args = 10 | ||
max-complexity = 14 | ||
|
@@ -104,12 +160,31 @@ max-locals = 20 | |
[tool.pylint.similarities] | ||
ignore-imports = "yes" | ||
|
||
# isort configuration | ||
################################################################################ | ||
# Formatting Configuration # | ||
################################################################################ | ||
|
||
# see https://black.readthedocs.io/en/stable/usage_and_configuration/index.html | ||
|
||
[tool.black] | ||
include = '\.pyi?$' | ||
# If `exclude` is not set, `black` excludes all files listed in `.gitignore`. | ||
# The following option extends this list of ignored files. | ||
# see https://black.readthedocs.io/en/stable/usage_and_configuration/file_collection_and_discovery.html#gitignore | ||
extend-exclude = ''' | ||
# A regex preceded with ^/ will apply only to files and directories in the root | ||
# of the project. | ||
/( | ||
\.git | ||
| \.hg | ||
)/ | ||
''' | ||
|
||
# see https://pycqa.github.io/isort/docs/configuration/config_files.html | ||
# see https://pycqa.github.io/isort/docs/configuration/options.html | ||
|
||
[tool.isort] | ||
multi_line_output = 3 | ||
include_trailing_comma = true | ||
force_grid_wrap = 0 | ||
use_parentheses = true | ||
line_length = 88 | ||
# see https://pycqa.github.io/isort/docs/configuration/profiles.html#black | ||
profile = "black" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This combines all deleted options, but it will be kept up-to-date with |
||
combine_as_imports = true | ||
force_sort_within_sections = true |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I specified
probnum
here manually instead of collecting it magically using the[tool.setuptools.packages.find]
directive. This way, we need less configuration lines and we avoid weird artifacts if stuff that we don't want installed gets collected. "Explicit is better than implicit" 😁There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that any additional packages under
src
that we want installed must also be listed here in the future, which gives a very nice overview of the package contents.