Skip to content

Commit

Permalink
Merge pull request #22 from astrojuanlu/modernise-template
Browse files Browse the repository at this point in the history
Modernise template
  • Loading branch information
astrojuanlu authored Feb 18, 2024
2 parents 5fbc367 + 644d966 commit f29054d
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: check-merge-conflict

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.2.2
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand Down
2 changes: 1 addition & 1 deletion template/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: check-merge-conflict

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.2.2
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand Down
4 changes: 2 additions & 2 deletions template/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
version: 2

build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.8"

sphinx:
fail_on_warning: true
Expand Down
19 changes: 10 additions & 9 deletions template/CONTRIBUTING.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ make sure that you **read our code of conduct** (`CODE_OF_CONDUCT.md`).

## Contributing code

1. Set up a Python development environment
1. Clone the repository
2. Set up and activate a Python development environment
(advice: use [venv](https://docs.python.org/3/library/venv.html),
[virtualenv](https://virtualenv.pypa.io/), or [miniconda](https://docs.conda.io/en/latest/miniconda.html))
2. Install tox: `python -m pip install tox`
3. Clone the repository
4. Start a new branch off master: `git switch -c new-branch master`
5. Make your code changes
6. Check that your code follows the style guidelines of the project: `tox -e reformat && tox -e check`
7. (optional) Build the documentation: `tox -e docs`
8. (optional) Run the tests: `tox -e py39`
3. Install tox: `python -m pip install tox`
4. Make sure the tests run: `tox -e py38`
(change the version number according to the Python you are using)
9. Commit, push, and open a pull request!
5. Start a new branch: `git switch -c new-branch main`
6. Make your code changes
7. Check that your code follows the style guidelines of the project: `tox -e reformat && tox -e check`
8. Run the tests again and verify that they pass: `tox -e py38`
9. (optional) Build the documentation: `tox -e docs`
10. Commit, push, and open a pull request!
20 changes: 0 additions & 20 deletions template/docs/Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion template/docs/source/conf.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _metadata = metadata("{{ project_name }}")

project = _metadata["Name"]
author = _metadata["Author-email"].split("<", 1)[0].strip()
copyright = f"2022, {author}"
copyright = f"2024, {author}"

version = _metadata["Version"]
release = ".".join(version.split(".")[:2])
Expand Down
2 changes: 1 addition & 1 deletion template/pyproject.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ source = "scm"
convention = "numpy"

[tool.mypy]
python_version = "3.7"
python_version = "3.8"
warn_redundant_casts = true
warn_unused_configs = true
pretty = true
Expand Down
4 changes: 3 additions & 1 deletion template/tests/test_import.py.j2
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
import {{package_name}}
def test_import():
# Dummy test that does the bare minimum, remove when done!
import {{package_name}}
21 changes: 9 additions & 12 deletions template/tox.ini.j2
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
[tox]
envlist =
env_list =
check
docs
{py37,py38,py39,py310,pypy3}{,-coverage}
# See https://tox.readthedocs.io/en/latest/example/package.html#flit
isolated_build = True
isolated_build_env = build
{py3}{,-coverage}

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: check, py39
3.8: check, py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
basepython =
pypy3: pypy3
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
# See https://github.com/tox-dev/tox/issues/1548
{check,docs,build}: python3
py311: python3.11
py312: python3.12
{check,docs}: python3
setenv =
PYTHONUNBUFFERED = yes
PYTEST_EXTRA_ARGS = -s
Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist =
env_list =
check
{py38,py39,py310,py311,py312,pypy3}
skipsdist = True
Expand All @@ -20,8 +20,7 @@ basepython =
py310: python3.10
py311: python3.11
py312: python3.12
# See https://github.com/tox-dev/tox/issues/1548
{check,build}: python3
check: python3
setenv =
PYTHONUNBUFFERED = yes
PYTEST_EXTRA_ARGS = -s
Expand Down

0 comments on commit f29054d

Please sign in to comment.