|
| 1 | +# Python Project Bootstrapper |
| 2 | + |
| 3 | +This page contains information associated with the content generated by `PythonProjectBootstrapper`. Please see [README.md](https://github.com/gt-sse-center/PythonProjectBootstrapper) for information about `PythonProjectBootstrapper` itself. |
| 4 | + |
| 5 | +## Generated Content |
| 6 | + |
| 7 | +A brief description of the most important content generated by `PythonProjectBootstrapper`. |
| 8 | + |
| 9 | +### `.github/` |
| 10 | + |
| 11 | +Information that defines the CI/CD workflows used by GitHub actions. |
| 12 | + |
| 13 | +### `src/` |
| 14 | + |
| 15 | +Python source code making up the contents of your package. `src/<project_name>/EntryPoint.py` represents an executable script that can be invoked on the command line once your package is installed and `src/<project_name>/Math.py` contains functionality that can be used by other python modules when your package is installed. |
| 16 | + |
| 17 | +### `tests/` |
| 18 | + |
| 19 | +Automated tests that exercise functionality defined within your package. There should be a file in `tests/` that corresponds to every file in `src/`. |
| 20 | + |
| 21 | +### `Bootstrap.sh` / `Bootstrap.cmd` |
| 22 | + |
| 23 | +Script that prepares your repository for development within the local environment. This script installs python (if necessary), creates a virtual python environment, and installs the python dependencies defined in `pyproject.toml`. In addition, it creates the files `Activate.sh` / `Activate.cmd` and `Deactivate.sh` / `Deactivate.cmd`. |
| 24 | + |
| 25 | +### `Build.py` |
| 26 | + |
| 27 | +The entry point for local development activities for your repository. Run `python Build.py --help` for more information about this script. |
| 28 | + |
| 29 | +### `pyproject.toml` |
| 30 | + |
| 31 | +Configuration settings for your python project and tools used in its development. Visit the [Python Packaging User Guide](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/) for more information on this file. |
| 32 | + |
| 33 | +## Frequently Asked Questions (FAQs) |
| 34 | + |
| 35 | +### Python Dependencies |
| 36 | + |
| 37 | +#### How do I modify the python dependencies for my project? |
| 38 | + |
| 39 | +Open `/pyproject.toml` and edit one of the following values: |
| 40 | + |
| 41 | +| Section | Value | Description | |
| 42 | +| --- | --- | --- | |
| 43 | +| `[project]` | `dependencies` | Python package dependencies required by your package; these will be installed when your package is installed. | |
| 44 | +| `[project.optional-dependencies]` | `dev` | Python package dependencies required for local development (e.g. when `Bootstrap` is invoked). | |
| 45 | +| `[project.optional-dependencies]` | `package` | Additional python package dependencies required for local development when creating or publishing wheels (e.g. when `Bootstrap --package` is invoked). | |
| 46 | + |
| 47 | +Information about the format of these values can be found [here](https://peps.python.org/pep-0631/). |
| 48 | + |
| 49 | +### Executable Scripts |
| 50 | + |
| 51 | +Executable scripts are python files that can be executed from the command line when your python package is installed. You may specify any number of these scripts. |
| 52 | + |
| 53 | +#### How do I modify the executable scripts generated when my package is installed? |
| 54 | + |
| 55 | +Open `/pyproject.toml` and modify the `[project.scripts]` section. These values are line delimited and should be in the format: |
| 56 | + |
| 57 | +`<script_name>` = `<module_name>:<script_name>.app` |
| 58 | + |
| 59 | +Example: |
| 60 | + |
| 61 | +- `src/MyPackage/ScriptA.py` is a python file using [typer](https://typer.tiangolo.com/) that defines a global variable named `app`. |
| 62 | +- `src/MyPackage/ScriptB.py` is a python file using [typer](https://typer.tiangolo.com/) that defines a global variable named `app`. |
| 63 | + |
| 64 | +``` |
| 65 | +[project.scripts] |
| 66 | +MyScript1 = MyPackage:ScriptA.app |
| 67 | +MyScript2 = MyPackage:ScriptB.app |
| 68 | +``` |
| 69 | + |
| 70 | +After these changes, running `MyScript1` on the command line will invoke `src/MyPackage/ScriptA.py` and running `MyScript2` will invoke `src/MyPackage/ScriptB.py`. |
| 71 | + |
| 72 | +Note that this example used different names for the script name and the python file that it invokes. This is to show that these values can vary independently when defined in `pyproject.toml`. Normally, the script name should be the same as the name of the python file that implements it. |
| 73 | + |
| 74 | +### Continuous Integration |
| 75 | + |
| 76 | +#### How do I modify the required pylint score? |
| 77 | + |
| 78 | +Open `Build.py` and search for `default_min_score=`. Set this to a decimal value >= 0.0 and <= 10.0. |
| 79 | + |
| 80 | +#### How do I modify the required code coverage percentage? |
| 81 | + |
| 82 | +Open `Build.py` and search for `default_min_coverage=`. Set this to a decimal value >= 0.0 and <= 100.0. |
| 83 | + |
| 84 | +#### How do I change the command line used to validate a package installation? |
| 85 | + |
| 86 | +Open `.github/workflows/standard.yaml` and search for `validation_command: ` under the section `validate_package`. Update the value to the new command line. |
| 87 | + |
| 88 | +#### How do I change the command line used to validate an executable? |
| 89 | + |
| 90 | +Open `.github/workflows/standard.yaml` and search for `validation_command: ` under the section `validate_binary`. Update the value to the new command line. |
0 commit comments