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

Prepare v1.0.7 #19

Merged
merged 4 commits into from
Aug 27, 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
40 changes: 28 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,32 @@ on:
- lmoments3/__init__.py
pull_request:

concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on main.
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
black:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.11.0
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- name: Set up Python3.8
uses: actions/setup-python@v4
disable-sudo: true
egress-policy: audit
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python${{ matrix.python-version }}
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.8"
- name: Install black
run: pip install black
run: |
pip install black>=24.8.0
- name: Run linting suite
run: black --check lmoments3
run: |
black --check lmoments3

test:
name: Pip with Python${{ matrix.python-version }}
Expand All @@ -39,12 +47,20 @@ jobs:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}
- name: Install lmoments3
run: pip install -e .
run: |
pip install -e .
- name: Test
run: python -m unittest discover -v
run: |
python -m unittest discover -v
28 changes: 21 additions & 7 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,33 @@ on:
jobs:
build-n-publish-pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI
environment: production
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
files.pythonhosted.org:443
github.com:443
pypi.org:443
upload.pypi.org:443
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python3
uses: actions/setup-python@v4
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.x"
- name: Install packaging libraries
run: pip install build wheel
run: |
pip install build>=1.0 wheel>=0.42.0
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel .
run: |
python -m build --sdist --wheel .
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
22 changes: 16 additions & 6 deletions .github/workflows/tag-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,31 @@ on:
jobs:
build-n-publish-testpypi:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
environment: staging
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python3
uses: actions/setup-python@v4
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.x"
- name: Install packaging libraries
run: pip install build wheel
run: |
pip install build>=1.0 wheel>=0.42.0
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel .
run: |
python -m build --sdist --wheel .
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
25 changes: 12 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ default_language_version:

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.17.0
hooks:
- id: pyupgrade
args: ['--py38-plus']
args: [ '--py38-plus' ]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: setup.cfg
Expand All @@ -22,36 +22,35 @@ repos:
hooks:
- id: toml-sort-fix
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
rev: v1.35.1
hooks:
- id: yamllint
args: ['--config-file=.yamllint.yaml']
args: [ '--config-file=.yamllint.yaml' ]
exclude: conda-recipe/meta.yaml
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.1.1
hooks:
- id: flake8
args: ['--config=setup.cfg']
args: [ '--config=setup.cfg' ]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ['--settings-file=pyproject.toml']
args: [ '--settings-file=pyproject.toml' ]
# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.3.0
# hooks:
# - id: pydocstyle
# args: ['--config=setup.cfg']
- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
rev: v0.3.9
hooks:
- id: blackdoc
additional_dependencies:
- 'black==23.1.0'
additional_dependencies: [ 'black==24.8.0' ]
- repo: meta
hooks:
- id: check-hooks-apply
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Changelog
=========

version 1.0.7 (unreleased)
version 1.0.7 (2024-08-27)
--------------------------
- Fix algorithm convergence for the `kappa` distribution.
- Added Python 3.12 to the test suite and supported versions.
- Avoid inplace modifications of input arrays in ``lmom_ratios``.
- Adjusted the base dependency pins for the development environment.

version 1.0.6 (2023-07-06)
--------------------------
Expand Down
16 changes: 12 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
lmoments3
=========

A Python 3.x library to estimate linear moments for statistical distribution functions.
A Python3 library to estimate linear moments for statistical distribution functions.

Requires the packages `numpy` and `scipy`.

Expand All @@ -16,12 +16,18 @@ lmoments3 can be installed via `pip`

$ pip install lmoments3

or, alternatively, you can install it from conda-forge:

.. code-block:: console

$ conda install -c conda-forge lmoments3

Documentation
-------------

Documentation is available on `Read the Docs <http://lmoments3.readthedocs.io/latest>`_.
Documentation is available on `Read the Docs <http://lmoments3.readthedocs.io/stable>`_.

Source code can be found at `GitHub <https://github.com/OpenHydrology/lmoments3>`_.
Source code can be found at `GitHub <https://github.com/Ouranosinc/lmoments3>`_.

Origin
------
Expand Down Expand Up @@ -89,4 +95,6 @@ The software remains licenced under the GNU General Public License, see <https:/
The Python 3 port, is based on the original `lmoments package <https://pypi.python.org/pypi/lmoments/0.2.2>`_, version
0.2.2.

The Ouranosinc package was forked from `OpenHydrology's lmoments3 <https://github.com/OpenHydrology/lmoments3>`_. The primary aims of this fork are to provide maintenance for the existing codebase as well as update the project to benefit from more modern Python coding conventions, maintain compatibility with existing Python dependencies.
The Ouranosinc package was forked from `OpenHydrology's lmoments3 <https://github.com/OpenHydrology/lmoments3>`_.
The primary aims of this fork are to provide maintenance for the existing codebase as well as update the project to
benefit from more modern Python coding conventions, maintain compatibility with existing Python dependencies.
17 changes: 8 additions & 9 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = ".rst"
source_suffix = {".rst": "restructuredtext"}

# The master toctree document.
master_doc = "index"
Expand All @@ -46,16 +46,9 @@
release = versioneer.get_version()
version = ".".join(release.split(".")[:2])

on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down Expand Up @@ -96,6 +89,12 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "default"
on_rtd = os.environ.get("READTHEDOCS")
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
15 changes: 15 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: lmoments3
channels:
- conda-forge
dependencies:
- python >=3.9,<3.13
- numpy
- scipy
- black >=24.8.0
- blackdoc >=0.3.9
- python-build >=1.0
- flake8 >=7.0.0
- pydocstyle >=6.3.0
- sphinx >=6.0.0
- sphinx-rtd-theme >=1.0
- wheel >=0.42.0
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ dependencies = [

[project.optional-dependencies]
dev = [
"black",
"blackdoc",
"build",
"flake8",
"pydocstyle",
"sphinx",
"sphinx-rtd-theme>=1.0",
"wheel"
"black >=24.8.0",
"blackdoc >=0.3.9",
"build >=1.0",
"flake8 >=7.0.0",
"pydocstyle >=6.3.0",
"sphinx >=6.0.0",
"sphinx-rtd-theme >=1.0",
"wheel >=0.42.0"
]

[project.urls]
Expand Down