Skip to content

Commit f16e115

Browse files
authored
Update infrastructure. (#41)
1 parent 7a1c71b commit f16e115

15 files changed

+140
-131
lines changed

.github/workflows/main.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ concurrency:
55
group: ${{ github.head_ref || github.run_id }}
66
cancel-in-progress: true
77

8-
env:
9-
CONDA_EXE: mamba
10-
118
on:
129
push:
1310
branches:
@@ -43,6 +40,4 @@ jobs:
4340
run: tox -e test -- --cov=./ --cov-report=xml
4441

4542
- name: Upload coverage reports of tests.
46-
if: runner.os == 'Linux' && matrix.python-version == '3.10'
47-
shell: bash -l {0}
48-
run: bash <(curl -s https://codecov.io/bash)
43+
uses: codecov/codecov-action@v4

codecov.yml

-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ coverage:
2424

2525
ignore:
2626
- ".tox/**/*"
27-
- "setup.py"

docs/source/changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ them in reverse chronological order.
66
## 1.7.0 - 2024-xx-xx
77

88
- {pull}`39` updates the pre-commit hooks.
9+
- {pull}`41` updates the infrastructure.
910

1011
## 1.6.0 - 2023-11-23
1112

{{cookiecutter.project_slug}}/.github/dependabot.yml

+5
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "weekly"
8+
9+
groups:
10+
github-actions:
11+
patterns:
12+
- "*"

{{cookiecutter.project_slug}}/.github/workflows/main.yml

+5-27
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
3131

3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434
- uses: mamba-org/provision-with-micromamba@main
3535
with:
3636
environment-file: false
@@ -42,31 +42,9 @@ jobs:
4242
tox-conda
4343
cache-downloads: true
4444

45-
# Unit, integration, and end-to-end tests.
46-
47-
- name: Run unit tests and doctests.
48-
shell: bash -l {0}
49-
run: tox -e pytest -- src tests -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto
50-
51-
- name: Upload coverage report for unit tests and doctests.
52-
if: runner.os == 'Linux' && matrix.python-version == '3.10'
53-
shell: bash -l {0}
54-
run: bash <(curl -s https://codecov.io/bash) -F unit -c
55-
56-
- name: Run integration tests.
45+
- name: Run tests and doctests.
5746
shell: bash -l {0}
58-
run: tox -e pytest -- src tests -m integration --cov=./ --cov-report=xml -n auto
47+
run: tox -e pytest
5948

60-
- name: Upload coverage reports of integration tests.
61-
if: runner.os == 'Linux' && matrix.python-version == '3.10'
62-
shell: bash -l {0}
63-
run: bash <(curl -s https://codecov.io/bash) -F integration -c
64-
65-
- name: Run end-to-end tests.
66-
shell: bash -l {0}
67-
run: tox -e pytest -- src tests -m end_to_end --cov=./ --cov-report=xml -n auto
68-
69-
- name: Upload coverage reports of end-to-end tests.
70-
if: runner.os == 'Linux' && matrix.python-version == '3.10'
71-
shell: bash -l {0}
72-
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c
49+
- name: Upload coverage report
50+
uses: codecov/codecov-action@v4

{{cookiecutter.project_slug}}/.pre-commit-config.yaml

+3-7
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,17 @@ repos:
2424
- id: python-no-log-warn
2525
- id: python-use-type-annotations
2626
- id: text-unicode-replacement-char
27-
- repo: https://github.com/asottile/setup-cfg-fmt
28-
rev: v2.2.0
29-
hooks:
30-
- id: setup-cfg-fmt
3127
- repo: https://github.com/aio-libs/sort-all
3228
rev: v1.2.0
3329
hooks:
3430
- id: sort-all
3531
- repo: https://github.com/charliermarsh/ruff-pre-commit
36-
rev: v0.1.6
32+
rev: v0.3.2
3733
hooks:
3834
- id: ruff
3935
- id: ruff-format
4036
{% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/dosisod/refurb
41-
rev: v1.24.0
37+
rev: v2.0.0
4238
hooks:
4339
- id: refurb
4440
{% endif %}
@@ -63,7 +59,7 @@ repos:
6359
args: [--wrap, "88"]
6460
files: (docs/.)
6561
{% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy
66-
rev: 'v1.7.0'
62+
rev: 'v1.9.0'
6763
hooks:
6864
- id: mypy
6965
args: [
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
version: 2
22

33
build:
4-
image: latest
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.10"
57

6-
python:
7-
version: 3.10
8+
sphinx:
9+
configuration: docs/source/conf.py
10+
fail_on_warning: true
811

9-
conda:
10-
environment: docs/docs_environment.yml
12+
python:
13+
install:
14+
- method: pip
15+
path: .
16+
extra_requirements:
17+
- docs

{{cookiecutter.project_slug}}/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}) {% endif %}
1515
cookiecutter.github_username }}/{{ cookiecutter.project_slug
1616
}}/main.svg)](https://results.pre-commit.ci/latest/github/{{
1717
cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/main)
18-
[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
18+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1919

2020
## Usage
2121

2222
To get started, create the environment with
2323

2424
```console
25-
$ conda/mamba env create
25+
$ mamba env create
2626
```
2727

2828
To build the project, type
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
codecov:
2+
branch: main
3+
4+
coverage:
5+
precision: 2
6+
round: down
7+
range: 80...100
8+
status:
9+
project:
10+
default:
11+
threshold: 1%
12+
unit:
13+
threshold: 1%
14+
flags:
15+
- unit
16+
integration:
17+
threshold: 1%
18+
flags:
19+
- integration
20+
end_to_end:
21+
threshold: 1%
22+
flags:
23+
- end_to_end
24+
25+
ignore:
26+
- ".tox/**/*"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
9+
groups:
10+
github-actions:
11+
patterns:
12+
- "*"

{{cookiecutter.project_slug}}/docs/docs_environment.yml

-22
This file was deleted.

{{cookiecutter.project_slug}}/environment.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- conda-lock
1515

1616
# Package dependencies
17-
- pytask >=0.2
17+
- pytask >=0.4
1818

1919
# Misc
2020
- black
@@ -34,5 +34,5 @@ dependencies:
3434
- sphinx-panels
3535

3636
- pip:
37-
- -e .
3837
- sphinxext-opengraph
38+
- -e .

{{cookiecutter.project_slug}}/pyproject.toml

+61-12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,66 @@ requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
44
[tool.setuptools_scm]
55
write_to = "src/{{ cookiecutter.project_slug }}/_version.py"
66

7+
[project]
8+
name = "{{ cookiecutter.project_slug }}"
9+
description = "{{ cookiecutter.project_description }}"
10+
requires-python = ">=3.8"
11+
classifiers = [
12+
"Intended Audience :: Science/Research",
13+
"License :: OSI Approved :: {{ cookiecutter.open_source_license }} License",
14+
"Operating System :: MacOS :: MacOS X",
15+
"Operating System :: Microsoft :: Windows",
16+
"Operating System :: POSIX",
17+
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3 :: Only",
19+
]
20+
dynamic = ["version"]
21+
dependencies = ["pytask"]
22+
23+
[project.readme]
24+
file = "README.md"
25+
content-type = "text/markdown"
26+
27+
[project.license]
28+
text = "{{ cookiecutter.open_source_license }}"
29+
30+
[[project.authors]]
31+
name = "{{ cookiecutter.author }}"
32+
email = "{{ cookiecutter.email }}"
33+
34+
[project.optional-dependencies]
35+
docs = [
36+
"furo",
37+
"ipython",
38+
"myst-parser",
39+
"nbsphinx",
40+
"sphinx",
41+
"sphinx-copybutton",
42+
"sphinx-design>=0.3",
43+
"sphinx-toolbox",
44+
"sphinxext-opengraph",
45+
]
46+
test = []
47+
48+
[project.urls]
49+
Changelog = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}"
50+
Documentation = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}"
51+
Github = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}"
52+
Tracker = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/issues"
53+
54+
[tool.setuptools]
55+
include-package-data = true
56+
zip-safe = false
57+
platforms = ["unix", "linux", "osx", "win32"]
58+
license-files = ["LICENSE"]
59+
60+
[tool.setuptools.package-dir]
61+
"" = "src"
62+
63+
[tool.setuptools.packages.find]
64+
where = ["src"]
65+
namespaces = false
66+
767
{% if cookiecutter.add_mypy == "yes" %}[tool.mypy]
868
files = ["src", "tests"]
969
check_untyped_defs = true
@@ -46,16 +106,5 @@ convention = "numpy"
46106

