-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
232 lines (201 loc) · 5.8 KB
/
pyproject.toml
File metadata and controls
232 lines (201 loc) · 5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "geogenalg"
requires-python = ">=3.11"
authors = [
{ name = "National Land Survey of Finland", email = "os@nls.fi" },
]
license = "MIT"
license-files = ["LICENSE"]
classifiers = [
"Development Status :: 3 - Alpha",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries",
"Typing :: Typed",
]
description = "A Python library to perform cartogaphic generalizations."
keywords = [
"gis",
"cartography",
"generalization",
]
dynamic = [
"readme",
"version",
]
dependencies = [
"cartagen>=1.0.2",
"geopandas==1.1.2",
"networkx==3.4.2",
"pydantic>=2.13.3",
"pygeoops==0.4.0",
"scikit-learn==1.6.1",
"shapely==2.1.2",
"shapelysmooth==0.2.1",
]
[project.optional-dependencies]
cli = [
"typer>=0.19.2",
]
[project.urls]
Homepage = "https://github.com/nlsfi/geogen-algorithms"
Changelog = "https://github.com/nlsfi/geogen-algorithms/blob/main/CHANGELOG.md"
[project.scripts]
generalize = "geogenalg.main:main"
[tool.setuptools]
include-package-data = false
[tool.setuptools.package-dir]
"" = "src"
[tool.setuptools.packages.find]
where = ["src"]
namespaces = false
[tool.setuptools.package-data]
geogenalg = [
"py.typed",
]
[tool.setuptools.dynamic.readme]
file = [
"README.md",
"CHANGELOG.md",
]
content-type = "text/markdown"
[tool.setuptools.dynamic]
version = { attr = "geogenalg.__version__" }
[tool.uv]
default-groups = ["dev", "lint"]
[dependency-groups]
dev = [
"pre-commit>=4.2.0",
"pytest>=8.4.1",
"pytest-cov>=6.2.1",
"pytest-dotenv>=0.5.2",
"pytest-mock>=3.14.1",
"pytest-rerunfailures>=15.1",
"pytest-subtests>=0.14.2",
"pytest-timeout>=2.4.0",
]
lint = [
"flake8>=7.3.0",
"flake8-pyproject>=1.2.3",
"flake8-spellcheck>=0.28.0",
"mypy>=1.16.1",
"pandas-stubs==2.2.3.241126",
"ruff>=0.12.0",
]
[tool.ruff]
target-version = "py312"
line-length = 88
# TODO: remove exclude section when railroads algorithm is refactored/reimplemented
exclude = [
"src/geogenalg/application/railroads.py",
]
lint.ignore = [
"FIX", # flake8-fixme
"TD002", # Missing author in TODO
"TD003", # Missing issue link for this TODO
"D104", # Missing docstring in public package
"D100", # Missing docstring in public module
# Conflicting rules (formatter)
"D203", # one-blank-line-before-class, D211 used (no-blank-line-before-class)
"D213", # multi-line-summary-second-line, D212 used (multi-line-summary-first-line)
"COM812", # missing-trailing-comma (formatter will enforce this)
"ISC001", # single-line-implicit-string-concatenation
]
# List of all rules https://docs.astral.sh/ruff/rules/
lint.select = ["ALL"]
# Avoid flagging (and removing) `SC200` from any `# noqa`
# directives, despite Ruff's lack of support for `flake8-spellcheck`.
lint.external = ["SC200"]
lint.unfixable = [
"F401", # Unused imports
]
extend-exclude = ["setup.py"]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.flake8-implicit-str-concat]
allow-multiline = false
[tool.ruff.lint.flake8-import-conventions]
[tool.ruff.lint.flake8-import-conventions.aliases]
pandas = "pd"
geopandas = "gpd"
[tool.ruff.lint.per-file-ignores]
"src/geogenalg/core/exceptions.py" = [
"D101", # Missing docstring in public class
]
"test/*" = [
"INP001", # implicit-namespace-package
"D", # pydocstyle
"DTZ", # flake8-datetimez
"FBT", # flake8-boolean-trap
"TD", # flake8-todos
"S", # flake8-bandit
"SLF", # flake8-self
"ANN201", # Missing return type annotation for public function
"E501", # Line too long
"PLR2004", # Magic value used in comparison, consider replacing `2000` with a constant variable
"PLR0913", # Too many arguments in function definition
"PLR0917", # Too many positional arguments
"ARG001", # Unused function argument
"PLC2701", # import-private-name
"PLR6301", # no-self-use
]
".github/*" = [
"D", # pydocstyle
"CPY", # Missing copyright notice at top of file
"INP001", # implicit-namespace-package
]
"src/geogenalg/main.py" = [
"PLR0913", # too-many-arguments
"PLR0917", # too-many-positional-arguments
]
"tools/*" = [
"INP001",
"D103", # Missing docstring in public function
"D100", # Missing docstring in public module
"T201", # `print` found
]
[tool.flake8]
spellcheck-targets = "names"
dictionaries = "en_US,python,technical,pandas"
select = ["SC"]
per-file-ignores = ["test/*:SC200"]
# TODO: remove exclude section when railroads algorithm is refactored/reimplemented
exclude = """
# railroads has lots of ambiguous variable names etc
src/geogenalg/application/railroads.py
"""
[tool.mypy]
python_version = "3.12"
follow_imports = "normal"
show_column_numbers = true
explicit_package_bases = true
[[tool.mypy.overrides]]
module = "geopandas,geopandas.testing,sklearn"
ignore_missing_imports = true
[tool.pytest.ini_options]
minversion = "7.0"
testpaths = ["test"]
filterwarnings = [
# Occurs in pyogrio, can't really be controlled on our side.
"ignore:The 'shapely.geos' module is deprecated:DeprecationWarning",
# Occurs in pyogrio (or really GDAL), caused by test data having timestamps with non-UTC timezone.
"ignore:Non-conformant content for record:RuntimeWarning",
]
[tool.coverage.paths]
source = ["src", "**/site-packages"]
[tool.coverage.run]
branch = true
source_pkgs = ["geogenalg"]
# TODO: remove exclude section when railroads algorithm is refactored/reimplemented
omit = [
"src/geogenalg/application/railroads.py",
]
[tool.coverage.report]
exclude_also = [
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"raise NotImplementedError",
]