Skip to content

Instantly share code, notes, and snippets.

@Red-Eyed
Last active April 7, 2025 14:42
Show Gist options
  • Save Red-Eyed/d8cbd36843b0f5342169b6350a98aff6 to your computer and use it in GitHub Desktop.
Save Red-Eyed/d8cbd36843b0f5342169b6350a98aff6 to your computer and use it in GitHub Desktop.
pyproject.toml hatch template
[project]
name = "project_name"
version = "0.1.0"
authors = [{name = "Full Name", email = "[email protected]"}]
requires-python = ">=3.12"
dependencies = [
"pip>=24.2",
"expression>=5.1.0",
]
[project.optional-dependencies]
dev = [
"ipykernel>=6.29.5",
"ipython>=8.26.0",
"ruff>=0.5.6",
]
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.envs.default]
type = "virtual"
path = ".venv"
python = "3.12"
[tool.ruff]
exclude = [
".git",
"__pycache__",
"setup.py",
"build",
"dist",
"releases",
".venv",
".mypy_cache",
".pytest_cache",
".vscode",
".github",
]
line-length = 120
indent-width = 4
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes errors
"W", # pycodestyle warnings
"B", # bugbear best practices checker
"T", # mypy type errors
"B", # flake8-bugbear best practices checker
"I001", # isort import order
]
ignore = []
fixable = ["ALL"]
unfixable = []
[tool.ruff.format]
line-ending = "lf"
skip-magic-trailing-comma = false
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
# Usage:
# hatch env create
# then
# hatch shell
[project]
name = "project_name"
version = "0.1.0"
authors = [{name = "Vadym Stupakov", email = "[email protected]"}]
requires-python = ">=3.12"
dependencies = [
"pip>=24.2",
"expression>=5.1.0",
]
[project.optional-dependencies]
dev = [
"ipykernel>=6.29.5",
"ipython>=8.26.0",
"ruff>=0.5.6",
]
# Usage
# uv sync
[tool.uv.sources]
torch = [
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
]
torchvision = [
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
]
[[tool.uv.index]]
name = "pytorch-cu124"
url = "https://download.pytorch.org/whl/cu124"
explicit = true
[tool.ruff]
exclude = [
".git",
"__pycache__",
"setup.py",
"build",
"dist",
"releases",
".venv",
".mypy_cache",
".pytest_cache",
".vscode",
".github",
]
line-length = 120
indent-width = 4
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes errors
"W", # pycodestyle warnings
"B", # bugbear best practices checker
"T", # mypy type errors
"B", # flake8-bugbear best practices checker
"I001", # isort import order
]
ignore = []
fixable = ["ALL"]
unfixable = []
[tool.ruff.format]
line-ending = "lf"
skip-magic-trailing-comma = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment