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

Migrate to pyproject toml #262

Merged
merged 3 commits into from
Sep 12, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install fmu-ensemble and test dependencies
run: |
pip install pip -U
pip install .[tests]
pip install ".[test]"

- name: Generate coverage report
run: |
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/fmu-ensemble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,14 @@ jobs:
run: git fetch --unshallow --tags

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: 📦 Install fmu-ensemble with dependencies
run: |
pip install --upgrade pip
pip install .

- name: 📦 Install test dependencies
- name: 📦 Install fmu-ensemble with test dependencies
run: |
pip install res2df
pip install .[tests,docs]
pip install ".[test, docs]"
pip install "${{ matrix.numpy-version }}"

- name: Install ecl2df
Expand All @@ -64,17 +59,11 @@ jobs:
- name: 🧾 List all installed packages
run: pip freeze

- name: 🕵️ Check code style
env:
SKIP: no-commit-to-branch
run: |
pre-commit run --all-files

- name: 🤖 Run tests
run: |
python -c "import fmu.ensemble"
pytest tests/
pip install .[parquet]
pip install ".[parquet]"
pytest tests/test_virtualensemble.py

- name: Syntax check on RST documentation
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: style

on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- published

jobs:
fmu-ensemble:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

steps:
- name: 📖 Checkout commit locally
uses: actions/checkout@v4

- name: 📖 Checkout tags
# This seems necessary for setuptools_scm to be able to infer
# the correct version.
run: git fetch --unshallow --tags

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: 📦 Install fmu-ensemble with style dependencies
run: |
pip install ".[style]"

- name: 🕵️ Check code style
env:
SKIP: no-commit-to-branch
run: |
pre-commit run --all-files
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
rev: v0.6.4
hooks:
- id: ruff
args: [ --extend-select, I, --fix ]
args: [ --fix ]
- id: ruff-format

exclude: "tests/data/testensemble-reek001"
Empty file removed .projectile
Empty file.
32 changes: 0 additions & 32 deletions .pylintrc

This file was deleted.

1 change: 0 additions & 1 deletion bandit.yml

This file was deleted.

3 changes: 1 addition & 2 deletions ci/testkomodo.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
install_test_dependencies () {
pip install -r test_requirements.txt
pip install -r docs_requirements.txt
pip install ".[test, docs]"
}
5 changes: 0 additions & 5 deletions docs_requirements.txt

This file was deleted.

109 changes: 109 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
[build-system]
requires = ["setuptools>65", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[project]
name = "fmu-ensemble"
authors = [
{name = "Håvard Berland", email = "havb@equinor.com"},
]
description = "Python API to ensembles produced by ERT"
requires-python = ">= 3.8"
readme = "README.rst"
license = {text = "GPL-3.0"}
keywords = ["fmu", "ensemble"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dynamic = ["version"]
dependencies = [
"resdata >= 4.0.0",
"numpy",
"pandas",
"pyyaml >= 5.1",
]

[project.urls]
Repository = "https://github.com/equinor/fmu-ensemble"

[project.optional-dependencies]
test = [
"pytest>=2.9.2",
"pytest-cov",
]
docs = [
"ipython",
"rstcheck",
"sphinx",
"sphinx-argparse",
"sphinx_rtd_theme",
]
style = [
"pre-commit",
]
parquet = [
"pyarrow",
]

[tool.setuptools]
package-dir = {"" = "src"}
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]
write_to = "src/fmu/ensemble/version.py"

[tool.rstcheck]
ignore_directives = ["argparse", "automodule"]
# This looks like a bug in rstcheck:
ignore_messages = "Hyperlink target .* is not referenced"

[tool.ruff]
src = ["src"]
line-length = 88

[tool.ruff.lint]
select = [
"W", # pycodestyle
"I", # isort
"B", # flake-8-bugbear
"SIM", # flake-8-simplify
"F", # pyflakes
"PL", # pylint
"NPY", # numpy specific rules
"C4", # flake8-comprehensions
]
ignore = ["PLW2901", # redefined-loop-name
"PLR2004", # magic-value-comparison
"PLR0915", # too-many-statements
"PLR0912", # too-many-branches
"PLR0911", # too-many-return-statements
"PLC2701", # import-private-name
"PLR6201", # literal-membership
"PLR0914", # too-many-locals
"PLR6301", # no-self-use
"PLW1641", # eq-without-hash
"PLR0904", # too-many-public-methods
"PLR1702", # too-many-nested-blocks
"PLW3201", # bad-dunder-method-name
"B028", # no-explicit-stacklevel
"SIM118", # in-dict-keys
]

[tool.ruff.lint.extend-per-file-ignores]
"tests/*" = [
"PLW0603" # global-statement
]

[tool.ruff.lint.pylint]
max-args = 20
22 changes: 0 additions & 22 deletions setup.cfg

This file was deleted.

65 changes: 0 additions & 65 deletions setup.py

This file was deleted.

Loading