Skip to content

Commit

Permalink
Merge pull request #7 from GeoStat-Framework/modernize_packaging
Browse files Browse the repository at this point in the history
Packaging: pep517/518 conform workflow with pyproject.toml
  • Loading branch information
MuellerSeb authored Jun 16, 2021
2 parents a7c56cd + 4b03581 commit cfef939
Show file tree
Hide file tree
Showing 14 changed files with 190 additions and 122 deletions.
11 changes: 0 additions & 11 deletions .coveragerc

This file was deleted.

47 changes: 35 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,40 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
source_check:
name: source check
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions\setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black #pylint
pip install --editable .
- name: black check
run: |
python -m black --check .
# - name: pylint check
# run: |
# python -m pylint anaflow/

build_sdist:
name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -40,21 +66,18 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U wheel
pip install -r requirements_setup.txt
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install coveralls>=3.0.0
- name: Build sdist
run: |
python setup.py sdist --formats=gztar bdist_wheel -d dist
pip install build coveralls>=3.0.0
pip install --editable .[test]
- name: Run tests
run: |
python -m pytest --cov anaflow --cov-report term-missing -v tests/
python -m coveralls --service=github
- name: Build sdist
run: |
python -m build
- uses: actions/upload-artifact@v2
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
with:
Expand All @@ -73,7 +96,7 @@ jobs:
- name: Publish to Test PyPI
# only if working on develop
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
Expand All @@ -83,7 +106,7 @@ jobs:
- name: Publish to PyPI
# only if tagged
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
14 changes: 14 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

sphinx:
configuration: docs/source/conf.py

formats: all

python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- doc
15 changes: 6 additions & 9 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
include README.md
include MANIFEST.in
include setup.py
include setup.cfg
recursive-include anaflow *.py
recursive-include tests *.py
recursive-include docs/source *
include docs/Makefile docs/requirements.txt
include LICENSE
prune *
graft anaflow
graft tests

include LICENSE README.md pyproject.toml setup.cfg
global-exclude __pycache__ *.py[cod] .*
2 changes: 1 addition & 1 deletion anaflow/flow/ext_grf_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def ext_grf_steady(
rate=-1e-4,
h_ref=0.0,
arg_dict=None,
**kwargs
**kwargs,
):
"""
The extended "General radial flow" model for steady flow.
Expand Down
8 changes: 4 additions & 4 deletions anaflow/tools/mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def annular_amean(func, val_arr, ann_dim=2, arg_dict=None, **kwargs):
f_inv=lambda x: x,
ann_dim=ann_dim,
arg_dict=arg_dict,
**kwargs
**kwargs,
)


Expand Down Expand Up @@ -260,7 +260,7 @@ def annular_gmean(func, val_arr, ann_dim=2, arg_dict=None, **kwargs):
f_inv=np.exp,
ann_dim=ann_dim,
arg_dict=arg_dict,
**kwargs
**kwargs,
)


Expand Down Expand Up @@ -322,7 +322,7 @@ def annular_hmean(func, val_arr, ann_dim=2, arg_dict=None, **kwargs):
f_inv=lambda x: 1.0 / x,
ann_dim=ann_dim,
arg_dict=arg_dict,
**kwargs
**kwargs,
)


Expand Down Expand Up @@ -392,5 +392,5 @@ def annular_pmean(func, val_arr, p=2.0, ann_dim=2, arg_dict=None, **kwargs):
f_inv=lambda x: np.power(x, 1.0 / p),
ann_dim=ann_dim,
arg_dict=arg_dict,
**kwargs
**kwargs,
)
3 changes: 0 additions & 3 deletions docs/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion docs/requirements_doc.txt

This file was deleted.

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

[tool.setuptools_scm]
write_to = "anaflow/_version.py"
write_to_template = "__version__ = '{version}'"
local_scheme = "no-local-version"
fallback_version = "0.0.0.dev0"

[tool.black]
exclude = """
^/( ( examples ) /| anaflow/_version.py )
"""
line-length = 79
target-version = [
"py36",
"py37",
"py38",
]

[tool.coverage]
[tool.coverage.run]
source = ["anaflow"]
omit = [
"*docs*",
"*examples*",
"*tests*",
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if __name__ == '__main__':",
"def __repr__",
"def __str__",
]

[tool.pylint]
[tool.pylint.master]
extension-pkg-whitelist = [
"numpy",
"scipy",
]
ignore = "_version.py"

[tool.pylint.message_control]
disable = [
"R0801",
]

[tool.pylint.reports]
output-format = "colorized"

[tool.pylint.design]
max-args = 20
max-locals = 50
max-branches = 30
max-statements = 80
max-attributes = 25
max-public-methods = 75
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements_setup.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements_test.txt

This file was deleted.

66 changes: 65 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
[metadata]
description-file = README.md
name = anaflow
description = AnaFlow - analytical solutions for the groundwater-flow equation.
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/GeoStat-Framework/AnaFlow
author = Sebastian Mueller
author_email = [email protected]
maintainer = Sebastian Mueller
maintainer_email = [email protected]
license = MIT
license_file = LICENSE
platforms = any
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Intended Audience :: End Users/Desktop
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Natural Language :: English
Operating System :: MacOS
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Operating System :: Unix
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Scientific/Engineering
Topic :: Software Development
Topic :: Utilities
project_urls =
Documentation = https://anaflow.readthedocs.io
Source = https://github.com/GeoStat-Framework/anaflow
Tracker = https://github.com/GeoStat-Framework/anaflow/issues
Changelog = https://github.com/GeoStat-Framework/anaflow/blob/develop/CHANGELOG.md
Conda-Forge = https://anaconda.org/conda-forge/anaflow

[options]
packages = find:
install_requires =
numpy>=1.14.5,<2
pentapy>=1.1.0,<2
scipy>=1.1.0,<2
python_requires = >=3.6
zip_safe = False

[options.packages.find]
exclude =
tests*
docs*

[options.extras_require]
doc =
numpydoc>=1.1
sphinx>=3
sphinx-gallery>=0.8
sphinx-rtd-theme>=0.5
test =
coverage[toml]>=5.2.1
pytest>=6.0
pytest-cov>=2.11.0
73 changes: 0 additions & 73 deletions setup.py

This file was deleted.

0 comments on commit cfef939

Please sign in to comment.