Skip to content

Commit

Permalink
Move to a pyproject.toml based package
Browse files Browse the repository at this point in the history
  • Loading branch information
mferrera committed Nov 21, 2023
1 parent 95aa143 commit fb4862c
Show file tree
Hide file tree
Showing 15 changed files with 175 additions and 277 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 88
ignore = E402, W503, E203, C901
exclude = docs/conf.py, version.py
46 changes: 26 additions & 20 deletions .github/workflows/ci-xtgeoviz.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
# build and test some end points
name: Build and test xtgeoviz

# on: [push, pull_request]

on:
push:
branches:
- main
pull_request:
branches: [main]
branches:
- main
release:
types:
- published
schedule:
# Run nightly to check that tests are working with latest dependencies
- cron: "0 0 * * *"

jobs:
build_pywheels:
name: PY ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
test:
strategy:
matrix:
python-version: [3.8, 3.9, "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Install library
run: >
pip install pip -U &&
pip install .
- name: Clone xtgeo-testdata
run: git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata

- run: git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata
shell: bash
- name: Install
run: |
pip install -U pip
pip install ".[tests]"
- name: Full test
run: >
pip install -r requirements/requirements_test.txt &&
pytest --disable-warnings -x
- name: Run tests
run: pytest -n auto --disable-warnings
50 changes: 39 additions & 11 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,49 @@
name: linting
name: Linting

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
schedule:
# Run nightly to check that tests are working with latest dependencies
- cron: "0 0 * * *"

jobs:
linting:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up python
uses: actions/setup-python@v2
- name: Check black style and linting
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install
run: |
pip install black
black --check *.py src tests
pip install flake8
flake8 src tests
pip install -U pip
pip install ".[tests]"
- name: Lint with isort
if: ${{ always() }}
run: isort --check-only --profile black src tests

- name: Lint with black
if: ${{ always() }}
run: black --check src tests

- name: Lint with flake8
if: ${{ always() }}
run: flake8 src tests
15 changes: 11 additions & 4 deletions .github/workflows/xtgeoviz-publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@ jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install dependencies
run: pip install --upgrade setuptools wheel twine
run: pip install -U setuptools build twine

- name: Build package
run: python setup.py sdist bdist_wheel
run: python -m build

- name: Upload deploy
env:
TWINE_USERNAME: __token__
Expand Down
120 changes: 95 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,38 +1,108 @@
# NOTE: you have to use single-quoted strings in TOML for regular expressions.

[build-system]
requires = [
"pip>=19.1.1",
"setuptools>=45",
"setuptools_scm[toml]>=6.2",
"wheel",
]
build-backend = "setuptools.build_meta"

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

[project]
name = "xtgeoviz"
description = "Plotting library for xtgeo objects"
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
authors = [
{ name = "Equinor", email = "fg_fmu-atlas@equinor.com" },
]
keywords = [
"energy",
"subsurface",
"reservoir",
"scientific",
"engineering",
"maps",
"xtgeo",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Natural Language :: English",
"License :: OSI Approved :: GNU Lesser General Public",
"License v3 or later (LGPLv3+)",
]
dynamic = ["version"]
dependencies = [
"xtgeo>=2.14",
"PyYAML",
"scipy>=1.5.3",
"matplotlib>=3.3.2",
"numpy>=1.19.2",
]

[project.optional-dependencies]
tests = [
"black",
"coverage>=4.1",
"flake8",
"isort",
"mypy",
"pylint",
"pytest",
"pytest-cov",
"pytest-runner",
"pytest-mock",
"pytest-xdist",
"rstcheck",
"types-PyYAML",
]
docs = [
"sphinx",
"autoapi",
"sphinxcontrib-apidoc",
"sphinx-argparse",
"sphinx-autodoc-typehints",
"sphinx-copybutton",
"sphinx-togglebutton",
"sphinx_rtd_theme",
]

[project.urls]
Homepage = "https://github.com/equinor/xtgeoviz"
Repository = "https://github.com/equinor/xtgeoviz"
Documentation = "https://github.com/equinor/xtgeoviz"
Issues = "https://github.com/equinor/xtgeoviz/issues"

[tool.black]
line-length = 88
target-version = ['py36', 'py37', 'py38', 'py39', 'py310']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _buildsetuptools.scm
| buck-out
| build
| dist
# The following are specific to Black, you probably don't want those.
| blib2to3
| profiling
)/
'''

[tool.setuptools_scm]
write_to = "src/xtgeoviz/version.py"
[tool.isort]
profile = "black"

[tool.mypy]
ignore_missing_imports = true

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--verbose"
log_cli = "False"
log_cli_format = "%(levelname)8s (%(relativeCreated)6.0fms) %(filename)44s [%(funcName)40s()] %(lineno)4d >> %(message)s"
log_cli_level = "INFO"
testpaths = "tests"
markers = [
"integration: Integration tests",
]
12 changes: 0 additions & 12 deletions pytest.ini

This file was deleted.

5 changes: 0 additions & 5 deletions requirements/requirements.txt

This file was deleted.

6 changes: 0 additions & 6 deletions requirements/requirements_docs.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements/requirements_setup.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements/requirements_test.txt

This file was deleted.

6 changes: 0 additions & 6 deletions requirements/requirements_testx.txt

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/README.txt

This file was deleted.

Loading

0 comments on commit fb4862c

Please sign in to comment.