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

fast-forward cookiecutter, add mamba workaround #262

Merged
merged 3 commits into from
Oct 1, 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
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/Ouranosinc/cookiecutter-pypackage",
"commit": "b9dc57245a77dd3c465a444d4943884ee92157ea",
"commit": "1d9ee5f08d3e8e4f78a4aabb75e2ce4eff8750bf",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
18 changes: 15 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: github-actions
directory: /.github/workflows/
directory: /.github/workflows
schedule:
interval: monthly
open-pull-requests-limit: 10
groups:
actions:
patterns:
- "*"

- package-ecosystem: pip
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 10
groups:
ci:
patterns:
- "CI/*"
python:
patterns:
- "pyproject.toml"
41 changes: 23 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install CI libraries
run: |
python -m pip install --require-hashes -r CI/requirements_ci.txt
Expand All @@ -48,16 +49,18 @@ jobs:
python -m tox -e lint

test-pypi:
name: Test with Python${{ matrix.python-version }} (tox)
name: Test with Python${{ matrix.python-version }} (tox, ${{ matrix.os }})
needs: lint
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
# - "3.13"
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
Expand All @@ -69,13 +72,19 @@ jobs:
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install GDAL
run: |
sudo apt-get update
sudo apt-get install -y libgdal-dev
- name: Install CI libraries
run: |
python -m pip install --require-hashes -r CI/requirements_ci.txt
- name: Environment Caching
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: .tox
key: ${{ matrix.os }}-Python${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}
- name: Test with tox
run: tox
env:
Expand All @@ -85,11 +94,12 @@ jobs:
COVERALLS_SERVICE_NAME: github

test-conda:
name: Test with Python${{ matrix.python-version }} (Anaconda)
name: Test with Python${{ matrix.python-version }} (Anaconda, ${{ matrix.os }})
needs: lint
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version:
- "3.9"
- "3.12"
Expand All @@ -110,6 +120,7 @@ jobs:
environment-file: environment-dev.yml
create-args: >-
python=${{ matrix.python-version }}
micromamba-version: "1.5.10-0" # pinned to avoid the breaking changes with mamba and micromamba (2.0.0).
- name: Micromamba version
run: |
echo "micromamba $(micromamba --version)"
Expand Down Expand Up @@ -137,19 +148,13 @@ jobs:
- test-pypi
- test-conda
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
sparse-checkout: |
CI/requirements_ci.txt
- name: Install CI libraries
run: |
python -m pip install --require-hashes -r CI/requirements_ci.txt
- name: Coveralls finished
run: |
python -m coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
disable-sudo: true
egress-policy: audit
- name: Coveralls Finished
uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 # v2.3.0
with:
parallel-finished: true
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ repos:
rev: v0.3.9
hooks:
- id: blackdoc
additional_dependencies: [ 'black==24.4.2' ]
additional_dependencies: [ 'black==24.8.0' ]
- id: blackdoc-autoupdate-black
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Internal changes
* CI configurations have been updated to use hashed commits for PyPI-sourced dependencies.
* `flake8-alphabetize` has been replaced with `ruff` for some linting checks.
* Updated the notebook coding conventions to adapt to changes in `xclim-testdata`. (:pull:`246`).
* Workflows now make better use of caching to speed up the CI testing process. (:pull:`262`).

Bug fixes
^^^^^^^^^
Expand Down
6 changes: 2 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = [".rst"]
# You can specify multiple suffix as a dictionary of suffix: filetype
source_suffix = {'.rst': 'restructuredtext'}

# The master toctree document.
master_doc = "index"
Expand Down
10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
# "Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython"
]
dynamic = ["description", "version"]
Expand All @@ -53,13 +54,13 @@ dependencies = [
dev = [
# Dev tools and testing
"pip >=24.2.0",
"bump-my-version >=0.25.1",
"bump-my-version >=0.26.0",
"watchdog >=4.0.0",
"flake8 >=7.1.0",
"flake8-alphabetize >=0.0.21",
"flake8-rst-docstrings >=0.3.0",
"flit >=3.9.0,<4.0",
"tox >=4.17.1",
"tox >=4.18.0",
"coverage >=7.5.0",
"coveralls >=4.0.1",
"mypy",
Expand Down Expand Up @@ -107,7 +108,8 @@ target-version = [
"py39",
"py310",
"py311",
"py312"
"py312",
"py313"
]

[tool.bumpversion]
Expand Down Expand Up @@ -228,7 +230,7 @@ py_version = 39

[tool.mypy]
files = "."
python_version = 3.9
python_version = 3.8
show_error_codes = true
strict = true
warn_no_return = true
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tox]
min_version = 4.17.1
min_version = 4.18.0
envlist =
lint
py{39,310,311,312}
py{39,310,311,312,313}
docs
coveralls
requires =
Expand All @@ -17,6 +17,7 @@ python =
3.10 = py310-coveralls
3.11 = py311-coveralls
3.12 = py312-coveralls
3.13 = py313-coveralls

[testenv:lint]
skip_install = True
Expand Down