Skip to content

Commit d577bd9

Browse files
committed
♻️ use only two names, reduce template complexity a bit
1 parent 8ac3af4 commit d577bd9

File tree

13 files changed

+116
-307
lines changed

13 files changed

+116
-307
lines changed

README.md

Lines changed: 11 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -5,126 +5,12 @@
55
Can be used as GitHub template repository,
66
see [GitHub documentation](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
77

8-
You will need to find and replace occurences of
8+
You will need to find and replace occurences of
99

10-
- `mockup` -> `your_package_name`
11-
- `rasmussenlab-mockup` -> `your_package_name`
12-
- `RasmussenLab` -> `GitHub_user_name` (or organization)
1310
- `python_package` -> `your_package_name`
11+
- `RasmussenLab` -> `GitHub_user_name` (or `organization`)
1412

15-
with the name of your package and GitHub user name (or organization). This still might
16-
need further testing:
17-
18-
```bash
19-
# currently these are (v24.03)
20-
21-
pyproject.toml:
22-
5 description = "A small example package"
23-
6: name = "rasmussenlab-mockup"
24-
7 # This means: Load the version from the package itself.
25-
26-
README.md:
27-
7
28-
8: You will need to find and replace occurences of `mockup` with the name of your package. This still might
29-
9 need further testing.
30-
31-
22
32-
23: Install vom [TestPyPI](https://test.pypi.org/project/rasmussenlab-mockup):
33-
24
34-
25 ```
35-
26: pip install -i https://test.pypi.org/simple/ rasmussenlab-mockup
36-
27 ```
37-
28
38-
29: > The package on PyPI is call `rasmussenlab-mockup` and not `mockup` as the package name is already taken. The import is still `import mockup`.
39-
30
40-
41-
docs\conf.py:
42-
18
43-
19: project = "mockup"
44-
20 copyright = "2024, Jakob Nybo Nissen, Henry Webel"
45-
21 author = "Jakob Nybo Nissen, Henry Webel"
46-
22: PACKAGE_VERSION = metadata.version("rasmussenlab-mockup")
47-
23 version = PACKAGE_VERSION
48-
49-
119 PROJECT_ROOT = Path(__file__).parent.parent
50-
120: PACKAGE_ROOT = PROJECT_ROOT / "src" / "mockup"
51-
121
52-
53-
docs\index.rst:
54-
1: .. mockup documentation master file, created by
55-
2 sphinx-quickstart on Mon Aug 28 14:09:15 2023.
56-
57-
5
58-
6: The mockup package
59-
7 ==================================
60-
8
61-
9: Mockup is a Python package with some simple example code.
62-
10: To get started, explore the :class:`mockup.Circle` class.
63-
11
64-
65-
docs\README.md:
66-
27 # apidoc
67-
28: sphinx-apidoc --force --implicit-namespaces --module-first -o reference ../src/mockup
68-
29 # build docs
69-
70-
docs\tutorial\tutorial.ipynb:
71-
6 "source": [
72-
7: "# Mockup tutorial"
73-
8 ]
74-
75-
15 "source": [
76-
16: "from mockup import mockup"
77-
17 ]
78-
79-
24 "source": [
80-
25: "mockup.add_one(-11)"
81-
26 ]
82-
83-
33 "source": [
84-
34: "list(mockup.flatten_ints([[9, 11], [12], [4, 5]]))"
85-
35 ]
86-
87-
42 "source": [
88-
43: "c2 = mockup.Circle.from_circumference(100)\n",
89-
44 "round(c2.radius, 3)"
90-
91-
src\mockup\__init__.py:
92-
6
93-
7: __version__ = metadata.version("rasmussenlab-mockup")
94-
8
95-
9: from .mockup import add_one, Circle
96-
10
97-
98-
tests\test_circle.py:
99-
1 import unittest
100-
2: from mockup.mockup import Circle
101-
3
102-
```
103-
104-
And additionally the author names:
105-
106-
```bash
107-
pyproject.toml:
108-
1 [project]
109-
2: authors = [
110-
3 {name = "Jakob Nybo Nissen", email = "[email protected]"},
111-
112-
README.md:
113-
37 20 copyright = "2024, Jakob Nybo Nissen, Henry Webel"
114-
38: 21 author = "Jakob Nybo Nissen, Henry Webel"
115-
39 22: PACKAGE_VERSION = metadata.version("rasmussenlab-mockup")
116-
117-
96
118-
97: And additionally the author names:
119-
98
120-
121-
docs\conf.py:
122-
20 copyright = "2024, Jakob Nybo Nissen, Henry Webel"
123-
21: author = "Jakob Nybo Nissen, Henry Webel"
124-
22 PACKAGE_VERSION = metadata.version("rasmussenlab-mockup")
125-
```
126-
127-
> Potentially a cookiecutter could be based on this template repository.
13+
with the name of your package and GitHub user name (or organization).
12814

12915
## Development environment
13016

@@ -134,20 +20,19 @@ Install package so that new code is picked up in a restared python interpreter:
13420
pip install -e ".[dev]"
13521
```
13622

137-
## TestPyPI
23+
## Basic usage
13824

139-
Install vom [TestPyPI](https://test.pypi.org/project/rasmussenlab-mockup):
140-
141-
```
142-
pip install -i https://test.pypi.org/simple/ rasmussenlab-mockup
25+
```python
26+
from python_package import hello_world
27+
print (python_package.__version__)
28+
print(hello_world(4))
14329
```
14430

145-
> The package on PyPI is call `rasmussenlab-mockup` and not `mockup` as the package name is already taken. The import is still `import mockup`.
146-
14731
## Readthedocs
14832

149-
The documentation is build using readthedocs automatically. See
150-
[project on Readthedocs](https://readthedocs.org/projects/rasmussenlab-python-package/).
33+
The documentation can be build using readthedocs automatically. See
34+
[project on Readthedocs](https://readthedocs.org/projects/rasmussenlab-python-package/) for the project. A new project needs
35+
to be registered.
15136

15237
- make sure to enable build from PRs in the settings (advanded settings)
15338
- checkout configuration file: [`.readthedocs.yaml`](.readthedocs.yaml)

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Options:
2525
```bash
2626
# pwd: docs
2727
# apidoc
28-
sphinx-apidoc --force --implicit-namespaces --module-first -o reference ../src/mockup
28+
sphinx-apidoc --force --implicit-namespaces --module-first -o reference ../src/python_package
2929
# build docs
3030
sphinx-build -n -W --keep-going -b html ./ ./_build/
3131
```

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
# -- Project information -----------------------------------------------------
1717

18-
project = "mockup"
19-
copyright = "2024, Jakob Nybo Nissen, Henry Webel"
18+
project = "python_package"
19+
copyright = "2025, Jakob Nybo Nissen, Henry Webel"
2020
author = "Jakob Nybo Nissen, Henry Webel"
21-
PACKAGE_VERSION = metadata.version("rasmussenlab-mockup")
21+
PACKAGE_VERSION = metadata.version("python_package")
2222
version = PACKAGE_VERSION
2323
release = PACKAGE_VERSION
2424

@@ -128,7 +128,7 @@
128128
from pathlib import Path
129129

130130
PROJECT_ROOT = Path(__file__).parent.parent
131-
PACKAGE_ROOT = PROJECT_ROOT / "src" / "mockup"
131+
PACKAGE_ROOT = PROJECT_ROOT / "src" / "python_package"
132132

133133
def run_apidoc(_):
134134
from sphinx.ext import apidoc

docs/index.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Python Package Documentation
2+
3+
```{include} ../README.md
4+
:start-line: 0
5+
:relative-docs: docs
6+
:relative-images:
7+
```
8+
9+
## Tutorial
10+
11+
```{toctree}
12+
:maxdepth: 2
13+
:caption: "Tutorials"
14+
:hidden: true
15+
16+
tutorial/tutorial
17+
```
18+
19+
## Contents
20+
21+
```{toctree}
22+
:maxdepth: 2
23+
:caption: "Reference"
24+
:hidden: true
25+
26+
reference/python_package
27+
```
28+
29+
## Technical notes
30+
31+
```{toctree}
32+
:maxdepth: 2
33+
:caption: "Technical notes"
34+
:hidden: true
35+
36+
README
37+
```
38+
39+
## Indices and tables
40+
41+
- [Index](genindex)
42+
- [Module Index](modindex)
43+
- [Search](search)

docs/index.rst

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs/tutorial/tutorial.ipynb

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"id": "62cb84c2",
66
"metadata": {},
77
"source": [
8-
"# Mockup tutorial"
8+
"# Python Package tutorial\n",
9+
"\n",
10+
"Run when documentation is build. Building documentation therefore can become\n",
11+
"an minimal integration test for the package."
912
]
1013
},
1114
{
@@ -15,7 +18,7 @@
1518
"metadata": {},
1619
"outputs": [],
1720
"source": [
18-
"from mockup import mockup"
21+
"from python_package import hello_world"
1922
]
2023
},
2124
{
@@ -25,7 +28,8 @@
2528
"metadata": {},
2629
"outputs": [],
2730
"source": [
28-
"mockup.add_one(-11)"
31+
"ret = hello_world(2)\n",
32+
"ret"
2933
]
3034
},
3135
{
@@ -35,7 +39,7 @@
3539
"metadata": {},
3640
"outputs": [],
3741
"source": [
38-
"list(mockup.flatten_ints([[9, 11], [12], [4, 5]]))"
42+
"print(ret)"
3943
]
4044
},
4145
{
@@ -45,25 +49,20 @@
4549
"metadata": {},
4650
"outputs": [],
4751
"source": [
48-
"c2 = mockup.Circle.from_circumference(100)\n",
49-
"round(c2.radius, 3)"
52+
"hello_world?"
5053
]
5154
},
5255
{
5356
"cell_type": "code",
5457
"execution_count": null,
5558
"id": "4ae5341c",
56-
"metadata": {},
59+
"metadata": {
60+
"title": "markdown"
61+
},
5762
"outputs": [],
5863
"source": [
59-
"c2 # repr"
64+
"# Simple example for a recipe showing what the package can do."
6065
]
61-
},
62-
{
63-
"cell_type": "markdown",
64-
"id": "1bc4ca39",
65-
"metadata": {},
66-
"source": []
6766
}
6867
],
6968
"metadata": {

docs/tutorial/tutorial.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# %% [markdown]
2-
# # Mockup tutorial
2+
# # Python Package tutorial
3+
#
4+
# Run when documentation is build. Building documentation therefore can become
5+
# an minimal integration test for the package.
36

47
# %%
5-
from mockup import mockup
8+
from python_package import hello_world
69

710
# %%
8-
mockup.add_one(-11)
11+
ret = hello_world(2)
12+
ret
913

1014
# %%
11-
list(mockup.flatten_ints([[9, 11], [12], [4, 5]]))
15+
print(ret)
1216

1317
# %%
14-
c2 = mockup.Circle.from_circumference(100)
15-
round(c2.radius, 3)
18+
# hello_world?
1619

1720
# %%
18-
c2 # repr
19-
20-
# %% [markdown]
21-
#
21+
# Simple example for a recipe showing what the package can do.

0 commit comments

Comments
 (0)