Skip to content

Commit dcdaa61

Browse files
committed
reverted toml; tests and build work
1 parent ec4157e commit dcdaa61

File tree

7 files changed

+316
-489
lines changed

7 files changed

+316
-489
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ check: ## Run code quality tools.
1818
.PHONY: test
1919
test: ## Test the code with pytest
2020
@echo "🚀 Testing code: Running pytest"
21-
@uv run python -m pytest --cov --cov-config=pyproject.toml --cov-report=xml
21+
@uv run python -m pytest # --cov --cov-config=pyproject.toml --cov-report=xml
2222

2323
.PHONY: build
2424
build: clean-build ## Build wheel file

TODO

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- consider toml-sort to keep pyproject.toml in a canonical order

pyproject.toml

Lines changed: 99 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
[project]
2-
name = "python-package"
2+
name = "biocommons-example"
33
authors = [
44
{ name = "biocommons contributors", email = "[email protected]" },
55
]
6-
description = "Example Package"
6+
description = "biocommons.example package (namespaced)"
77
readme = "README.md"
8-
license = "Apache-2.0"
8+
license = "MIT"
99
requires-python = ">=3.10"
1010
classifiers = [
11-
"Intended Audience :: Developers",
12-
"Programming Language :: Python",
1311
"Programming Language :: Python :: 3",
14-
"Programming Language :: Python :: 3.9",
1512
"Programming Language :: Python :: 3.10",
1613
"Programming Language :: Python :: 3.11",
1714
"Programming Language :: Python :: 3.12",
18-
"Programming Language :: Python :: 3.13",
19-
"Topic :: Software Development :: Libraries :: Python Modules",
15+
"Operating System :: OS Independent",
2016
]
2117
dynamic = ["version"]
2218
dependencies = ["coloredlogs ~= 15.0", "pyyaml ~= 6.0"]
2319

