Skip to content
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

Replace setup.py with pyproject.toml #420

Merged
merged 6 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
exclude = docs, pyscal/__init__.py, pyscal/version.py
max-line-length = 88
ignore = E741, W503, E203
# E203: "whitespace before ':'", added due to conflict with black
2 changes: 1 addition & 1 deletion .github/workflows/pyscal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Lint with black
if: ${{ always() }}
run: |
black --check --force-exclude="pyscal/version.py" pyscal/*py tests/test_*py setup.py docs/conf.py
black --check --force-exclude="pyscal/version.py" pyscal/*py tests/test_*py docs/conf.py
alifbe marked this conversation as resolved.
Show resolved Hide resolved

- name: Lint with flake8
if: ${{ always() }}
Expand Down
34 changes: 0 additions & 34 deletions .pre-commit-config.yaml

This file was deleted.

1 change: 0 additions & 1 deletion bandit.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ci/testkomodo.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
install_test_dependencies () {
pip install -r test_requirements.txt
pip install ".[tests,docs]"
}
alifbe marked this conversation as resolved.
Show resolved Hide resolved

start_tests () {
Expand Down
23 changes: 0 additions & 23 deletions mypy.ini

This file was deleted.

117 changes: 117 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
[build-system]

requires = [
"setuptools>=45.0",
"setuptools_scm[toml]>=6.2",
"wheel>=0.38.1",
alifbe marked this conversation as resolved.
Show resolved Hide resolved
]

build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["pyscal"]
Comment on lines +10 to +11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed because this repository isn't src/ based?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. I was tempted to move pyscal folder inside src But decided to use this instead. Any other benefit of using src/ based?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/ is preferred I guess because it very clearly indicates where to click if you want to look at the source code. One of those conventions that is pretty standard around many languages; in my opinion it is the better option. I think some tools (setuptools in particular, in this case) look for it first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll adopt this on next PR 👍


[tool.setuptools_scm]
write_to = "pyscal/version.py"

[project]
name = "pyscal"
description = "Generate relative permeability include files for Eclipse reservoir simulator"
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
authors = [
{ name = "Håvard Berland", email = "[email protected]" },
]
keywords = ["relative permeability", "capillary pressure", "reservoir simulation"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research/Developers",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Natural Language :: English",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
]
dynamic = ["version"]

dependencies = [
"matplotlib",
"numpy<2",
"openpyxl",
"pandas",
"scipy",
"urllib3<2",
"xlrd",
]

[project.optional-dependencies]
tests = [
"autoapi",
"black",
"flake8",
"hypothesis",
"isort",
"mypy",
"pre-commit",
"pytest",
"pytest-cov",
"pytest-mock",
"rstcheck",
"sphinx<7",
"sphinx-argparse",
"sphinx-autodoc-typehints",
"sphinx_rtd_theme",
alifbe marked this conversation as resolved.
Show resolved Hide resolved
]

docs = [
"autoapi",
"sphinx<7",
"sphinx-argparse",
"sphinx-autodoc-typehints",
"sphinx_rtd_theme",
]

[project.urls]
homepage = "https://github.com/equinor/pyscal"
documentation = "https://equinor.github.io/pyscal/"
repository = "https://github.com/equinor/pyscal"
alifbe marked this conversation as resolved.
Show resolved Hide resolved

[project.scripts]
pyscal = "pyscal.pyscalcli:main"

[tool.black]
line-length = 88

[tool.isort]
profile = "black"
skip = "pyscal/__init__.py"

[tool.mypy]
ignore_missing_imports = true
alifbe marked this conversation as resolved.
Show resolved Hide resolved

[tool.pylint]
# Module docstrings are not required, there are other means of documenting at
# that level in subscript
disable = "missing-module-docstring"

[tool.pytest.ini_options]
norecursedirs = [
".git",
]
xfail_strict = "True"

addopts = "-ra --strict-markers --ignore=docs/conf.py --ignore=setup.py --ignore=.eggs"
alifbe marked this conversation as resolved.
Show resolved Hide resolved

markers = [
"integration: marks a test as an integration test",
"plot: marks a test as interactive, plots will flash to the screen",
"slow: a test that is expected to take up to a second or so to execute",
]

[tool.rstcheck]
ignore_directives = ["argparse", "automodule"]
29 changes: 0 additions & 29 deletions setup.cfg

This file was deleted.

65 changes: 0 additions & 65 deletions setup.py

This file was deleted.

15 changes: 0 additions & 15 deletions test_requirements.txt

This file was deleted.