This is a barebones Python project template.
Features:
- Poetry for dependencies, pytest for testing.
- CI with GitHub Actions.
- Unlicense for unrestricted use.
You can find the sample README below. Feel free to modify it to suit your project.
Note: The MIT license is referenced, but this repo is actually under the Unlicense. I license most of my projects under MIT, so I put it in the template.
py-template is a barebones Python project template.
Text here.
- Written in modern Python (Python 3.11+).
- Comprehensive documentation with docstrings.
- Strict static typing.
This project has been tested on the following systems:
- macOS 15.1 (Sequoia)
Automated testing is also performed on the latest version of GNU/Linux (Python 3.11-3.13) using GitHub Actions.
To run this project, you'll need:
- Python 3.11 or higher
- Poetry (optional for users, required for developers)
Follow these steps to set up the project:
-
Clone the repository:
git clone https://github.com/ryouze/py-template.git
-
Install the project:
cd py-template
Option 1: Poetry (recommended):
poetry install --without dev poetry shell
Option 2: Pip in editable mode (if you don't want to use 3rd-party build tools):
python3 -m venv .env source .env/bin/activate pip install -e .
Note: This installs only production dependencies (i.e., for regular users). To install development dependencies, refer to the Development and Testing section.
Alternatively, the
generate_requirements.py
script can be used to generaterequirements.txt
for the traditionalpip install -r requirements.txt
method. Compatibility with this method is not guaranteed, as the project usespoetry
for dependency management.python3 generate_requirements.py pip install -r requirements.txt
Note: You must activate the virtual environment (poetry shell
or source .env/bin/activate
) every time you open a new terminal. Most IDEs can activate the venv automatically (VSCode: python.terminal.activateEnvInCurrentTerminal
).
To run the program, use the following command:
py-template
The --without dev
flag in poetry install
skips the installation of dev dependencies like pytest
.
To install all dependencies (including development), use:
poetry install
To run tests manually, activate the virtual environment and run:
pytest -v
Note: Installing the dev dependencies using pip is not supported due to syntax differences in the pyproject.toml
file. However, if you insist on using pip, you can manually install the packages listed under [tool.poetry.group.dev.dependencies]
.
All contributions are welcome.
This project is licensed under the MIT License.