Skip to content

Commit b11e31c

Browse files
authored
bug: ensure sphinx build works as expected (pyOpenSci#130)
* bug: ensure sphinx build works * add: changelog * fix: cleanup include * fix: versions
1 parent 82d79e7 commit b11e31c

File tree

7 files changed

+47
-39
lines changed

7 files changed

+47
-39
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# pyOpenSci packaging template Changelog
22

33
## [Unreleased]
4+
* Fix RTD build for sphinx and move to optional.dependencies for docs (@lwasser, #126)
5+
6+
## [0.6.0]
7+
8+
### Added
49

510
* Update release workflow to follow PyPA / PyPI recommended practices (@lwasser, #48)
11+
* development instructions for hatch envt by @lwasser in #115
12+
* uv by @lwasser in #116

DEVELOPMENT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Development Guide
22

3-
If you are working on development locally and on the main branch, you can run the template
4-
using the following command:
3+
If you are working on development locally and on the main branch, you can run
4+
the template using the following command:
55

66
`copier copy . dirnam_here`
77

88
If you have made local changes to the template, you will see a warning
99
telling you that the template's current version control state is "dirty".
10-
This means that you have changed things and they aren't committed to
11-
version control, yet.
10+
This means that you have changed things and they aren't committed to
11+
version control yet.
1212

1313
```console
1414
/your/path/python3.12/site-packages/copier/vcs.py:201: DirtyLocalWarning: Dirty template changes included automatically.

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,17 @@ Copying from template version 0.6.4.1
123123
```
124124

125125
Once you have created your package, you can install it in editable mode using
126-
pip.
126+
pip or uv.
127127

128-
First, CD to the directory where your new package lives and install the package in editable mode:
128+
### For UV users
129+
```console
130+
$ cd my_directory
131+
$ uv sync # Run uv sync to create a venv and install your dependencies
132+
$ UV run python # Open a python prompt using the UV managed environment
133+
134+
### For pip users
135+
136+
First, CD to the directory where your new package lives, and install the package in editable mode:
129137

130138
```console
131139
$ cd my_directory

includes/pyproject/deps-pep-621.toml.jinja

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
{% if documentation == "mkdocs" -%}
2-
docs = [
3-
"mkdocs-material ~=9.5",
4-
"mkdocstrings[python] ~=0.24",
5-
"mkdocs-awesome-pages-plugin ~=2.9",
6-
]
7-
{% elif documentation == "sphinx" -%}
8-
docs = [
9-
"pydata_sphinx_theme ~=0.16",
10-
"myst-parser ~=4.0",
11-
"Sphinx ~=8.0",
12-
"sphinx-autobuild ==2024.10.3"
13-
]
14-
{% endif %}
151
{%- if use_test -%}
162
tests = [
173
"pytest",

template/pyproject.toml.jinja

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ dev = [
8282
audit]",
8383
{%- endif %}
8484
]
85+
86+
docs = [
87+
{%- if documentation == "sphinx" %}
88+
"sphinx~=8.0",
89+
"myst-parser>=4.0",
90+
"pydata-sphinx-theme~=0.16",
91+
"sphinx-autobuild>=2024.10.3",
92+
"sphinx-autoapi>=3.6.0",
93+
"sphinx-design>=0.6.1",
94+
"sphinx-copybutton>=0.5.2",
95+
{%- elif documentation == "mkdocs" %}
96+
"mkdocs-material ~=9.5",
97+
"mkdocstrings[python] ~=0.24",
98+
"mkdocs-awesome-pages-plugin ~=2.9",
99+
{% endif %}
100+
]
101+
85102
{%- if not use_hatch_envs %}
86103
{% include pathjoin('includes', 'pyproject', 'deps-pep-621.toml.jinja') %}
87104
{%- endif %}
@@ -271,21 +288,10 @@ run = "pytest {args:--cov={{ package_name }} --cov-report=term-missing}"
271288
# This sets up a hatch environment with associated dependencies that need to be installed
272289
[tool.hatch.envs.docs]
273290
description = """Build or serve the documentation."""
274-
{%- if documentation == "mkdocs" %}
275-
extra-dependencies = [
276-
"mkdocs-material ~=9.5",
277-
"mkdocstrings[python] ~=0.24",
278-
"mkdocs-awesome-pages-plugin ~=2.9",
279-
]
280-
{%- elif documentation == "sphinx" %}
281-
python = "3.10"
282-
dependencies = [
283-
"pydata_sphinx_theme ~=0.16",
284-
"myst-parser ~=4.0",
285-
"Sphinx ~=8.0",
286-
"sphinx-autobuild ==2024.10.3"
291+
# Install optional dependency test for docs
292+
features = [
293+
"docs",
287294
]
288-
{%- endif %}
289295

290296
# This table contains the scripts that you can use to build and serve your docs
291297
# hatch run docs:build will build your documentation

template/{% if documentation == 'sphinx' %}docs{% endif %}/_static/.gitkeep

Whitespace-only changes.

template/{% if use_rtd %}.readthedocs.yaml{% endif %}.jinja

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ build:
77
tools:
88
python: "3.12"
99
commands:
10-
- pip install --upgrade pip setuptools wheel
11-
- pip install hatch
12-
{%- if documentation == "mkdocs" %}
10+
- pip install --upgrade pip
11+
- pip install -e '.[docs]'
12+
{%- if documentation == "sphinx" %}
13+
# Make sure RTD can find the html output
14+
- sphinx-build -b html docs $READTHEDOCS_OUTPUT/html
15+
{%- elif documentation == "mkdocs" %}
1316
- hatch run docs:build -- --strict --site-dir "${READTHEDOCS_OUTPUT}/html"
1417

1518
mkdocs:
1619
configuration: mkdocs.yml
17-
{%- elif documentation == "sphinx" %}
18-
- hatch run docs:build
1920
{%- endif %}

0 commit comments

Comments
 (0)