Welcome to the Python Project Template 2024. This will help get you started with the most modern Python tools and best practices.
- Depdendency Management with Poetry
- Code Linting and Formatting with Ruff
- Type Checking with MyPy
- Automating Testing with Pytest
- Pre-commit Hooks with pre-commit
- CI with GitHub Actions
- Getting Started
- Project Structure
- Makefile Commands
- Pre-commit Hooks
- Continuous Integration
- Contributing
- License
Make sure you have the following installed:
- Clone the repository
git clone https://github.com/camille-004/python_project.git
cd python_project
- Install dependencies
make install
- Set up pre-commit hooks
poetry run pre-commit install
-
Rename the project
Update the
pyproject.toml
file with your project's details:[tool.poetry] name = "your_project_name" version = "0.1.0" description = "Your project description" authors = ["Your Name <your.email@example.com>"] readme = "README.md" packages = [{include = "your_project_name"}]
Then, rename the source code directory from
python_project
to the value ofyour_project_name
. -
Customize or replace the
README
-
Start developing
Add your source code to the
your_project_name/
directory and your tests to thetests/
directory.
.
├── .github
│ └── workflows
│ └── ci.yml
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE
├── Makefile
├── README.md
├── pyproject.toml
├── python_project
│ └── __init__.py
└── tests
├── __init__.py
└── test_sample.py
This project uses a Makefile
to simplify various tasks:
-
Installing depedencies
make install
-
Running linters
make lint
-
Formatting code
make format
-
Type-checking the code
make type-check
-
Running tests
make test
Pre-commit hooks are configured to run the following checks before every commit:
- Lint:
make lint
- Format:
make format
- Type Check:
make type-check
This project uses GitHub Actions for Continuous Integration. Check .github/workflows/ci.yml
for the steps in how the workflow is defined:
- Install dependencies
- Run linters
- Type-check the code
- Run tests
Contributions are welcome! Please open an issue or submit a pull request if you have any improvements or new features.
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
This project is licensed under the GNU General Public License. See the LICENSE file for details.
Happy coding. 🚀