feat: using hatch and redoing repo structure
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# python-template
|
||||
|
||||
Python Project Template
|
||||
Python Project Template
|
||||
|
||||
## Running:
|
||||
`python3 -m src.python_template`
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
[build-system]
|
||||
requires = ["setuptools >= 61.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "python-template"
|
||||
version = "0.0.0"
|
||||
dynamic = ["dependencies"]
|
||||
|
||||
[tool.setuptools.dynamic]
|
||||
dependencies = {file = ["requirements.txt"]}
|
||||
[tool.hatch.dependencies]
|
||||
path = "requirements.txt"
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/python_template"]
|
||||
|
||||
[tool.black]
|
||||
line-length = 120
|
||||
target-version = ['py313']
|
||||
include = '\.pyi?$'
|
||||
[tool.hatch.build]
|
||||
skip-excluded-dirs = true
|
||||
|
||||
[tool.hatch.envs.dev]
|
||||
python = "3.13"
|
||||
dependencies = [
|
||||
"coverage[toml]",
|
||||
"pytest",
|
||||
"pytest-cov",
|
||||
"pytest-mock",
|
||||
]
|
||||
|
||||
39
ruff.toml
Normal file
39
ruff.toml
Normal file
@@ -0,0 +1,39 @@
|
||||
[tool.ruff]
|
||||
line-length = 120
|
||||
target-version = "py312"
|
||||
|
||||
select = [
|
||||
"ALL", # include all the rules, including new ones
|
||||
]
|
||||
ignore = [
|
||||
#### modules
|
||||
"ANN", # flake8-annotations
|
||||
"COM", # flake8-commas
|
||||
"C90", # mccabe complexity
|
||||
"DJ", # django
|
||||
"EXE", # flake8-executable
|
||||
"T10", # debugger
|
||||
"TID", # flake8-tidy-imports
|
||||
|
||||
#### specific rules
|
||||
"D100", # ignore missing docs
|
||||
"D101",
|
||||
"D102",
|
||||
"D103",
|
||||
"D104",
|
||||
"D105",
|
||||
"D106",
|
||||
"D107",
|
||||
"D200",
|
||||
"D205",
|
||||
"D212",
|
||||
"D400",
|
||||
"D401",
|
||||
"D415",
|
||||
"E402", # false positives for local imports
|
||||
"E501", # line too long
|
||||
"TRY003", # external messages in exceptions are too verbose
|
||||
"TD002",
|
||||
"TD003",
|
||||
"FIX002", # too verbose descriptions of todos
|
||||
]
|
||||
@@ -1,5 +0,0 @@
|
||||
def main():
|
||||
print("Python Template Project")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
8
src/python_template/__main__.py
Normal file
8
src/python_template/__main__.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add 'src/' to sys.path manually
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
from python_template.main import main
|
||||
|
||||
main()
|
||||
3
src/python_template/awesome_include.py
Normal file
3
src/python_template/awesome_include.py
Normal file
@@ -0,0 +1,3 @@
|
||||
class AwesomeClass():
|
||||
def __init__(self):
|
||||
print("This is an Awesome Class!")
|
||||
10
src/python_template/main.py
Normal file
10
src/python_template/main.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from python_template.awesome_include import AwesomeClass
|
||||
|
||||
|
||||
def main():
|
||||
print("Python Example")
|
||||
AwesomeClass()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user