pyproject.toml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. [build-system]
  2. build-backend = "hatchling.build"
  3. requires = ["hatchling"]
  4. [project]
  5. authors = [
  6. {name = 'Daniele Arosio', email = 'darosio@duck.com'}
  7. ]
  8. classifiers = [
  9. "Environment :: Console",
  10. "Operating System :: OS Independent",
  11. "Programming Language :: Python :: 3 :: Only",
  12. "Programming Language :: Python :: 3.11",
  13. "Programming Language :: Python :: 3.12",
  14. "Programming Language :: Unix Shell",
  15. "Intended Audience :: Science/Research",
  16. "Topic :: Scientific/Engineering",
  17. "Development Status :: 3 - Alpha"
  18. ]
  19. dependencies = [
  20. "bioio == 1.0.2",
  21. "click == 8.1.7",
  22. "dask-image",
  23. "nima",
  24. "numpy",
  25. "scikit-image",
  26. "scipy",
  27. "seaborn",
  28. "opencv-python == 4.10.0.84",
  29. "tifffile", # ==2024.5.22
  30. "tqdm",
  31. "zarr" # ==2.18.2
  32. ]
  33. description = "CRISPR-λ data project."
  34. keywords = ["continuous evolution", "CRISPR"]
  35. license = "BSD-3-Clause"
  36. name = "dt_evolv"
  37. requires-python = ">=3.11"
  38. version = "0.0.1"
  39. [project.optional-dependencies]
  40. dev = [
  41. "commitizen",
  42. "ipykernel",
  43. "jupyter",
  44. "ruff",
  45. "pre-commit",
  46. "pylsp-mypy==0.6.8",
  47. "ruff-lsp == 0.0.53"
  48. ]
  49. docs = [
  50. "autodocsumm",
  51. "nbsphinx",
  52. "pydata-sphinx-theme",
  53. "Sphinx",
  54. "sphinx-click",
  55. "sphinx_autodoc_typehints",
  56. "sphinxcontrib-plantuml"
  57. ]
  58. tests = [
  59. "coverage[toml]",
  60. "mypy",
  61. "pygments", # color xdoctest
  62. "pytest",
  63. "types-click",
  64. "types-tqdm",
  65. "xdoctest"
  66. ]
  67. [project.scripts]
  68. evolv = "dt_evolv.__main__:evolv"
  69. [tool.codespell]
  70. count = true
  71. ignore-words-list = "ciao"
  72. quiet-level = 3
  73. [tool.commitizen]
  74. name = "cz_customize"
  75. tag_format = "v$version"
  76. version = "0.0.1"
  77. version_files = [
  78. "pyproject.toml:version",
  79. "docs/conf.py:release",
  80. "tests/test_cli.py:expected_version",
  81. "Readme.org:Version"
  82. ]
  83. [tool.commitizen.customize]
  84. bump_map = {"^.+!:" = "MAJOR", "BREAKING CHANGE" = "MAJOR", "feat" = "MINOR", "fix" = "PATCH", "perf" = "PATCH", "refactor" = "PATCH"}
  85. bump_pattern = "^(BREAKING CHANGE|feat|fix|perf|refactor)"
  86. change_type_map = {"feat" = "Feat", "fix" = "Fix", "docs" = "Docs", "build" = "Build", "style" = "Style", "refactor" = "Refactor", "perf" = "Perf", "test" = "Test", "ci" = "CI/CD"}
  87. change_type_order = ["BREAKING CHANGE", "Feat", "Fix", "Docs", "Style", "Perf", "Test", "Build", "CI/CD"]
  88. changelog_pattern = "^(feat|fix|docs|style|refactor|perf|test|build|ci)?(\\(.*\\))?(!)?"
  89. commit_parser = "^(?P<change_type>feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\\((?P<scope>[^()\r\n]*)\\)|\\()?(?P<breaking>!)?:\\s(?P<message>.*)?"
  90. example = """fix(parser): correct minor typos in code\n
  91. see the issue for details on the typos fixed\n
  92. closes issue #12
  93. """
  94. info_path = "cz_customize_info.txt"
  95. message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}"
  96. schema = """
  97. <type>(<scope>): <subject>
  98. <BLANK LINE>
  99. <body>
  100. <BLANK LINE>
  101. (BREAKING CHANGE: )<footer>
  102. """
  103. schema_pattern = "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|bump)(?:\\(([^()\r\n]*)\\)|\\()?(!)?:\\s(.*)?|^git-annex in"
  104. [[tool.commitizen.customize.questions]]
  105. choices = [
  106. {value = "feat", name = "feat: A new feature. Correlates with MINOR in SemVer"},
  107. {value = "fix", name = "fix: A bug fix. Correlates with PATCH in SemVer"},
  108. {value = "perf", name = "perf: A code change that improves performance. Correlates with PATCH in SemVer"},
  109. {value = "docs", name = "docs: Documentation only changes"},
  110. {value = "style", name = "style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"},
  111. {value = "refactor", name = "refactor: A code change that neither fixes a bug nor adds a feature"},
  112. {value = "test", name = "test: Adding missing or correcting existing tests"},
  113. {value = "build", name = "build: Changes that update the build system, development tools or external dependencies"},
  114. {value = "ci", name = "ci: Changes to our CI configuration files and scripts (example scopes: GitLabCI)"},
  115. {value = "revert", name = "revert: Reverting to previous commit(s)."}
  116. ]
  117. message = "Select the type of change you are committing"
  118. name = "change_type"
  119. type = "list"
  120. [[tool.commitizen.customize.questions]]
  121. message = "Body."
  122. name = "message"
  123. type = "input"
  124. [[tool.commitizen.customize.questions]]
  125. message = "Do you want to add body message in commit?"
  126. name = "show_message"
  127. type = "confirm"
  128. [tool.coverage.paths]
  129. source = ["src", "*/site-packages"]
  130. tests = ["tests", "*/tests"]
  131. [tool.coverage.report]
  132. # fail_under = 100
  133. exclude_lines = [
  134. "pragma: no cover"
  135. ]
  136. show_missing = true
  137. [tool.coverage.run]
  138. branch = true
  139. omit = ["*__init__.py"]
  140. source = ["dt_evolv", "tests"]
  141. [tool.hatch.envs.default]
  142. features = ["dev", "tests", "docs"]
  143. [tool.hatch.envs.default.scripts]
  144. # {args} e.g. "--increment PATCH"
  145. bump = [
  146. "cz bump --major-version-zero -ch {args}"
  147. ]
  148. ch = "cz ch --incremental --unreleased-version HEAD"
  149. clean = "rm -rf ./build .coverage ./__pycache__ ./.mypy_cache ./.pytest_cache ./docs/_build ./tests/__pycache__ ./dist ./src/dt_evolv/__pycache__"
  150. docs = "sphinx-build docs docs/_build"
  151. docserve = "python -m http.server 8000 -d docs/_build"
  152. init = [
  153. "pre-commit --version",
  154. "pre-commit install",
  155. "pre-commit install --hook-type commit-msg --hook-type pre-push"
  156. ]
  157. lint = [
  158. "pre-commit --version",
  159. "pre-commit run --all-files --show-diff-on-failure {args}" # No need for --hook-stage=manual
  160. ]
  161. [tool.hatch.envs.tests]
  162. features = ["tests"]
  163. template = "tests"
  164. [[tool.hatch.envs.tests.matrix]]
  165. python = ["3.12", "3.11"]
  166. [tool.hatch.envs.tests.scripts]
  167. all = ["test", "type", "xdoc", "cov"]
  168. cov = [
  169. "coverage combine",
  170. "coverage report",
  171. "coverage xml"
  172. ]
  173. test = "coverage run -p -m pytest"
  174. type = "mypy src tests docs/conf.py"
  175. xdoc = "python -m xdoctest dt_evolv all"
  176. [tool.isort]
  177. combine_as_imports = true
  178. force_single_line = false
  179. include_trailing_comma = true
  180. known_first_party = "dt_evolv"
  181. line_length = 88 # to match black's default line length
  182. multi_line_output = 3
  183. profile = "black"
  184. [tool.mypy]
  185. enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
  186. exclude = ""
  187. plugins = ["numpy.typing.mypy_plugin"]
  188. pretty = true
  189. show_column_numbers = true
  190. show_error_codes = true
  191. show_error_context = true
  192. strict = true
  193. warn_unreachable = true
  194. warn_unused_configs = true
  195. [tool.pylint.format]
  196. ignore-long-lines = "^\\s*(# )?<?https?://\\S+>?$|# type: ignore|# noqa:|# nosec \"|# pylint:"
  197. max-line-length = 88
  198. max-module-lines = 1600
  199. [tool.pylint.main]
  200. ignore-paths = [""]
  201. jobs = 0
  202. py-version = "3.12"
  203. [tool.pylint.messages_control]
  204. disable = [
  205. "invalid-name",
  206. "design",
  207. "fixme"
  208. ]
  209. [tool.pylint.refactoring]
  210. # Maximum number of nested blocks for function / method body
  211. max-nested-blocks = 8 # default 5
  212. [tool.pylint.reports]
  213. output-format = "colorized"
  214. [tool.pylsp-mypy]
  215. dmypy = false
  216. enabled = true
  217. live_mode = true
  218. strict = true
  219. [tool.ruff]
  220. extend-exclude = ["data/", "docs/202*.ipynb"]
  221. extend-include = ["*.ipynb"]
  222. force-exclude = true
  223. line-length = 88
  224. target-version = "py312"
  225. [tool.ruff.format]
  226. docstring-code-format = true
  227. [tool.ruff.lint]
  228. ignore = ["ANN101", "ANN102", "ISC001"]
  229. select = [
  230. "A", # builtins
  231. "ANN", # typing annotation
  232. "ARG", # unused arguments
  233. "B", # bugbear
  234. "BLE", # blind-except
  235. "C",
  236. "C4", # comprehensions
  237. "C90", # mccabe
  238. "D", # pydocstyle
  239. "DTZ", # dates
  240. "E", # pycodestyle
  241. "TRY", # exceptions
  242. "EM", # exceptions
  243. "ERA", # eradicate
  244. "F", # pyflakes
  245. "FBT", # boolean-trap
  246. "FLY", # flyntp
  247. "FURB", # refurbishing and modernizing
  248. "I", # isort
  249. "ICN", # import conventions (opinionated)
  250. "ISC", # implicit-str-concat
  251. "N", # pep8-naming
  252. "NPY",
  253. "AIR", # airflow
  254. "PERF", # pperformance anti pattern
  255. "PD", # pandas-vet
  256. "PGH", # pygrep WAIT
  257. "PL", # pylint see PLR2004...
  258. "PT", # pytest-style
  259. "PTH", # use-pathlib
  260. "Q", # quotes
  261. "RET", # Return
  262. "RSE", # Raise
  263. "RUF", # Ruff
  264. "S", # bandit XXX
  265. "SLF", # private self
  266. "SLOT", # __slot__
  267. "SIM", # simplify
  268. "TID", # tidy-imports
  269. "TCH", # TYPE_CHECKING
  270. "TRY", # tryceratops
  271. # "TD", # TODOs
  272. # "FIX", #
  273. "UP", # pyupgrade
  274. "YTT", # 2020
  275. "W" # pycodestyle
  276. ]
  277. isort.combine-as-imports = true
  278. isort.force-single-line = false
  279. isort.known-first-party = ["dt_evolv"]
  280. isort.split-on-trailing-comma = true
  281. mccabe.max-complexity = 12
  282. [tool.ruff.lint.per-file-ignores]
  283. "*.ipynb" = ["ERA", "E501", "ANN", "D", "EM", "TRY", "PLR", "PTH", "PLW2901", "F"]
  284. "__init__.py" = ["I002"] # don't need annotations
  285. "tests/*" = ["PLR2004", "S101"]
  286. [tool.ruff.lint.pydocstyle]
  287. convention = "numpy"