From c42f6514ba4bc339a377a247811928ba85f813eb Mon Sep 17 00:00:00 2001 From: larsevj Date: Tue, 10 Sep 2024 17:26:31 +0200 Subject: [PATCH] Migrate from setup.py to pyproject.toml --- .github/workflows/fmu-ensemble.yml | 9 +--- .projectile | 0 .pylintrc | 32 -------------- bandit.yml | 1 - docs_requirements.txt | 5 --- pyproject.toml | 69 ++++++++++++++++++++++++++++++ setup.cfg | 22 ---------- setup.py | 65 ---------------------------- test_requirements.txt | 4 -- 9 files changed, 71 insertions(+), 136 deletions(-) delete mode 100644 .projectile delete mode 100644 .pylintrc delete mode 100644 bandit.yml delete mode 100644 docs_requirements.txt create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 test_requirements.txt diff --git a/.github/workflows/fmu-ensemble.yml b/.github/workflows/fmu-ensemble.yml index 768d74e9..ba0d9042 100644 --- a/.github/workflows/fmu-ensemble.yml +++ b/.github/workflows/fmu-ensemble.yml @@ -45,15 +45,10 @@ jobs: 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 .[tests, docs] pip install "${{ matrix.numpy-version }}" - name: Install ecl2df diff --git a/.projectile b/.projectile deleted file mode 100644 index e69de29b..00000000 diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 3ea3e8ca..00000000 --- a/.pylintrc +++ /dev/null @@ -1,32 +0,0 @@ -# PYLINT: General settings for FMU modules - -[GENERAL] -disable=R0205, F0010, C0330, E1136, E0401 -output-format=colorized - -# E1136: Pylint is not able to detect that all objects really are subscriptable -# E0401: import-error, these will be caught by automated tests anyhow - -[MASTER] -init-hook='import sys; sys.path.append("src/")' -ignore=version.py,__init__.py,setup.py,jobs.py - -[BASIC] -good-names=logger, fmux, xfmu - -[FORMAT] -max-line-length=88 -max-module-lines=3000 - -[DESIGN] -max-attributes=25 -max-args=20 -max-locals=30 -max-statements=100 -max-branches=20 - -[SIMILARITIES] -min-similarity-lines=6 -ignore-comments=yes -ignore-docstrings=yes -ignore-imports=yes diff --git a/bandit.yml b/bandit.yml deleted file mode 100644 index 75d550c3..00000000 --- a/bandit.yml +++ /dev/null @@ -1 +0,0 @@ -skips: ['B101'] diff --git a/docs_requirements.txt b/docs_requirements.txt deleted file mode 100644 index cb2d22d8..00000000 --- a/docs_requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -ipython -rstcheck -sphinx -sphinx-argparse -sphinx_rtd_theme diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..f2b83cdc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,69 @@ +[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" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index cb785221..00000000 --- a/setup.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[bdist_wheel] -universal = 1 - -[flake8] -max-line-length = 88 -exclude = docs, - tests/data - -[aliases] -test = pytest - -[tool:pytest] -addopts = --verbose - -[build_sphinx] -all-files = 1 -warning-is-error = 1 - -[rstcheck] -ignore_directives=argparse,automodule -# This looks like a bug in rstcheck: -ignore_messages=Hyperlink target .* is not referenced diff --git a/setup.py b/setup.py deleted file mode 100644 index 1ec2c85f..00000000 --- a/setup.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -"""The setup script.""" - -from setuptools import find_packages, setup - -with open("README.rst") as readme_file: - readme = readme_file.read() - -with open("HISTORY.rst", "rb") as history_file: - # Norwegian characters in HISTORY.rst - history = history_file.read().decode("UTF-8") - -REQUIREMENTS = [ - "resdata>=4.0.0", - "numpy", - "pandas", - "pyyaml>=5.1", -] - -SETUP_REQUIREMENTS = ["setuptools>=65", "setuptools_scm"] - -with open("test_requirements.txt") as f: - test_requirements = f.read().splitlines() -with open("docs_requirements.txt") as f: - docs_requirements = f.read().splitlines() - -EXTRAS_REQUIRE = { - "tests": test_requirements, - "docs": docs_requirements, - "parquet": ["pyarrow"], -} - -setup( - name="fmu-ensemble", - use_scm_version={"write_to": "src/fmu/ensemble/version.py"}, - description="Python API to ensembles produced by ERT", - long_description=readme + "\n\n" + history, - author="Håvard Berland", - author_email="havb@equinor.com", - url="https://github.com/equinor/fmu-ensemble", - license="GPLv3", - packages=find_packages("src"), - package_dir={"": "src"}, - include_package_data=True, - install_requires=REQUIREMENTS, - zip_safe=False, - 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", - ], - test_suite="tests", - tests_require=test_requirements, - setup_requires=SETUP_REQUIREMENTS, - extras_require=EXTRAS_REQUIRE, - python_requires=">=3.8", -) diff --git a/test_requirements.txt b/test_requirements.txt deleted file mode 100644 index 51f4dd5d..00000000 --- a/test_requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -pre-commit -pytest>=2.9.2 -pytest-cov -pyyaml>=5.1