Skip to content

Commit 204a47c

Browse files
authored
Merge pull request #122 from CCPBioSim/121-update-docs-python
Replace `src/` references with flat project structure in documentation
2 parents cd954d0 + 4caa2ef commit 204a47c

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

pages/source/new-software.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,15 @@ Once the repository has been created from the template, a small amount of initia
6767

6868
2. **Rename the Python package**
6969

70-
The directory under `src/` defines the import name of your Python package. This name will be used when importing the package in code and when the project is installed.
70+
The directory under `example_package/` defines the import name of your Python package. This name will be used when importing the package in code and when the project is installed.
7171

72-
- Locate the package directory under `src/`
72+
- Locate the package directory under `example_package/`
7373
- Rename it to match your chosen package name
7474
- Ensure the name is a valid Python identifier (lowercase, underscores allowed)
7575

7676
Example:
7777

78-
src/
79-
your_package_name/
78+
example_package/
8079

8180
3. **Update project metadata**
8281

@@ -155,7 +154,7 @@ This template follows a standard Python project layout designed to support devel
155154
The repository is organized as follows:
156155

157156
docs/
158-
src/example_package_YOUR_USERNAME_HERE/
157+
example_package/
159158
tests/
160159
pyproject.toml
161160
README.md
@@ -166,7 +165,7 @@ The repository is organized as follows:
166165
.gitignore
167166

168167
- `docs/` - Sphinx documentation source
169-
- `src/` - Python source code
168+
- `example_package/` - Python source code
170169
- `tests/` - Unit and integration tests
171170
- `pyproject.toml` - Project metadata and dependencies
172171
- `README.md` / `LICENSE` - Standard project documentation
@@ -179,22 +178,22 @@ The repository is organized as follows:
179178

180179
---
181180

182-
##### Source Code (`src/`)
181+
##### Source Code (`example_package/`)
183182

184-
All Python code lives under `src/`, using the **package name** you specify:
183+
All Python code lives under `example_package/`, using the **package name** you specify:
185184

186-
src/example_package_YOUR_USERNAME_HERE/
185+
example_package/
187186
__init__.py
188187
example.py
189188

190189
- `__init__.py` - Makes the directory a Python package
191190
- `example.py` - Minimal placeholder function included for coverage and testing
192191

193-
> **Tip:** Rename the `example_package_YOUR_USERNAME_HERE` folder to match your project’s package name. Make sure it’s a valid Python identifier (lowercase letters, underscores allowed).
192+
> **Tip:** Rename the `example_project` folder to match your project’s package name. Make sure it’s a valid Python identifier (lowercase letters, underscores allowed).
194193

195194
Example placeholder function:
196195

197-
# src/example_package_YOUR_USERNAME_HERE/example.py
196+
# example_package/example.py
198197

199198
def placeholder():
200199
"""Minimal function to allow coverage and serve as a template."""
@@ -208,7 +207,7 @@ This structure ensures that the package is **importable** and ready for expansio
208207

209208
Unit tests live under the `tests/` directory, mirroring the package structure:
210209

211-
tests/test_example_package_YOUR_USERNAME_HERE/
210+
tests/test_example_project/
212211
__init__.py
213212
conftest.py
214213
test_example.py
@@ -220,13 +219,13 @@ Unit tests live under the `tests/` directory, mirroring the package structure:
220219

221220
Example test:
222221

223-
# tests/test_example_package_YOUR_USERNAME_HERE/test_example.py
222+
# tests/test_example_project/test_example.py
224223

225-
from example_package_YOUR_USERNAME_HERE.example import placeholder
224+
from example_project.example import placeholder
226225

227226
class TestExamplePackage:
228227
"""
229-
Class-based placeholder tests for example_package_YOUR_USERNAME_HERE.
228+
Class-based placeholder tests for example_project.
230229
231230
- Demonstrates using a test class with pytest.
232231
- Can easily be extended with more methods for real tests.
@@ -278,7 +277,7 @@ This setup allows for **automatic API documentation generation** with `sphinx-au
278277

279278
#### Project Name and Package Name
280279

281-
- Rename the folder under `src/` to match your package name.
280+
- Rename the folder under `example_package/` to match your package name.
282281
- Must be a valid Python identifier: lowercase letters and underscores.
283282
- This determines the import name of your package.
284283

@@ -576,12 +575,12 @@ requirements.
576575

577576
##### Required Repository Structure
578577

579-
src/<package_name>/
578+
example_package/
580579
tests/
581580
docs/
582581
.github/
583582

584-
- The folder under `src/` defines the import path
583+
- The folder under `example_package/` defines the import path
585584
- It must be a valid Python identifier
586585
- It must match the package name used throughout the project
587586

@@ -668,7 +667,7 @@ Authentication for these services is handled at the CCPBioSim organisation level
668667

669668
### Common Pitfalls
670669

671-
- Forgetting to rename the `src/` package directory
670+
- Forgetting to rename the `example_package/` package directory
672671
- Working outside an active virtual environment
673672
- Committing secrets or generated files
674673
- Ignoring CI or pre-commit failures

0 commit comments

Comments
 (0)