2420
[project.optional-dependencies]
21+
dev = [
22+
"build ~= 0.8",
23+
"ipython ~= 8.4",
24+
"pre-commit ~= 3.4",
25+
"ruff == 0.4.4",
26+
]
2527
tests = [
2628
"pytest-cov ~= 4.1",
2729
"pytest ~= 7.1",
@@ -34,28 +36,15 @@ docs = ["mkdocs"]
3436
marvin-quote = "biocommons.example.__main__:main"
3537

3638
[project.urls]
37-
Homepage = "https://biocommons.github.io/python-package/"
38-
Repository = "https://github.com/biocommons/python-package"
39-
Documentation = "https://biocommons.github.io/python-package/"
39+
"Homepage" = "https://github.com/biocommons/biocommons.example"
40+
"Bug Tracker" = "https://github.com/biocommons/biocommons.example/issues"
4041

41-
[dependency-groups]
42-
dev = [
43-
"pytest>=7.2.0",
44-
"pre-commit>=2.20.0",
45-
"tox-uv>=1.11.3",
46-
"deptry>=0.23.0",
47-
"ty>=0.0.1a16",
48-
"pytest-cov>=4.0.0",
49-
"ruff>=0.11.5",
50-
"mkdocs>=1.4.2",
51-
"mkdocs-material>=8.5.10",
52-
"mkdocstrings[python]>=0.26.1",
53-
]
5442

5543
[build-system]
5644
requires = ["setuptools >= 70.1", "setuptools_scm[toml] ~= 8.1"]
5745
build-backend = "setuptools.build_meta"
5846

47+
5948
[tool.setuptools]
6049
include-package-data = true
6150

@@ -70,70 +59,106 @@ namespaces = true
7059

7160
[tool.setuptools_scm]
7261

73-
[tool.hatch.build.targets.wheel]
74-
packages = ["src/python_package"]
75-
76-
[tool.ty.environment]
77-
python = "./.venv"
78-
python-version = "3.9"
7962

63+
# https://docs.pytest.org/en/6.2.x/customize.html#pyproject-toml
8064
[tool.pytest.ini_options]
81-
testpaths = ["tests"]
65+
addopts = "-s -v -x --strict-markers -m 'not extra' --doctest-modules --cov=src"
66+
doctest_optionflags = [
67+
"ALLOW_BYTES",
68+
"ALLOW_UNICODE",
69+
"ELLIPSIS",
70+
"IGNORE_EXCEPTION_DETAIL",
71+
"NORMALIZE_WHITESPACE",
72+
]
73+
markers = [
74+
"network: tests that require network connectivity",
75+
"slow: slow tests that should be run infrequently",
76+
]
77+
78+
79+
[tool.coverage.run]
80+
branch = true
81+
omit = ["*_test.py", "*/test/*", "*/tests/*"]
82+
83+
84+
[tool.coverage.report]
85+
show_missing = true
86+
exclude_lines = [
87+
# Have to re-enable the standard pragma
88+
"pragma: no cover",
89+
90+
# Don't complain about missing debug-only code:
91+
"def __repr__",
92+
"if self.debug",
93+
94+
# Don't complain if tests don't hit defensive assertion code:
95+
"raise AssertionError",
96+
"raise NotImplementedError",
97+
98+
# Don't complain if non-runnable code isn't run:
99+
"if __name__ == .__main__.:",
100+
]
82101

83102
[tool.ruff]
84-
target-version = "py39"
85-
line-length = 120
86-
fix = true
103+
src = ["src", "tests"]
104+
line-length = 100
87105

88106
[tool.ruff.lint]
89107
select = [
90-
# flake8-2020
91-
"YTT",
92-
# flake8-bandit
93-
"S",
94-
# flake8-bugbear
108+
"F", # https://docs.astral.sh/ruff/rules/#pyflakes-f
109+
"E",
110+
"W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
111+
"I", # https://docs.astral.sh/ruff/rules/#isort-i
112+
"N", # https://docs.astral.sh/ruff/rules/#pep8-naming-n
113+
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
114+
"YTT", # https://docs.astral.sh/ruff/rules/#flake8-2020-ytt
115+
"S", # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
116+
"B", # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
117+
"A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
118+
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
119+
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
120+
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
121+
"LOG", # https://docs.astral.sh/ruff/rules/#flake8-logging-log
122+
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
123+
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
124+
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
125+
"RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
126+
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
127+
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
128+
"ARG", # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
129+
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
130+
"PL", # https://docs.astral.sh/ruff/rules/#pylint-pl
131+
"TRY", # https://docs.astral.sh/ruff/rules/#tryceratops-try
132+
"PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf
133+
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
134+
]
135+
fixable = [
136+
"F401",
137+
"F541",
138+
"I",
139+
"D",
140+
"UP",
95141
"B",
96-
# flake8-builtins
97-
"A",
98-
# flake8-comprehensions
99142
"C4",
100-
# flake8-debugger
101-
"T10",
102-
# flake8-simplify
143+
"EM",
144+
"PIE",
145+
"PT",
146+
"RSE",
147+
"RET",
103148
"SIM",
104-
# isort
105-
"I",
106-
# mccabe
107-
"C90",
108-
# pycodestyle
109-
"E", "W",
110-
# pyflakes
111-
"F",
112-
# pygrep-hooks
113-
"PGH",
114-
# pyupgrade
115-
"UP",
116-
# ruff
149+
"PERF",
117150
"RUF",
118-
# tryceratops
119-
"TRY",
120151
]
121152
ignore = [
122-
# LineTooLong
123-
"E501",
124-
# DoNotAssignLambda
125-
"E731",
153+
# ignore for compatibility with formatter
154+
"W191",
155+
"E111",
156+
"E114",
157+
"E117",
158+
"S321",
159+
# other
160+
"PLR0913",
126161
]
127162

128163
[tool.ruff.lint.per-file-ignores]
129164
"tests/*" = ["S101"]
130-
131-
[tool.ruff.format]
132-
preview = true
133-
134-
[tool.coverage.report]
135-
skip_empty = true
136-
137-
[tool.coverage.run]
138-
branch = true
139-
source = ["src"]

src/python_package/__init__.py

Whitespace-only changes.

src/python_package/foo.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/test_foo.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)