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 all 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
8 changes: 5 additions & 3 deletions .github/workflows/pyscal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
if: ${{ always() }}
run: |
pip install --upgrade pip
pip install .[tests]
pip install .[tests,docs]

- name: List all installed packages
if: ${{ always() }}
Expand All @@ -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 tests docs

- name: Lint with flake8
if: ${{ always() }}
Expand All @@ -77,11 +77,13 @@ jobs:
mypy pyscal

- name: Run tests
if: ${{ always() }}
run: |
python -c "import pyscal"
pytest --strict-markers --hypothesis-profile ci tests/
pytest -n auto --strict-markers --hypothesis-profile ci tests/

- name: Syntax check documentation
if: ${{ always() }}
run: |
rstcheck -r docs

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]"
}

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

This file was deleted.

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

requires = [
"setuptools>=45.0",
"setuptools_scm[toml]>=6.2",
]

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 = [
"black",
"flake8",
"hypothesis",
"isort",
"mypy",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-xdist",
"rstcheck",
]

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"

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

[tool.black]
line-length = 88

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

[[tool.mypy.overrides]]
module = ["numpy.*", "pyscal.version", "pandas.*", "matplotlib.*", "scipy.*", "xlrd.*", "openpyxl.*"
]
ignore_missing_imports = true

[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=.eggs"

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"]
5 changes: 1 addition & 4 deletions pyscal/utils/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ def df2str(
dframe = modify_dframe_monotonicity(dframe, monotonicity, digits)

return dframe.round(roundlevel).to_csv(
sep=" ",
float_format=float_format,
header=header,
index=False
sep=" ", float_format=float_format, header=header, index=False
)


Expand Down
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.