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