Skip to content

Commit d7afdeb

Browse files
authored
merge main into branch to overcome downgrades aren't supported error (#89)
2 parents e7decaf + f6a7685 commit d7afdeb

File tree

6 files changed

+34
-20
lines changed

6 files changed

+34
-20
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@
4242
// Mount the parent as /workspaces so we can pip install peers as editable
4343
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
4444
// After the container is created, install the python project in editable form
45-
"postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]'"
45+
"postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install"
4646
}

docs/how-to/make-release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
To make a new release, please follow this checklist:
44

5-
- Ensure that you have previously followed `./pypi`
5+
- Ensure that you have previously followed [](./pypi)
66
- Choose a new PEP440 compliant release number (see <https://peps.python.org/pep-0440/>)
77
- Go to the GitHub [release] page
88
- Choose `Draft New Release`

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2", "wheel"]
2+
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2"]
33
build-backend = "setuptools.build_meta"
44

55
[project]

template/README.md.jinja

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ how it does it, and why people should use it.
1111
Source | <{{repo_url}}>
1212
:---: | :---:
1313
PyPI | `pip install {{pypi_name}}`
14-
Documentation | <{{docs_url}}>
14+
{% if sphinx %}Documentation | <{{docs_url}}>{% endif %}
1515
Releases | <{{repo_url}}/releases>
1616

1717
This is where you should put some images or code snippets that illustrate
@@ -29,7 +29,8 @@ Or if it is a commandline tool then you might put some example commands here:
2929
```
3030
python -m {{package_name}} --version
3131
```
32-
32+
{% if sphinx %}
3333
<!-- README only content. Anything below this line won't be included in index.md -->
3434

3535
See {{docs_url}} for more detailed documentation.
36+
{% endif %}

template/pyproject.toml.jinja

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2", "wheel"]
2+
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -17,7 +17,7 @@ description = "{{ description }}"
1717
dependencies = [] # Add project dependencies here, e.g. ["click", "numpy"]
1818
dynamic = ["version"]
1919
license.file = "LICENSE"
20-
readme = "README.rst"
20+
readme = "README.md"
2121
requires-python = ">=3.7"
2222

2323
[project.optional-dependencies]
@@ -58,7 +58,7 @@ reportMissingImports = false # Ignore missing stubs in imported modules
5858
[tool.pytest.ini_options]
5959
# Run pytest with all our checkers, and don't spam us with massive tracebacks on error
6060
addopts = """
61-
--tb=native -vv --doctest-modules --doctest-glob="*.rst"
61+
--tb=native -vv{% if sphinx %} --doctest-modules --doctest-glob="*.rst"{% endif %}
6262
"""
6363
# https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings
6464
filterwarnings = "error"
@@ -79,22 +79,22 @@ legacy_tox_ini = """
7979
[tox]
8080
skipsdist=True
8181

82-
[testenv:{pre-commit,pyright,pytest,docs}]
82+
[testenv:{pre-commit,pyright,pytest{% if sphinx %},docs{% endif %}}]
8383
# Don't create a virtualenv for the command, requires tox-direct plugin
8484
direct = True
8585
passenv = *
8686
allowlist_externals =
8787
pytest
8888
pre-commit
8989
pyright
90-
sphinx-build
90+
{% if sphinx %} sphinx-build
9191
sphinx-autobuild
92-
commands =
92+
{% endif %}commands =
9393
pytest: pytest --cov={{ package_name }} --cov-report term --cov-report xml:cov.xml {posargs}
9494
pyright: pyright src tests {posargs}
9595
pre-commit: pre-commit run --all-files {posargs}
96-
docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html
97-
"""
96+
{% if sphinx %} docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html
97+
{% endif %}"""
9898

9999
[tool.ruff]
100100
src = ["src", "tests"]

tests/test_example.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,27 @@ def run_pipe(cmd: str, cwd=None):
3636
return output
3737

3838

39-
def test_template(tmp_path: Path):
40-
project_path = tmp_path / "project"
41-
venv_path = tmp_path / "venv"
42-
copy_project(project_path)
39+
def make_venv(project_path: Path) -> callable:
40+
venv_path = project_path / "venv"
41+
run_pipe(f"python -m venv {venv_path}")
4342
run = functools.partial(run_pipe, cwd=str(project_path))
44-
run(f"python -m venv {venv_path}")
45-
run(f"{venv_path}/bin/python -m pip install -e .[dev]")
46-
run(f"{venv_path}/bin/tox -p")
43+
run("./venv/bin/pip install -e .[dev]")
44+
return run
45+
46+
47+
def test_template(tmp_path: Path):
48+
copy_project(tmp_path)
49+
run = make_venv(tmp_path)
50+
run("./venv/bin/tox -p")
51+
run("./venv/bin/pip install build twine")
52+
run("./venv/bin/python -m build")
53+
run("./venv/bin/twine check --strict dist/*")
54+
55+
56+
def test_template_no_docs(tmp_path: Path):
57+
copy_project(tmp_path, docs_type="README")
58+
run = make_venv(tmp_path)
59+
run("./venv/bin/tox -p")
4760

4861

4962
def test_bad_repo_name(tmp_path: Path):

0 commit comments

Comments
 (0)