Skip to content

Latest commit

 

History

History
240 lines (177 loc) · 6.11 KB

README.MD

File metadata and controls

240 lines (177 loc) · 6.11 KB

SnakeBake 🐍🥧

Lightweight Python project generator using CookieCutter and Hatch.


Report a Bug · Request a Feature . Ask a Question

Licence Python Ruff Pre-commit PyTest Cookiecutter

Table of Contents

Features

  • 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.

Installation

Prerequisites

  • Python 3.8+
  • Cookiecutter
  • Hatch

Step-by-step

  1. Install Cookiecutter and Hatch:
pip install cookiecutter hatch
  1. Create a new project using the template:
cookiecutter gh:agent-polyblank/snake-bake

Follow the prompts to customize your project.

  1. Navigate to the project directory:
cd your-project-name
  1. Initialize the Hatch environment:
hatch env create

Usage

Activating the Environment

To activate the Hatch environment, run:

hatch shell

Running the Application

After activating the environment, you can run your application using:

python -m your_project_name

Project Structure

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

Development

Installing Dependencies

To install the project dependencies, activate the Hatch environment and run:

hatch env install

Linting and Formatting

Run the following command to lint and format code with Ruff:

hatch fmt

Testing

To run tests using PyTest, execute:

hatch test

Pre-Commit

To install pre-commit hooks:

pip install pre-commit && pre-commit install

Deployment

Building the Package

To build the package, run:

hatch build

Publishing the Package

To publish the package to PyPI, configure your credentials in ~/.pypirc and run:

hatch publish

Contributing

Contributions to SnakeBake are welcomed! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Install pre-commit hooks
  4. Make your changes.
  5. Ensure your changes pass pre-commit and conform to the Contributing Guidelines and Code of Conduct.
  6. Submit a pull request with a detailed description of your changes Pull Request template can be found here.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgments

Special thanks to:

What's Next?

  • 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.