Lightweight Python project generator using CookieCutter and Hatch.
Report a Bug · Request a Feature . Ask a Question
- Table of Contents
- Features
- Installation
- Usage
- Project Structure
- Development
- Testing
- Deployment
- Contributing
- License
- Acknowledgments
- What's Next?
- Hatch: Hatch allows for modern project management for Python, including environment management, testing, and packaging.
- Pre-configured linting and formatting:: Ruff for blazing fast linting and formatting.
- Pre-configured test suite: PyTest for robust testing.
- Pre-commit: Pre-Commit Hooks for automated code checks.
- Python 3.8+
- Cookiecutter
- Hatch
- Install Cookiecutter and Hatch:
pip install cookiecutter hatch
- Create a new project using the template:
cookiecutter gh:agent-polyblank/snake-bake
Follow the prompts to customize your project.
- Navigate to the project directory:
cd your-project-name
- Initialize the Hatch environment:
hatch env create
To activate the Hatch environment, run:
hatch shell
After activating the environment, you can run your application using:
python -m your_project_name
The project structure follows a standard layout:
your_project_name
┣ .github
┃ ┣ ISSUE_TEMPLATE
┃ ┃ ┣ 1-bug-report.md
┃ ┃ ┣ 2-failing-test.md
┃ ┃ ┣ 3-docs-bug.md
┃ ┃ ┣ 4-feature-request.md
┃ ┃ ┣ 5-enhancement-request.md
┃ ┃ ┣ 6-security-report.md
┃ ┃ ┣ 7-question-support.md
┃ ┃ ┗ config.yml
┃ ┣ CODEOWNERS
┃ ┣ CODE_OF_CONDUCT.md
┃ ┣ CONTRIBUTING.md
┃ ┣ ISSUE_TEMPLATE.md
┃ ┣ SECURITY.md
┃ ┣ SUPPORT.md
┃ ┣ config.yml
┃ ┣ issue_label_bot.yaml
┃ ┣ pull_request_template.md
┃ ┗ settings.yml
┣ src
┃ ┗ your_project_name
┃ ┃ ┣ __about__.py
┃ ┃ ┣ __init__.py
┃ ┃ ┣ __main__.py
┃ ┃ ┗ example.py
┣ tests
┃ ┣ __init__.py
┃ ┗ test.py
┣ .gitignore
┣ .pre-commit-config.yaml
┣ LICENSE.txt
┣ README.md
┗ pyproject.toml
To install the project dependencies, activate the Hatch environment and run:
hatch env install
Run the following command to lint and format code with Ruff:
hatch fmt
To run tests using PyTest, execute:
hatch test
To install pre-commit hooks:
pip install pre-commit && pre-commit install
To build the package, run:
hatch build
To publish the package to PyPI, configure your credentials in ~/.pypirc
and run:
hatch publish
Contributions to SnakeBake are welcomed! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Install pre-commit hooks
- Make your changes.
- Ensure your changes pass pre-commit and conform to the Contributing Guidelines and Code of Conduct.
- Submit a pull request with a detailed description of your changes Pull Request template can be found here.
This project is licensed under the MIT License. See the LICENSE file for more details.
Special thanks to:
- DecodeOs: Amazing Github Template: for their excellent README.
- Josee9988: For their Excellent issue templates.
- Coverage Reporting with pytest-cov.
- Project generation testing with pytest-cookies.
- Add optional 'Generated with SnakeBake badge'.
- Add recommended extensions for VSCode with
settings.json
. - Add note on bumping version number with hatch in generated project.