|
7 | 7 |
|
8 | 8 | # python-src-template |
9 | 9 |
|
| 10 | +## Playing around with a new structure. See the releases for previous structures. |
| 11 | + |
10 | 12 | ## A template I use for most projects. |
11 | 13 |
|
12 | 14 | Straight forward to use! |
13 | 15 |
|
14 | 16 | **Kind of...** |
15 | 17 |
|
16 | | -While this is the way I usually start my Python project setup this is far from |
17 | | -the only way to do things. I invite you to use my template. I also challenge |
18 | | -you to craft the structure that works both for your project and you, creating |
19 | | -your own template. The amount of learning in doing so is well worth the effort. |
20 | | - |
21 | | ---- |
22 | | - |
23 | | -### Quick setup: |
24 | | - |
25 | | -Clone the repo or click the "Use this template" button in GitHub |
26 | | - |
27 | | -If you clone the repo instead of using it as a template; be sure to delete the |
28 | | -`.git` folder and run `git init` before making any changes. |
29 | | - |
30 | | -Run the `init_template.py` script found in the root of the repo. You will be |
31 | | -prompted for details and the steps listed below completed for you. You may then |
32 | | -delete the `init_template.py` file, commit all changes, and dev on. |
33 | | - |
34 | | ---- |
35 | | - |
36 | | -### What to change for manual setup: |
37 | | - |
38 | | -* Remove the following place-holder files: |
39 | | - * `src/module_name/sample_data` |
40 | | - * `src/module_name/sample.py` |
41 | | - * `tests/test_sample.py` |
42 | | -* Raname `src/module_name` to the desired project name |
43 | | -* Update `pyproject.toml`: |
44 | | - * `[project]` section: |
45 | | - * `name`, `version`, `description`, `authors` |
46 | | - * `dependencies` |
47 | | - * see alternative for requirements.in if desired |
48 | | - * `[project.urls]` |
49 | | - * Update github homepage values |
50 | | - * `[tool.coverage.run]` |
51 | | - * `source_pkgs` : Update to reflect new `module_name` and any additional |
52 | | - modules |
53 | | -* Update `README.md` - Badges: |
54 | | - * Update owner and repo name of urls for `pre-commit.ci` badge |
55 | | - * Update owner and repo name of urls for `python tests` badge |
56 | | -* Update `README.md` - Content: |
57 | | - * Replace title and this setup information |
58 | | - * Under **Local developer installation** |
59 | | - * Replace `{{ORG_NAME}}` with github name |
60 | | - * Replace `{{REPO_NAME}}` with repo name |
61 | | - |
62 | | -### Why `src/` structure: |
63 | | - |
64 | | -The benefit I get from this project structure comes from testing. The `src/` |
65 | | -structure forces us to test on the installed version of the modules within |
66 | | -`site-packages/` and not our local code. Even though these files are symlinked |
67 | | -in most cases with the dev install, the calls and import references are the |
68 | | -same. This ensures we are testing on what will be setup in the not-my machine. |
69 | | - |
70 | 18 | --- |
71 | 19 |
|
72 | 20 | # Local developer installation |
@@ -123,10 +71,6 @@ call the version of the interpreter used to create the `venv` |
123 | 71 | Install editable library and development requirements: |
124 | 72 |
|
125 | 73 | ```console |
126 | | -# Update pip and tools |
127 | | -$ python -m pip install --upgrade pip |
128 | | - |
129 | | -# Install editable version of library |
130 | 74 | $ python -m pip install --editable .[dev,test] |
131 | 75 | ``` |
132 | 76 |
|
@@ -199,12 +143,13 @@ This repo has a Makefile with some quality of life scripts if the system |
199 | 143 | supports `make`. Please note there are no checks for an active `venv` in the |
200 | 144 | Makefile. |
201 | 145 |
|
202 | | -| PHONY | Description | |
203 | | -| ------------- | ------------------------------------------------------------------------------------------ | |
204 | | -| `init` | Update pip to newest version | |
205 | | -| `install` | install the project | |
206 | | -| `install-dev` | install development/test requirements and project as editable install | |
207 | | -| `upgrade-dev` | update all dependencies, regenerate requirements.txt (disabled by default) | |
208 | | -| `coverage` | Run tests with coverage, generate html report, and open browser (double check based on os) | |
209 | | -| `build-dist` | Build source distribution and wheel distribution | |
210 | | -| `clean` | Deletes build, tox, coverage, pytest, mypy, cache, and pyc artifacts | |
| 146 | +| PHONY | Description | |
| 147 | +| -------------- | ------------------------------------------------------------------------------------------ | |
| 148 | +| `install` | install the project | |
| 149 | +| `install-dev` | install development/test requirements and project as editable install | |
| 150 | +| `upgrade-dev` | update all dependencies, regenerate requirements.txt (disabled by default) | |
| 151 | +| `coverage` | Run tests with coverage, generate html report, and open browser (double check based on os) | |
| 152 | +| `docker-test' | Run coverage and tests in a docker container. | |
| 153 | +| `docker-clean` | Run `docker system prune -f` | |
| 154 | +| `build-dist` | Build source distribution and wheel distribution | |
| 155 | +| `clean` | Deletes build, tox, coverage, pytest, mypy, cache, and pyc artifacts | |
0 commit comments