Skip to content

Commit

Permalink
Stop polluting dev env with docs deps
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Jan 14, 2024
1 parent 0c81d1d commit 19945fd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
22 changes: 13 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ $ git clone https://github.com/YOU/service-identity.git
> Yes, you can work on `main` in your fork and submit pull requests.
> But this will *inevitably* lead to you not being able to synchronize your fork with upstream and having to start over.
Change into the newly created directory and after activating a virtual environment, install an editable version of *service-identity* along with its tests and docs requirements:
Change into the newly created directory and after activating a virtual environment, install an editable version of *service-identity* along with its tests requirements:

```console
$ cd service-identity
Expand All @@ -79,13 +79,21 @@ At this point,
$ python -Im pytest
```

should work and pass, as should:
When working on the documentation, use:

```console
$ cd docs
$ make html
$ tox run -e docs-watch
```

... to watch your files and automatically rebuild when a file changes.
And use:

```console
$ tox run -e docs
```

... to build it once and run our doctests.

The built documentation can then be found in `docs/_build/html/`.

---
Expand All @@ -102,7 +110,6 @@ This is not strictly necessary, because our [*tox*] file contains an environment
$ pre-commit run --all-files
```

and our CI has integration with [pre-commit.ci](https://pre-commit.ci).
But it's way more comfortable to run it locally and catch avoidable errors before pushing them to GitHub.


Expand Down Expand Up @@ -149,9 +156,6 @@ But it's way more comfortable to run it locally and catch avoidable errors befor

- To run the test suite, all you need is a recent [*tox*].
It will ensure the test suite runs with all dependencies against all Python versions just as it will in our [CI].
If you lack some Python versions, you can can always limit the environments like `tox -e py38,py39`, or make it a non-failure using `tox --skip-missing-interpreters`.

In that case you should look into [*asdf*](https://asdf-vm.com) or [*pyenv*](https://github.com/pyenv/pyenv), which make it very easy to install many different Python versions in parallel.
- Write [good test docstrings](https://jml.io/pages/test-docstrings.html).
- If you've changed or added public APIs, please update our type stubs (files ending in `.pyi`).

Expand All @@ -175,7 +179,7 @@ But it's way more comfortable to run it locally and catch avoidable errors befor

## Header of New Top Section

### Header of New Section
### Header of New Section

First line of new section.
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ idna = ["idna"]
tests = ["coverage[toml]>=5.0.2", "pytest"]
docs = ["sphinx", "furo", "myst-parser", "sphinx-notfound-page", "pyOpenSSL"]
mypy = ["mypy", "types-pyOpenSSL", "idna"]
dev = ["service-identity[tests,mypy,docs,idna]", "pyOpenSSL"]
dev = ["service-identity[tests,mypy,idna]", "pyOpenSSL"]

[project.urls]
Documentation = "https://service-identity.readthedocs.io/"
Expand Down
23 changes: 14 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ commands =
py312-pyopenssl-latest-idna: coverage run -m pytest --doctest-modules --doctest-glob='*.rst' {posargs}


[testenv:coverage-report]
# keep in-sync with .python-version-default
base_python = py312
deps = coverage[toml]>=5.0.2
skip_install = true
commands =
coverage combine
coverage report


[testenv:lint]
skip_install = true
deps = pre-commit
Expand Down Expand Up @@ -64,12 +74,7 @@ commands =
src \
docs


[testenv:coverage-report]
# keep in-sync with .python-version-default
base_python = py312
deps = coverage[toml]>=5.0.2
skip_install = true
commands =
coverage combine
coverage report
[testenv:docs-linkcheck]
base_python = {[testenv:docs]base_python}
extras = {[testenv:docs]extras}
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html

0 comments on commit 19945fd

Please sign in to comment.