Skip to content

Commit

Permalink
Modernize build system
Browse files Browse the repository at this point in the history
Fixes #28. Also updating GitHub workflows, README/CONTRIBUTING, etc.
  • Loading branch information
kwinkunks committed Dec 19, 2023
1 parent 3151b2b commit a5e7f13
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 104 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r test_requirements.txt
python -m pip install .[dev,test]
- name: Lint with flake8 and black
run: |
pip install flake8
pip install black
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# test remaining issues
Expand All @@ -40,7 +37,6 @@ jobs:
- name: Test
run: |
pytest .
- name: Run Examples
run: |
open_petro_elastic --data-file examples/example1.csv examples/example1.yaml
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/python-sphinx-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r doc_requirements.txt
python -m pip install .[docs]
- name: Generate documentation
run: |
sphinx-build docs docs_out/
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Upload Python Package

on:
release:
types: [created]
types: [published]

jobs:
deploy:
Expand All @@ -16,11 +16,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python -m pip install .[dev]
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ We expect commit messages to follow the style described [here](https://chris.bea
You can build the documentation after installation by running:

```bash
pip install -r dev-requirements.txt
python -m pip install .[docs]
sphinx-build -n -v -E -W ./docs ./tmp/ope_docs
```

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A Python library for petro-elastic modelling. It contains a `Material` class for
pip install open_petro_elastic
```

Developers and contributors can download the repository and do `pip install .` to install the package.
Developers and contributors can download the repository and do `pip install ".[dev,test,docs]"` to install the package with all its dependencies for development, testing, and building the docs.


## Usage
Expand Down
6 changes: 0 additions & 6 deletions doc_requirements.txt

This file was deleted.

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

[project]
name="open_petro_elastic"
dynamic = ["version"]
requires-python = ">=3.8"
authors = [{ name="Equinor", email="[email protected]" },]
description="Utility for calculating elastic properties of rocks and fluids."
license = {file = "LICENSE"}
readme = "README.md"
keywords = ["geophysics", "rock physics", "materials science"]
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Hydrology",
"Topic :: Scientific/Engineering :: Physics",
"Natural Language :: English",
"Operating System :: OS Independent",
"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",
]
dependencies = [
"numpy<2",
"scipy",
"pyyaml",
"pandas",
"pydantic<2",
"sympy",
"typing_extensions",
]

[project.optional-dependencies]
test = [
"pytest",
"snapshottest",
"hypothesis",
"matplotlib",
"pillow>=10.0.0", # not directly required, pinned by Snyk to avoid a vulnerability
]
docs = [
"sphinx",
"sphinx-rtd-theme",
"sphinx-argparse",
"matplotlib",
"recommonmark",
"pygments-csv-lexer",
]
dev = [
"build",
"setuptools",
"flake8",
"black",
"isort",
"mypy",
]

[project.urls]
"documentation" = "https://equinor.github.io/open_petro_elastic"
"repository" = "https://github.com/equinor/open_petro_elastic"

[project.scripts]
open_petro_elastic = "open_petro_elastic.__main__:main"

[project.entry-points."open_petro_elastic.fluid_model_providers"]
batzle_wang = "open_petro_elastic.config.fluid_model_providers:BatzleWangFluidModelProvider"
span_wagner = "open_petro_elastic.config.fluid_model_providers:SpanWagnerFluidModelProvider"

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

[tool.setuptools.package-data]
open_petro_elastic = ["tutorial_config/*"]
"open_petro_elastic.material.span_wagner.tables" = [
"material/span_wagner/tables/carbon_dioxide_density.npz"
]

[tool.flake8]
max-line-length = 88
ignore = ["E302", "W503", "E501", "E741", "E203", "F405"]
per-file-ignores = [
"__init__.py:F401,F403",
"conftest.py: F401,F403",
]
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

11 changes: 0 additions & 11 deletions setup.cfg

This file was deleted.

57 changes: 0 additions & 57 deletions setup.py

This file was deleted.

5 changes: 0 additions & 5 deletions test_requirements.txt

This file was deleted.

0 comments on commit a5e7f13

Please sign in to comment.