|
# --- project ---------------------------------------------------------------- |
|
[project] |
|
name = "<PACKAGE_NAME>" |
|
authors = [ |
|
{ name="", email="" }, |
|
] |
|
description = "..." |
|
dynamic = ["version"] |
|
readme = "README.md" |
|
|
|
classifiers = [ |
|
"Programming Language :: Python :: 3", |
|
"Programming Language :: Python :: 3.8", |
|
"Programming Language :: Python :: 3.9", |
|
"Programming Language :: Python :: 3.10", |
|
"Programming Language :: Python :: 3.11", |
|
"Operating System :: OS Independent", |
|
] |
|
|
|
requires-python = ">=3.8" |
|
dependencies = [ |
|
"numpy>=1.21", |
|
"pandas>=1.5", |
|
"scikit-learn", |
|
"scipy>=1.7", |
|
"azure-identity", |
|
"azure-keyvault-secrets", |
|
"python-dateutil", |
|
"pyodbc", |
|
"pyyaml", |
|
"redis>=4.5.5", |
|
"snowflake-connector-python", |
|
"snowflake-sqlalchemy", |
|
"sqlalchemy", |
|
] |
|
[project.optional-dependencies] |
|
docs = [ |
|
"numpydoc", |
|
"sphinx", |
|
"sphinx_rtd_theme", |
|
] |
|
format = [ |
|
"black", |
|
"black-jupyter", |
|
"ruff", |
|
] |
|
test = [ |
|
"coverage>=4.2.0", |
|
"pytest", |
|
"pytest-asyncio", |
|
"pytest-cov", |
|
] |
|
dev = [ |
|
"<PACKAGE_NAME>[doc]", |
|
"<PACKAGE_NAME>[format]", |
|
"<PACKAGE_NAME>[test]", |
|
] |
|
pipelines = [ |
|
"<PACKAGE_NAME>[test]", |
|
"pytest-azurepipelines" |
|
] |
|
|
|
[project.urls] |
|
"repository" = "https://github.com/<OWNER>/<REPO>" |
|
|
|
# ref: https://hatch.pypa.io/1.2/version/#configuration |
|
[tool.hatch.version] |
|
path = "./src/VERSION" |
|
pattern = "^(?P<version>.+?)(\n)" |
|
|
|
[tool.hatch.build] |
|
only-include = [ |
|
"./src/VERSION", |
|
"src/<IMPORT_NAME>", |
|
"tests", |
|
] |
|
skip-excluded-dirs = true |
|
# sources = ["src"] |
|
|
|
[tool.hatch.build.targets.sdist] |
|
|
|
[tool.hatch.build.targets.wheel] |
|
packages = ["src/{{ python_import_name }}"] |
|
macos-max-compat = true |
|
|
|
# --- build-system ----------------------------------------------------------- |
|
# ref: https://packaging.python.org/en/latest/tutorials/packaging-projects/ |
|
# these should match the "setup-requires" packages in `setup.cfg` |
|
[build-system] |
|
requires = ["hatchling"] |
|
build-backend = "hatchling.build" |
|
|
|
# --- black ------------------------------------------------------------------ |
|
# ref: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file |
|
[tool.black] |
|
target-version = ['py39'] |
|
line-length = 100 |
|
# target-version = ['py39'] |
|
include = '\.pyi?$|\.ipynb$' |
|
extend-exclude = ''' |
|
# # A regex preceded with ^/ will apply only to files and directories |
|
# # in the root of the project. |
|
# ^/foo.py # exclude a file named foo.py in the root of the project (in addition to the defaults) |
|
\.ipynb_checkpoints$|^/\.env|^/\.git|^/\.nox|^/\.pytest_cache|^/\.tox |
|
''' |
|
|
|
# --- ruff ------------------------------------------------------------------- |
|
[tool.ruff] |
|
select = [ |
|
'A', # flake8 builtins |
|
'B', # flake8 bugbear |
|
'C4', # flake8 comprehensions |
|
'C90', # mccabe |
|
'D', # pydocstyle |
|
'E', # pycodestyle |
|
'F', # pyflakes |
|
'I', # isort |
|
'N', # pep8-naming |
|
# 'PTH', # flake8-use-pathlib |
|
'Q', # flake8-quotes |
|
'S', # bandit |
|
'SIM', # flake8-simplify |
|
'TRY', # tryceratops |
|
'W', # pycodestyle |
|
# 'T20', # flake8 print |
|
] |
|
|
|
# Avoid trying to fix extension types: |
|
unfixable = ["B"] |
|
|
|
ignore = [ |
|
"B905", # zip strict=True; remove once python <3.10 support is dropped. |
|
"D100", # do not require module-level docstrings |
|
"D104", # do not require package docstrings |
|
"D107", # do not require docstrings in __init__ files |
|
"D205", # don't require linebreak after docstring (ruff vs black conflict) |
|
# "E203", # not in ruff |
|
# "E265", # not in ruff |
|
# "E266", # not in ruff |
|
"E501", # line too long |
|
"F401", # unused import |
|
"F403", # import * |
|
"F405", # defined from import * |
|
# "F541", # f-string missing placeholders |
|
"N999", # allow "invalid" module names due to jinja templates "S101", # assert |
|
"SIM105", # allow except: pass |
|
"TRY003", # Avoid specifying messages outside exception class; overly strict, especially for ValueError |
|
"TRY201", # Allow raise without exception name (align with Sonarlint) |
|
# "W503", # not in ruff |
|
] |
|
|
|
exclude = [ |
|
"*.egg-info", |
|
".direnv", |
|
".eggs", |
|
".env", |
|
".envrc", |
|
".git", |
|
".ipynb_checkpoints", |
|
".nox", |
|
".pytest_cache", |
|
".ruff_cache", |
|
".tox", |
|
".venv", |
|
"__pypackages__", |
|
"_build", |
|
"ci/templates", |
|
"build", |
|
"dist", |
|
"docs/conf.py", |
|
"venv", |
|
] |
|
|
|
# Default autofix behavior |
|
fix = true |
|
|
|
# Max line length |
|
line-length = 119 |
|
|
|
# Directories with source code |
|
src = ["notebooks", "src", "tests"] |
|
|
|
# Assumed Python version |
|
target-version = "py39" |
|
|
|
[tool.ruff.per-file-ignores] |
|
# # Ignore `E402` (import violations) in all `__init__.py` files, |
|
# # and in `path/to/file.py`. |
|
# "__init__.py" = ["E402"] |
|
# "path/to/file.py" = ["E402"] |
|
".ci/*" = ["D"] |
|
"docs/*" = ["D"] |
|
"notebooks/*" = ["B018", "D", "S101"] |
|
"tests/*" = ["D", "S101"] |
|
|
|
# --- ruff plugins -------------------- |
|
[tool.ruff.flake8-bugbear] |
|
extend-immutable-calls = [ |
|
"chr", |
|
"typer.Argument", |
|
"typer.Option", |
|
] |
|
|
|
[tool.ruff.isort] |
|
combine-as-imports = true |
|
# extra-standard-library = ["path"] |
|
forced-separate = ["scipy", "sklearn", "statsmodels", "ds_utils", "src"] |
|
force-sort-within-sections = true |
|
force-wrap-aliases = true |
|
known-first-party = ["ds_utils", "src"] |
|
# known-local-folder = ["src"] # for relative imports |
|
|
|
[tool.ruff.mccabe] |
|
max-complexity = 18 |
|
|
|
[tool.ruff.pep8-naming] |
|
ignore-names = [] |
|
|
|
[tool.ruff.pydocstyle] |
|
convention = "numpy" |
|
|
|
# --- pytest ----------------------------------------------------------------- |
|
# ref: https://docs.pytest.org/en/7.3.x/reference/customize.html |
|
[tool.pytest.ini_options] |
|
addopts = ''' |
|
-ra |
|
--strict-markers |
|
--ignore=docs/conf.py |
|
--ignore=setup.py |
|
--ignore=ci |
|
--ignore=.eggs |
|
--tb=short |
|
''' |
|
# --doctest-modules |
|
# --doctest-glob=\*.rst |
|
norecursedirs = [ |
|
".env", |
|
".git", |
|
".nox", |
|
".pytest_cache", |
|
".tox", |
|
"__pycache__", |
|
"dist", |
|
"docs", |
|
"build", |
|
"migrations", |
|
"notebooks", |
|
"writeup", |
|
] |
|
python_files = [ |
|
"test_*.py", |
|
"*_test.py", |
|
"tests.py", |
|
] |
|
pythonpath = "src" |
|
testpaths = [ |
|
"tests", |
|
] |
|
# log_cli = true |
|
|
|
|
|
# --- coverage --------------------------------------------------------------- |
|
[tool.coverage.paths] |
|
source = ["src", "*/site-packages"] |
|
|
|
[tool.coverage.run] |
|
branch = true |
|
source = ["src"] |
|
|
|
[tool.coverage.report] |
|
show_missing = true |