Skip to content
Open
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

### Added

- Typing support. [#698](https://github.com/NLeSC/python-template/pull/698)
* Typing support. [#698](https://github.com/NLeSC/python-template/pull/698)

### Changed

* Recommend `ruff format` instead of `yapf` for fixing code style readability [#695](https://github.com/NLeSC/python-template/pull/695)
* Replace optional dependencies with dependency groups in template [#705](https://github.com/NLeSC/python-template/pull/705)

### Removed

Expand Down
16 changes: 8 additions & 8 deletions template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.10"
version = "{{ version }}"

[project.optional-dependencies]
[dependency-groups]
dev = [
"build", # build is not only used in publishing (below), but also in the template's test suite
"bump-my-version",
Expand Down Expand Up @@ -104,16 +104,16 @@ command_line = "-m pytest"
{%- endif %}

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py310,py311,py312
requires = ["tox>=4.22"]
env_list = [ "py310", "py311", "py312" ]
skip_missing_interpreters = true
{% if AddLocalTests -%}
[testenv]
commands = pytest
extras = dev
[tool.box.testenv]
description = "Run test under {base_python}"
commands = [["pytest"]]
[tool.tox.env_run_base]
dependency_groups = [ "dev" ]
{%- endif %}
"""

[tool.ruff]
line-length = 79
Expand Down
4 changes: 2 additions & 2 deletions template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ python -m pip install --upgrade pip setuptools
# install {{ package_name }} as an editable package
python -m pip install --no-cache-dir --editable .
# install development dependencies
python -m pip install --no-cache-dir --editable .[dev]
python -m pip install --no-cache-dir --editable . --group dev
# install documentation dependencies only
python -m pip install --no-cache-dir --editable .[docs]
python -m pip install --no-cache-dir --editable . --group docs
```

Afterwards check that the install directory is present in the `PATH` environment variable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Upgrade pip and install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .[dev,publishing]
python -m pip install . --group dev --group publishing
- name: Run unit tests
run: python -m pytest -v
- name: Verify that we can build the package
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Upgrade pip and install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .[dev,publishing]
python -m pip install . --group dev
- name: Check style against standards using ruff
run: |
ruff check .
Expand All @@ -78,7 +78,7 @@ jobs:
- name: Upgrade pip and install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .[dev]
python -m pip install . --group dev
- name: Run {{ SelectTypeChecker }}
run: |
{{ SelectTypeChecker }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Upgrade pip and install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .[dev,publishing]
python -m pip install . --group dev --group docs
- name: Install pandoc using apt
run: sudo apt install pandoc
- name: Build documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
which python
python --version
- name: Install dependencies
run: python -m pip install .[dev]
run: python -m pip install . --group dev
- name: Run unit tests with coverage
run: python -m pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml tests/
- name: Correct coverage paths
Expand Down
4 changes: 2 additions & 2 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def baked_with_development_dependencies(copie_session, project_env_bin_dir, copi
bin_dir = project_env_bin_dir
latest_pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools'], project_dir)
assert latest_pip_output.returncode == 0
pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--editable', '.[dev]'], project_dir)
pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--editable', '.', '--group', 'dev'], project_dir)
assert pip_output.returncode == 0
return project_dir

Expand All @@ -91,7 +91,7 @@ def test_tox(baked_with_development_dependencies, project_env_bin_dir):
bin_dir = project_env_bin_dir
result = run([f'{bin_dir}tox'], project_dir)
assert result.returncode == 0
assert '== 3 passed in' in result.stdout
assert 'congratulations :)' in result.stdout
# assert (project_dir / '.tox' / 'dist' / 'my_python_package-0.1.0.zip').exists()
assert (project_dir / '.tox' / '.pkg' / 'dist'/ 'my_python_package-0.1.0.tar.gz').exists()

Expand Down