An open API service indexing awesome lists of open source software.

https://github.com/torchstack-ai/python-project-template

Python project template for Torchstack.ai
https://github.com/torchstack-ai/python-project-template

Last synced: 9 months ago
JSON representation

Python project template for Torchstack.ai

Awesome Lists containing this project

README

          

# Python Project Template

A Python project template with DevOps best practices, including linting, testing, and CI/CD setup.

## Features

- ๐Ÿงน Code formatting with [Black](https://github.com/psf/black)
- ๐Ÿ“ Import sorting with [isort](https://github.com/PyCQA/isort)
- ๐Ÿ” Linting with [flake8](https://github.com/PyCQA/flake8)
- โœ… Testing with [pytest](https://github.com/pytest-dev/pytest)
- ๐Ÿ“Š Test coverage reporting
- ๐Ÿ”„ Pre-commit hooks
- ๐Ÿš€ GitHub Actions CI/CD pipeline

## Setup

1. Clone this repository:
```bash
git clone
cd python-template
```

2. Create a virtual environment:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```

3. Install development dependencies:
```bash
pip install -r requirements-dev.txt
```

4. Install pre-commit hooks:
```bash
pre-commit install
```

## Usage

### Running Tests

```bash
pytest
```

### Code Formatting

```bash
# Format code with black
black .

# Sort imports with isort
isort .
```

### Linting

```bash
flake8
```

## Project Structure

```
python-template/
โ”œโ”€โ”€ .github/
โ”‚ โ””โ”€โ”€ workflows/
โ”‚ โ””โ”€โ”€ ci.yml
โ”œโ”€โ”€ src/
โ”‚ โ””โ”€โ”€ example/
โ”‚ โ”œโ”€โ”€ __init__.py
โ”‚ โ””โ”€โ”€ calculator.py
โ”œโ”€โ”€ tests/
โ”‚ โ””โ”€โ”€ test_calculator.py
โ”œโ”€โ”€ .flake8
โ”œโ”€โ”€ .pre-commit-config.yaml
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ requirements-dev.txt
```

## Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request

## License

This project is licensed under the MIT License - see the LICENSE file for details.