Skip to content

Commit c30e9a4

Browse files
committed
Remove docs from minimum profile
Introduces a question AddLocalDocumentation to control the existence of the `docs` folder. If the user selects "Online documentation", then "Local documentation" is implied. The logic behind this approach is simply to define the computed variable `AddLocalDocumentation` based on either flag. The downside is that the generated answers will still only show the online flag. Related to #593
1 parent 50d6dd7 commit c30e9a4

9 files changed

Lines changed: 17 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515)
1616
* Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471)
1717
* Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476)
18+
* Make local documentation optional [#593](https://github.com/NLeSC/python-template/pull/593)
1819

1920
### Changed
2021
* Update the user documentation (README.md) of the template [#575](https://github.com/NLeSC/python-template/pull/623)

copier/questions/features_documentation.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ SelectDocumentationFeatures:
77
type: yaml
88
default: |-
99
{% if template_profile == 'recommended' %}
10-
[AddOnlineDocumentation_flag, AddDevDoc_flag]
10+
[AddLocalDocumentation_flag, AddOnlineDocumentation_flag, AddDevDoc_flag]
1111
{%- else -%}
1212
[]
1313
{%- endif %}
1414
help: Select documentation features
1515
multiselect: true
1616
choices:
17+
Local documentation:
18+
value: AddLocalDocumentation_flag
19+
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
1720
Online documentation (Read the Docs):
1821
value: AddOnlineDocumentation_flag
1922
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
@@ -22,6 +25,10 @@ SelectDocumentationFeatures:
2225
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
2326

2427
# computed features
28+
AddLocalDocumentation:
29+
type: bool
30+
default: "{{ 'AddLocalDocumentation_flag' in SelectDocumentationFeatures or 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures }}"
31+
when: false
2532
AddOnlineDocumentation:
2633
type: bool
2734
default: "{{ 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures }}"

template/project_setup.md.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ help you decide which tool to use for packaging.
4848
- Workflows can be found in [`.github/workflows`](.github/workflows/)
4949
- [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=testing)
5050

51+
{% if AddLocalDocumentation -%}
5152
## Documentation
5253

5354
- Documentation should be put in the [`docs/`](docs/) directory. The contents have been generated using `sphinx-quickstart` (Sphinx version 1.6.5).
@@ -59,6 +60,7 @@ help you decide which tool to use for packaging.
5960
- [AutoAPI](https://sphinx-autoapi.readthedocs.io/) is used to generate documentation for the package Python objects.
6061
{% if AddOnlineDocumentation %}- `.readthedocs.yaml` is the ReadTheDocs configuration file. When ReadTheDocs is building the documentation this package and its development dependencies are installed so the API reference can be rendered.{% endif -%}
6162
- [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=writingdocumentation)
63+
{%- endif %}
6264

6365
## Coding style conventions and code quality
6466

template/pyproject.toml.jinja

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ dev = [
5555
"tox",
5656
"myst_parser",
5757
]
58+
{%- if AddLocalDocumentation %}
5859
docs = [
5960
"sphinx",
6061
"sphinx_rtd_theme",
6162
"sphinx-autoapi",
6263
"myst_parser",
6364
]
65+
{%- endif %}
6466
publishing = [
6567
"build",
6668
"twine",
@@ -97,7 +99,9 @@ extras = dev
9799
[tool.ruff]
98100
line-length = 120
99101
output-format = "concise"
102+
{%- if AddLocalDocumentation %}
100103
extend-exclude = ["docs"]
104+
{%- endif %}
101105

102106
[tool.ruff.lint]
103107
# Allow unused variables when underscore-prefixed.
@@ -149,5 +153,7 @@ filename = "pyproject.toml"
149153
filename = "CITATION.cff"
150154
{%- endif %}
151155

156+
{% if AddLocalDocumentation -%}
152157
[[tool.bumpversion.files]]
153158
filename = "docs/conf.py"
159+
{%- endif %}

template/docs/Makefile.jinja renamed to template/{% if AddLocalDocumentation %}docs{% endif %}/Makefile.jinja

File renamed without changes.

template/docs/_templates/.gitignore renamed to template/{% if AddLocalDocumentation %}docs{% endif %}/_templates/.gitignore

File renamed without changes.

template/docs/conf.py.jinja renamed to template/{% if AddLocalDocumentation %}docs{% endif %}/conf.py.jinja

File renamed without changes.

template/docs/index.rst.jinja renamed to template/{% if AddLocalDocumentation %}docs{% endif %}/index.rst.jinja

File renamed without changes.

template/docs/make.bat.jinja renamed to template/{% if AddLocalDocumentation %}docs{% endif %}/make.bat.jinja

File renamed without changes.

0 commit comments

Comments
 (0)