47107
[tool.pytest.ini_options]
48108
addopts = ["--doctest-modules"]
49-
testpaths = ["tests"]
50-
filterwarnings = [
51-
"ignore: the imp module is deprecated in favour of importlib",
52-
"ignore: Using or importing the ABCs from 'collections' instead of from",
53-
"ignore: The (parser|symbol) module is deprecated and will be removed in future",
54-
]
55-
markers = [
56-
"wip: Tests that are work-in-progress.",
57-
"unit: Flag for unit tests which target mainly a single function.",
58-
"integration: Flag for integration tests which may comprise of multiple unit tests.",
59-
"end_to_end: Flag for tests that cover the whole program.",
60-
]
109+
testpaths = ["src", "tests"]
61110
norecursedirs = [".idea", ".tox"]

{{cookiecutter.project_slug}}/setup.cfg

-41
This file was deleted.

{{cookiecutter.project_slug}}/tox.ini

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[tox]
2-
envlist = pytest, sphinx
2+
requires = tox>=4
3+
envlist = docs, test
34

45
[testenv]
5-
usedevelop = true
6+
package = editable
67

7-
[testenv:pytest]
8+
[testenv:test]
89
conda_channels =
910
conda-forge
1011
nodefaults
@@ -14,8 +15,11 @@ conda_deps =
1415
pytest-cov
1516
pytest-xdist
1617

17-
# Package dependencies
18-
pytask
19-
2018
commands =
2119
pytest {posargs}
20+
21+
[testenv:docs]
22+
extras = docs, test
23+
commands =
24+
- sphinx-build -n -T -b html -d {envtmpdir}/doctrees docs/source docs/build/html
25+
- sphinx-build -n -T -b doctest -d {envtmpdir}/doctrees docs/source docs/build/html

0 commit comments

Comments
 (0)