https://github.com/nikithshetty/pybake
https://github.com/nikithshetty/pybake
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nikithshetty/pybake
- Owner: NikithShetty
- Created: 2025-08-17T16:28:32.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-17T19:34:43.000Z (10 months ago)
- Last Synced: 2025-08-17T21:11:46.599Z (10 months ago)
- Language: Python
- Size: 29.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PyBake CLI
A powerful CLI tool that creates new Python projects with modern tooling setup, including uv, pyright, ruff, beartype, pytest, pre-commit, and GitHub Actions.
## ๐ Features
- **Modern Python Project Structure**: Creates well-organized projects with src layout
- **Dependency Management**: Configures uv for fast package management
- **Static Analysis**: Sets up pyright for comprehensive type checking
- **Code Quality**: Configures ruff for linting and formatting
- **Runtime Validation**: Integrates beartype for runtime type checking
- **Testing**: Sets up pytest with coverage reporting
- **Git Hooks**: Configures pre-commit for automated quality checks
- **CI/CD**: Creates GitHub Actions workflows for automated testing
- **Interactive Setup**: Guided project creation with prompts
- **Multiple Templates**: Support for different project types
## ๐ Requirements
- Python 3.12+
- uv (for running the tool)
## ๐ ๏ธ Installation
### Using uvx (Recommended - No Installation Required)
The easiest way to use PyBake is with `uvx`, which runs the tool directly from the repository without any installation:
```bash
# Run directly without installation
uvx pybake --help
# Create a new project
uvx pybake create my-awesome-project
# List available templates
uvx pybake list-templates
# Show tool information
uvx pybake info
```
### Alternative: Local Development Setup
If you want to contribute to PyBake or run it locally:
```bash
# Clone the repository
git clone https://github.com/NikithShetty/pybake.git
cd pybake
# Install dependencies
uv sync
# Run locally
uv run pybake --help
```
## ๐ฏ Usage
### Create a New Project
```bash
# Basic usage with uvx
uvx pybake create my-awesome-project
# With custom options
uvx pybake create my-awesome-project \
--python 3.12 \
--description "My awesome Python project" \
--author "Your Name" \
--email "your.email@example.com" \
--path /path/to/projects
```
### Available Commands
```bash
# Show help
uvx pybake --help
# Create a new project
uvx pybake create [options]
# List available templates
uvx pybake list-templates
# Show tool information
uvx pybake info
```
### Command Options
- `--path, -p`: Path where to create the project (default: current directory)
- `--python, -py`: Python version requirement (default: 3.12)
- `--description, -d`: Project description
- `--author, -a`: Project author name
- `--email, -e`: Author email address
- `--no-interactive`: Disable interactive mode
## ๐๏ธ Generated Project Structure
```bash
my-awesome-project/
โโโ src/
โ โโโ my_awesome_project/
โ โโโ __init__.py
โ โโโ main.py
โโโ tests/
โ โโโ __init__.py
โ โโโ test_my_awesome_project.py
โโโ docs/
โ โโโ README.md
โโโ .github/
โ โโโ workflows/
โ โโโ ci.yml
โโโ pyproject.toml
โโโ .python-version
โโโ .gitignore
โโโ README.md
โโโ .pre-commit-config.yaml
```
## ๐ ๏ธ Tools Included
### 1. Environment & Dependency Management
- **uv**: Fast Python package installer and resolver
### 2. Typing & Static Analysis
- **pyright**: Microsoft's static type checker for Python
- **ruff**: Extremely fast Python linter and formatter
- **beartype**: Runtime type checking decorator
### 3. Testing
- **pytest**: Testing framework with powerful features
- **pytest-cov**: Coverage reporting for pytest
- **pre-commit**: Git hooks for code quality
- **GitHub Actions**: Automated CI/CD workflows
## ๐ง Configuration Files
### pyproject.toml
- Project metadata and dependencies
- Tool configurations for ruff, pyright, pytest, and coverage
- Build system configuration with hatchling
- uv-specific configuration for development dependencies
### .pre-commit-config.yaml
- Git hooks for code quality
- Automated formatting and linting on commit
### GitHub Actions (ci.yml)
- Automated testing on push/PR
- Coverage reporting and quality checks
## ๐ Quick Start
1. **Run the tool directly** (recommended):
```bash
uvx pybake create my-project
```
2. **Navigate to your project**:
```bash
cd my-project
```
3. **Initialize git and install dependencies**:
```bash
git init
uv sync
```
4. **Activate virtual environment and run tests**:
```bash
uv shell
pytest
```
## ๐งช Testing
```bash
# Run tests
pytest
# Run tests with coverage
pytest --cov=src
# Run specific test file
pytest tests/test_my_awesome_project.py
```
## ๐ Code Quality
```bash
# Lint code
ruff check .
# Format code
ruff format .
# Type checking
pyright
# Run all pre-commit hooks
pre-commit run --all-files
```
## ๐ Development
### Project Structure
```bash
pybake/
โโโ src/
โ โโโ pybake/
โ โโโ __init__.py
โ โโโ cli.py # Main CLI application
โ โโโ config.py # Configuration classes
โ โโโ project_generator.py # Project generation logic
โ โโโ templates.py # Project templates
โ โโโ __main__.py # Module entry point
โโโ tests/ # Test files
โโโ pyproject.toml # Project configuration
โโโ main.py # Alternative entry point
โโโ README.md # This file
```
### Adding New Templates
1. Update `templates.py` with new template configuration
2. Modify `project_generator.py` to handle template-specific logic
3. Add template-specific file generation methods
### Adding New Tools
1. Update `pyproject.toml` with new dependencies
2. Add tool configuration files in `project_generator.py`
3. Update documentation and help text
## ๐ค Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Run tests and quality checks
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to the branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- [uv](https://github.com/astral-sh/uv) - Fast Python package manager
- [uvx](https://github.com/astral-sh/uvx) - Run Python packages directly from git
- [pyright](https://github.com/microsoft/pyright) - Static type checker
- [ruff](https://github.com/astral-sh/ruff) - Fast Python linter
- [beartype](https://github.com/beartype/beartype) - Runtime type checking
- [pytest](https://github.com/pytest-dev/pytest) - Testing framework
- [pre-commit](https://github.com/pre-commit/pre-commit) - Git hooks
- [Typer](https://github.com/tiangolo/typer) - CLI framework
- [Rich](https://github.com/Textualize/rich) - Rich text and formatting
## ๐ Support
If you encounter any issues or have questions:
1. Check the [Issues](https://github.com/NikithShetty/pybake/issues) page
2. Create a new issue with detailed information
3. Join our community discussions
---
**Happy coding! ๐**