-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathpyproject.toml
More file actions
203 lines (179 loc) · 6.47 KB
/
pyproject.toml
File metadata and controls
203 lines (179 loc) · 6.47 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
[build-system]
requires = [
"setuptools>=77"
]
[project]
name = "megadetector"
version = "10.0.20"
description = "MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images."
readme = "README-package.md"
requires-python = ">=3.9,<3.14"
license = "MIT"
keywords = ["camera traps", "conservation", "wildlife", "ai", "megadetector"]
authors = [
{name = "Your friendly neighborhood MegaDetector team", email = "cameratraps@lila.science" }
]
maintainers = [
{name = "Your friendly neighborhood MegaDetector team", email = "cameratraps@lila.science" }
]
classifiers = [
"Programming Language :: Python :: 3",
]
dependencies = [
# Not imported directly, but we force this version to avoid this issue:
#
# https://github.com/pytorch/pytorch/issues/123097
#
# This is fixed in PyTorch >= 2.5, but for now, I don't want to require that.
"mkl == 2024.0; sys_platform != 'darwin'",
# To use ultralytics-yolov5's val.py, we need to use an old version of numpy,
# because of the removal of np.int in numpy 1.24.0. This is only necessary if
# you're going to use the full val.py suite in ultralytics-yolov5.
#
# numpy >= 1.26.4 is required for python >= 3.12
#
# "numpy >= 1.26.4, < 2.0",
"numpy >= 1.26.4",
# ultralytics-yolov5 has a dependency on FreeTypeFont.getsize(), which was
# removed in Pillow 10. Restrict to <10.0 if you want to use val.py from
# ultralytics-yolov5.
# "Pillow >= 9.5, <10",
"Pillow >= 9.5",
"tqdm >= 4.64.0",
"jsonpickle >= 3.0.2",
"humanfriendly >= 2.1",
"matplotlib >= 3.8.0",
"opencv-python >= 4.8.0",
"requests >= 2.31.0",
"fastquadtree >= 1.1.2",
"scikit-learn >= 1.3.1",
"pandas >= 2.1.1",
"python-dateutil",
"send2trash",
"clipboard",
"setuptools<82",
# Not imported directly, but required to de-serialize some models
"dill",
# Used for repo maintenance
"ruff",
"pytest",
# PyTorch/yolo stuff
#
# Note this is *not* the "ultralytics" package *or* the package called "yolov5". This
# is a snapshot of the yolov5 code base that predates Ultralytics's switch to an AGPL license.
"ultralytics-yolov5 == 0.1.1",
# Let the user install yolov9pip if they want to use YOLOv9 models.
#
# "yolov9pip == 0.0.4",
# Let ultralytics-yolov5 install torch
#
# "torch >= 2.0.1",
# "torchvision >= 0.15.2",
# Let the user install the ultralytics package if they want to use YOLOv11
# models.
#
# ultralytics
# PyTorch will get installed by ultralytics-yolov5
#
# "torch >= 2.0.1",
# "torchvision >= 0.15.2"
# This is a compatible alternative to ultralytics-yolov5, just keeping it
# here for posterity.
#
# "yolov5 == 7.0.13"
]
[project.urls]
"Homepage" = "https://github.com/agentmorris/MegaDetector"
"Documentation" = "https://megadetector.readthedocs.io"
"Bug Reports" = "https://github.com/agentmorris/MegaDetector/issues"
"Source" = "https://github.com/agentmorris/MegaDetector"
[tool.setuptools.packages.find]
include = ["megadetector*"]
[tool.ruff]
line-length = 120
target-version = "py39"
include = ["megadetector/**/*.py"]
exclude = ["megadetector/api/batch_processing/api_core/**/*.py",
"megadetector/classification/**/*.py",
"megadetector/api/batch_processing/api_support/**/*.py",
"megadetector/api/batch_processing/api_core_support/**/*.py",
"megadetector/api/batch_processing/integration/**/*.py",
"megadetector/api/synchronous/**/*.py",
"megadetector/**/__init__.py",
"megadetector/data_management/ocr_tools.py",
"megadetector/taxonomy_mapping/**/*.py"]
[tool.ruff.lint]
ignore = ["D212"]
select = [
"E", # Pycodestyle errors
"W", # Pycodestyle warnings
"F", # Pyflakes
"I", # Isort
"N", # pep8-naming
"D", # Pydocstyle
"UP", # Pyupgrade
"B" # flake8-bugbear
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"**/*.py" = [
# Comment/whitespace conventions that differ from ruff's defaults
"D415", # First line should end with a period, question mark, or exclamation point
"D202", # No blank lines allowed after function docstring
"D205", # 1 blank line required between summary line and description
# Coding conventions that differ from ruff's defaults
"UP032", # Use f-string instead of .format() call
"UP007", # Use X | Y for type unions
"UP045", # Use X | None for optional parameters
"UP015", # Unnecessary open mode parameters (open(filename,'r'))
"UP038", # Use X | Y in isinstance call instead of (X, Y)
"D200", # One-line docstring should fit on one line
"E702", # Multiple statements on one line (semicolon)
"B904", # Use "raise from" to specify whether this was an error during exception handling
"D107", # Missing docstring in __init__
"N813", # Camelcase imported as lowercase
"D105", # Missing docstring in magic method
"UP028", # Replace yield over yield from
# Debugging conveniences
"B007", # Loop control variable not used within loop body
# Deferring for later
"I001", # Import block is un-sorted or un-formatted
]
# These files have long, useful, single-line sample filenames in comments
"megadetector/detection/run_inference_with_yolov5_val.py" = ["E501"]
"megadetector/postprocessing/compare_batch_results.py" = ["E501"]
"megadetector/postprocessing/postprocess_batch_results.py" = ["E501"]
"megadetector/utils/wi_platform_utils.py" = ["E501"]
"megadetector/utils/wi_taxonomy_utils.py" = ["E501"]
# This file has lots of tests that open a file and does something with it
# on the same line.
"megadetector/utils/path_utils.py" = ["E701"]
[tool.ruff.lint.isort]
known-first-party = ["megadetector"]
order-by-type = true
force-single-line = false
force-sort-within-sections = true
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"local-folder"
]
[tool.pytest.ini_options]
# --assert=plain fixes a scipy compatibility issue
# --import-mode=importlib makes import behavior more predictable, and makes
# it easiest to manage the odd stuff we do w/yolov5
# -sv enables normal stdout behavior and makes pytest verbose
addopts = "--assert=plain --import-mode=importlib -sv"
testpaths = ["megadetector"]
python_files = ["*.py"]
python_functions = ["test_*"]
python_classes = []
# Only add repo root to the python path, not subdirectories
pythonpath = ["."]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::PendingDeprecationWarning",
]