|
1 | | -# template-python |
2 | | -Template python project |
| 1 | +# Python Project Template |
| 2 | + |
| 3 | +A modern Python project template with best practices for development, testing, and deployment. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Modern Python (3.11+) project structure |
| 8 | +- Development tools configuration (pytest, black, isort, mypy, ruff) |
| 9 | +- Docker support |
| 10 | +- GitHub Actions ready |
| 11 | +- Comprehensive documentation structure |
| 12 | +- Jupyter notebook support |
| 13 | + |
| 14 | +## Project Structure |
| 15 | + |
| 16 | +``` |
| 17 | +. |
| 18 | +├── docs/ # Documentation files |
| 19 | +├── notebooks/ # Jupyter notebooks |
| 20 | +├── src/ # Source code |
| 21 | +│ ├── common/ # Common utilities and shared code |
| 22 | +│ ├── modules/ # Feature modules |
| 23 | +│ │ └── api/ # API related code |
| 24 | +│ ├── shared/ # Shared resources |
| 25 | +│ └── utils/ # Utility functions |
| 26 | +└── tests/ # Test files |
| 27 | +``` |
| 28 | + |
| 29 | +## Getting Started |
| 30 | + |
| 31 | +### Prerequisites |
| 32 | + |
| 33 | +- Python 3.11 or higher |
| 34 | +- [uv](https://github.com/astral-sh/uv) for dependency management |
| 35 | + |
| 36 | +### Installation |
| 37 | + |
| 38 | +1. Clone the repository: |
| 39 | +```bash |
| 40 | +git clone https://github.com/yourusername/template-python.git |
| 41 | +cd template-python |
| 42 | +``` |
| 43 | + |
| 44 | +2. Create a virtual environment and install dependencies: |
| 45 | +```bash |
| 46 | +uv venv |
| 47 | +source .venv/bin/activate # On Windows: .venv\Scripts\activate |
| 48 | +uv pip install -e ".[dev]" |
| 49 | +``` |
| 50 | + |
| 51 | +3. Copy the environment file and adjust as needed: |
| 52 | +```bash |
| 53 | +cp .env.example .env |
| 54 | +``` |
| 55 | + |
| 56 | +### Development |
| 57 | + |
| 58 | +This project uses several development tools: |
| 59 | + |
| 60 | +- **pytest**: Testing framework |
| 61 | +- **black**: Code formatting |
| 62 | +- **isort**: Import sorting |
| 63 | +- **mypy**: Static type checking |
| 64 | +- **ruff**: Fast Python linter |
| 65 | + |
| 66 | +Run tests: |
| 67 | +```bash |
| 68 | +pytest |
| 69 | +``` |
| 70 | + |
| 71 | +Format code: |
| 72 | +```bash |
| 73 | +black . |
| 74 | +isort . |
| 75 | +``` |
| 76 | + |
| 77 | +Run type checking: |
| 78 | +```bash |
| 79 | +mypy src tests |
| 80 | +``` |
| 81 | + |
| 82 | +Run linting: |
| 83 | +```bash |
| 84 | +ruff check . |
| 85 | +``` |
| 86 | + |
| 87 | +### Docker |
| 88 | + |
| 89 | +Build the Docker image: |
| 90 | +```bash |
| 91 | +make build |
| 92 | +``` |
| 93 | + |
| 94 | +Run the container: |
| 95 | +```bash |
| 96 | +make run |
| 97 | +``` |
| 98 | + |
| 99 | +## Contributing |
| 100 | + |
| 101 | +1. Fork the repository |
| 102 | +2. Create your feature branch (`git checkout -b feature/amazing-feature`) |
| 103 | +3. Commit your changes (`git commit -m 'Add some amazing feature'`) |
| 104 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 105 | +5. Open a Pull Request |
| 106 | + |
| 107 | +## License |
| 108 | + |
| 109 | +This project is licensed under the MIT License - see the LICENSE file for details. |
0 commit comments