Skip to content

DeepBlackHole/python-project-template

Repository files navigation

Python Project Template

A modern Python project template with best practices and essential tooling.

Features

  • Modern project structure using src layout
  • pyproject.toml for project configuration
  • Testing setup with pytest
  • Code formatting with Black
  • Linting with flake8
  • Type checking with mypy
  • Import sorting with isort
  • Comprehensive .gitignore for Python projects

Project Structure

.
├── src/
│   └── project_name/          # Main package directory
│       ├── __init__.py
│       └── main.py
├── tests/                     # Test files
│   ├── __init__.py
│   └── test_main.py
├── docs/                      # Documentation
├── .gitignore
├── pyproject.toml            # Project configuration
├── requirements.txt          # Production dependencies
├── requirements-dev.txt      # Development dependencies
└── README.md

Installation

For development

# Clone the repository
git clone <your-repo-url>
cd python-project-template

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

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

For production

pip install -r requirements.txt

Usage

from project_name import main

# Your code here

Development

Running Tests

# Run all tests
pytest

# Run with coverage report
pytest --cov=src --cov-report=html

Code Formatting

# Format code with Black
black src tests

# Sort imports
isort src tests

Linting

# Run flake8
flake8 src tests

# Run type checking
mypy src

Contributing

  1. Fork the repository
  2. Create a 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

MIT License - see LICENSE file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published