Skip to content
Merged
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: 1 addition & 2 deletions {{cookiecutter.package_name}}/examples/quickstart.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Quickstart example

This example script imports the {{cookiecutter.package_name}} package and prints out
the version.
This example script imports our package and prints out the version.
"""

import logging
Expand Down
34 changes: 23 additions & 11 deletions {{cookiecutter.package_name}}/scripts/cleanup_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,28 @@
import shutil
from pathlib import Path

paths = [
"docs/build",
"docs/source/api/modules.rst",
"docs/source/api/{{cookiecutter.package_name}}*.rst",
_LITERAL_PATHS = [
Path("docs/build"),
Path("docs/source/api/modules.rst"),
]
_GLOB_PATTERNS = [
("docs/source/api", "reposcan*.rst"),
]


def clean() -> None:
"""Delete build artefacts and generated API documentation files."""
for path in _LITERAL_PATHS:
if path.exists():
if path.is_dir():
shutil.rmtree(path)
else:
path.unlink()

for parent_str, pattern in _GLOB_PATTERNS:
for match in Path(parent_str).glob(pattern):
match.unlink()


for path in paths:
p = Path(path)
if p.exists():
if p.is_dir():
shutil.rmtree(p)
else:
p.unlink()
if __name__ == "__main__":
clean()
4 changes: 1 addition & 3 deletions {{cookiecutter.package_name}}/tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ def run_in_venv(
else:
# Unix-like systems
activate_cmd = f". {VENV_DIR}/bin/activate"
args = shlex.split(
f'sh -c "{activate_cmd} && python {filename}"'
)
args = shlex.split(f'sh -c "{activate_cmd} && python {filename}"')

env: dict[str, str] = {}
if os.environ.get("PATH"):
Expand Down
Loading