-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
211 lines (195 loc) · 6.62 KB
/
Copy pathpyproject.toml
File metadata and controls
211 lines (195 loc) · 6.62 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
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "oilpriceapi"
version = "1.10.1"
description = "Official Python SDK for OilPriceAPI - Real-time and historical oil prices"
authors = [
{name = "OilPriceAPI", email = "support@oilpriceapi.com"}
]
maintainers = [
{name = "OilPriceAPI Team", email = "support@oilpriceapi.com"}
]
readme = "README.md"
license = {file = "LICENSE"}
keywords = [
"oil", "prices", "api", "commodities", "energy",
"brent", "wti", "natural gas", "trading", "finance"
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Financial and Insurance Industry",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business :: Financial",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
requires-python = ">=3.8"
dependencies = [
"httpx>=0.24.0",
"pydantic>=2.0.0",
"python-dateutil>=2.8.0",
"typing-extensions>=4.5.0; python_version < '3.10'",
]
[project.optional-dependencies]
pandas = [
"pandas>=1.5.0",
"numpy>=1.20.0",
]
async = []
stream = [
"websockets>=11.0",
]
cache = [
"redis>=4.5.0",
"cachetools>=5.3.0",
]
cli = [
"click>=8.0.0",
"rich>=13.0.0",
]
all = [
"oilpriceapi[pandas,async,stream,cache,cli]",
]
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-asyncio>=0.21.0",
"pytest-timeout>=2.1.0",
"black>=23.0.0",
# Pin <3 defensively: mypy 2.x tightened defaults and rejected the old
# python_version="3.8" config, which contributed to CI going red.
"mypy>=1.0.0,<3",
"ruff>=0.0.261",
"pre-commit>=3.0.0",
# WebSocket streaming extra — needed so the streaming unit tests can
# import `websockets` in CI.
"websockets>=11.0",
]
[project.urls]
Homepage = "https://oilpriceapi.com"
Documentation = "https://docs.oilpriceapi.com/sdk/python"
Repository = "https://github.com/oilpriceapi/python-sdk"
Issues = "https://github.com/oilpriceapi/python-sdk/issues"
Changelog = "https://github.com/oilpriceapi/python-sdk/blob/main/CHANGELOG.md"
[project.scripts]
oilprice = "oilpriceapi.cli:main"
[tool.setuptools.packages.find]
where = ["."]
include = ["oilpriceapi*"]
exclude = ["tests*"]
[tool.setuptools.package-data]
oilpriceapi = ["py.typed"]
[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311']
include = '\.pyi?$'
[tool.ruff]
line-length = 100
target-version = "py38"
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
]
ignore = [
"E501", # line too long (handled by formatter)
"E402", # module import not at top (needed for conditional imports)
"B028", # no explicit stacklevel (pre-existing in visualization.py)
"B904", # raise-without-from (pre-existing pattern in retry loops)
"C408", # unnecessary dict() call (pre-existing in visualization.py)
]
fixable = ["ALL"]
[tool.mypy]
# Type-check target; mypy 2.x requires >=3.10 (it rejects "3.8"). The package
# itself still supports Python >=3.8 (see requires-python above); python_version
# here only controls which language features mypy assumes when type-checking.
python_version = "3.10"
strict = true
warn_return_any = true
warn_unused_configs = true
no_implicit_reexport = true
namespace_packages = true
show_error_codes = true
show_column_numbers = true
pretty = true
# --- Gradual typing baseline (CI was non-blocking for mypy until v1.7.0) ---
# The SDK is not yet fully annotated. Until v1.7.0 the mypy CI step ran with
# `continue-on-error: true`, so ~700 "annotation completeness" findings (missing
# annotations / returning Any) never blocked merges. v1.7.0 made the step
# blocking. We:
# 1. Relax ONLY the annotation-completeness checks package-wide (the legitimate
# "we haven't finished typing the SDK" debt), keeping every bug-catching
# check (assignment, arg-type, union-attr, etc.) active.
# 2. Keep modules that are fully strict-clean under FULL strict checking so
# they cannot regress.
#
# The previous per-module `TODO(typing-debt)` overrides (client, async_client,
# cli, telemetry, prices, alerts, analytics, data_sources, webhooks, and the
# package __init__) have all been PAID DOWN — the real type errors were fixed
# with proper annotations, so those overrides were removed.
[[tool.mypy.overrides]]
module = "oilpriceapi.*"
disable_error_code = ["no-untyped-def", "no-any-return", "no-untyped-call"]
# Modules already fully strict-clean — keep them strict so they can't regress.
[[tool.mypy.overrides]]
module = ["oilpriceapi.resources.forecasts", "oilpriceapi.resources.drilling"]
disable_error_code = []
# models.py optionally imports `dateutil` for a fallback timestamp parse. The
# stub package (types-python-dateutil) is not a runtime/CI dependency, so this
# is a missing-stub finding, not a real typing bug.
[[tool.mypy.overrides]]
module = "oilpriceapi.models"
disable_error_code = ["import-untyped"]
[tool.pytest.ini_options]
minversion = "7.0"
testpaths = ["tests"]
pythonpath = ["."]
addopts = [
"--cov=oilpriceapi",
"--cov-report=term-missing",
"--cov-report=html",
"--cov-report=xml",
"--cov-fail-under=50",
"-v",
]
markers = [
"integration: marks tests as integration tests (calls real API)",
"contract: marks tests as contract tests (validates API assumptions)",
"slow: marks tests as slow running (deselect with '-m \"not slow\"')",
"unit: marks tests as unit tests (fast, mocked)",
"live: marks tests that hit the real API (require OILPRICEAPI_TEST_KEY)",
"live: marks tests that hit the public live demo API (no API key needed)",
]
[tool.coverage.run]
source = ["oilpriceapi"]
omit = [
"*/tests/*",
"*/test_*.py",
# Optional-extra modules requiring [cli] / matplotlib+pandas, not
# installed in the base unit-test environment, so not exercised by
# the publish gate. Excluded from coverage measurement.
"oilpriceapi/cli.py",
"oilpriceapi/visualization.py",
]
[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = false
[tool.coverage.html]
directory = "htmlcov"