Skip to content

Commit 22ad813

Browse files
build: bump python to 3.12 (#101)
* build: allow python 3.12 install with DVE deal with typing issue on get_type_hints generated from bumping from 3.11 to 3.12 * style: upgrade pylint and dependencies and fix linting following upgrade * build: upgrade pydantic from 1.10.16 -> 1.10.19 removed previous typing fix as pydantic upgrade fixes the typing issues in 3.12 * refactor: remove previously missed typing fix no longer needed * build: lock all dependency versions * build: upgrade moto to a supported python 3.12 version * build: upgrade isort to version supported by python 3.12 * build: upgrade mypy to version supporting python 3.12 * build: update xlsx2csv to supported python 3.12 version and removed faker dependency
1 parent a6a0c36 commit 22ad813

14 files changed

Lines changed: 286 additions & 448 deletions

File tree

.mise.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[tools]
2-
python="3.11"
2+
python="3.12"
33
poetry="2.3.3"
44
java="liberica-1.8.0"

poetry.lock

Lines changed: 231 additions & 277 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pylint_checkers/check_typing_imports.py

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

pyproject.toml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ packages = [
3030
]
3131

3232
[tool.poetry.dependencies]
33-
python = ">=3.10,<3.12"
33+
python = ">=3.10,<3.13" # breaking changes beyond 3.12
3434
boto3 = ">=1.34.162,<1.36" # breaking change beyond 1.36
3535
botocore = ">=1.34.162,<1.36" # breaking change beyond 1.36
3636
delta-spark = "2.4.*"
37-
duckdb = "1.1.*" # breaking changes beyond 1.1
38-
Jinja2 = "3.1.*"
39-
lxml = "^4.9.1"
37+
duckdb = "1.1.3" # breaking changes beyond 1.1
38+
Jinja2 = "3.1.6"
39+
lxml = "4.9.4"
4040
numpy = "1.26.4"
41-
openpyxl = "^3.1"
42-
pandas = "^2.2.2"
43-
polars = "0.20.*"
44-
pyarrow = "^17.0.0"
45-
pydantic = "1.10.16"
41+
openpyxl = "3.1.5"
42+
pandas = "2.3.3"
43+
polars = "0.20.31"
44+
pyarrow = "17.0.0"
45+
pydantic = "1.10.19"
4646
pyspark = "3.4.*"
47-
typing_extensions = "^4.6.2"
47+
typing_extensions = "4.15.0"
4848

4949
[tool.poetry.group.dev]
5050
optional = true
@@ -58,30 +58,29 @@ commitizen = "4.9.1"
5858
pre-commit = "4.3.0"
5959
charset-normalizer = "3.4.6"
6060
python-discovery = "1.2.0"
61-
requests = "2.33.0"
6261

6362
[tool.poetry.group.test]
6463
optional = true
6564

6665
[tool.poetry.group.test.dependencies]
67-
faker = "18.11.1"
6866
behave = "1.3.3"
6967
coverage = "7.11.0"
70-
moto = {extras = ["s3"], version = "4.0.13"}
68+
moto = {extras = ["s3"], version = "4.2.14"}
69+
requests = "2.33.0" # dependency of `moto`
7170
Werkzeug = "3.1.6"
7271
pytest = "8.4.2"
7372
pytest-lazy-fixtures = "1.4.0" # switched from https://github.com/TvoroG/pytest-lazy-fixture as it's no longer supported
74-
xlsx2csv = "0.8.2"
73+
xlsx2csv = "0.8.4" # polars requirement
7574

7675
[tool.poetry.group.lint]
7776
optional = true
7877

7978
[tool.poetry.group.lint.dependencies]
8079
black = "24.3.0"
81-
astroid = "2.14.2"
82-
isort = "5.11.5"
83-
pylint = "2.16.4"
84-
mypy = "0.991"
80+
astroid = "3.3.9"
81+
isort = "5.13.2"
82+
pylint = "3.3.9"
83+
mypy = "1.11.2"
8584
boto3-stubs = {extras = ["essential"], version = "1.26.72"}
8685
botocore-stubs = "1.29.72"
8786
pandas-stubs = "1.2.0.62"
@@ -100,7 +99,7 @@ optional = true
10099

101100
[tool.poetry.group.docs.dependencies]
102101
click = "8.2.1"
103-
mkdocs = "^1.6.1"
102+
mkdocs = "1.6.1"
104103
mkdocstrings = { version = "1.0.3", extras = ["python"] }
105104
griffelib = "2.0.1"
106105
pymdown-extensions = "10.21.2"
@@ -142,10 +141,6 @@ source_pkgs = [
142141
[tool.coverage.report]
143142
show_missing = true
144143

145-
[tool.pylint]
146-
init-hook = "import sys; sys.path.append('./pylint_checkers')"
147-
load-plugins = "check_typing_imports"
148-
149144
[tool.pylint.main]
150145
extension-pkg-allow-list = ["pyspark", "lxml", "pydantic"]
151146
fail-under = 10.0
@@ -194,7 +189,7 @@ max-statements = 50
194189
min-public-methods = 2
195190

196191
[tool.pylint.exceptions]
197-
overgeneral-exceptions = ["BaseException", "Exception"]
192+
overgeneral-exceptions = ["builtins.BaseException", "builtins.Exception"]
198193

199194
[tool.pylint.format]
200195
ignore-long-lines = "^\\s*(# )?<?https?://\\S+>?$"
@@ -229,6 +224,8 @@ disable = [
229224
"use-symbolic-message-instead",
230225
"logging-fstring-interpolation",
231226
"fixme",
227+
"too-many-positional-arguments",
228+
"too-many-arguments",
232229
]
233230
enable = ["c-extension-no-member"]
234231

src/dve/core_engine/backends/implementations/duckdb/rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _add_cnst_field(rel: DuckDBPyRelation) -> tuple[str, DuckDBPyRelation]:
152152
group_pl = entity.pl().pivot(
153153
columns=[config.pivot_column],
154154
values=agg_cols,
155-
index=(group_cols or [const_fld]),
155+
index=(group_cols or [const_fld]), # pylint: disable=E0606
156156
aggregate_function=config.agg_function,
157157
)
158158
if const_fld in group_pl.columns:

src/dve/core_engine/backends/metadata/contract.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def schemas(self) -> dict[EntityName, type[BaseModel]]:
4444
"""The per-entity schemas, as pydantic models."""
4545
if not self._schemas:
4646
for entity_name, validator in self.validators.items():
47-
self._schemas[entity_name] = validator.model # type: ignore
48-
return self._schemas.copy()
47+
self._schemas[entity_name] = validator.model # type: ignore # pylint: disable=E1137
48+
return self._schemas.copy() # pylint: disable=E1101
4949

5050
@root_validator(allow_reuse=True)
5151
@classmethod

src/dve/core_engine/backends/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def stringify_type(type_: Union[type, GenericAlias]) -> type:
5252

5353
origin = get_origin(type_)
5454
if origin is None: # A non-generic container type, return as-is
55-
return type_
55+
return type_ # type: ignore
5656

5757
type_args = get_args(type_)
5858
if not type_args:

src/dve/core_engine/configuration/v1/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
FieldName = str
4040
"""The name of a field within a model/schema."""
41-
TypeOrDef = Union[
41+
TypeOrDef = Union[ # pylint: disable=C0103
4242
TypeName, "_CallableTypeDefinition", "_ModelTypeDefinition", "_TypeAliasDefinition"
4343
]
4444
"""The name or definition of a type."""
@@ -181,7 +181,7 @@ class V1EngineConfig(BaseEngineConfig):
181181
@validate_arguments
182182
def _update_rule_store(self, rule_store: dict[RuleName, BusinessComponentSpecConfigUnion]):
183183
"""Update the rule store rules to add/override the rules from the new store."""
184-
self._rule_store_rules.update(rule_store)
184+
self._rule_store_rules.update(rule_store) # pylint: disable=E1101
185185

186186
def _load_rule_store(self, uri: URI):
187187
"""Load a JSON rule store from the provided URI and update the stored
@@ -198,7 +198,7 @@ def _load_rule_store(self, uri: URI):
198198
def __init__(self, *args, **kwargs):
199199
super().__init__(*args, **kwargs)
200200
uri_prefix = self.location.rsplit("/", 1)[0]
201-
for rule_store_config in self.transformations.rule_stores:
201+
for rule_store_config in self.transformations.rule_stores: # pylint: disable=E1101
202202
uri = joinuri(uri_prefix, rule_store_config.filename)
203203
self._load_rule_store(uri)
204204

@@ -281,7 +281,7 @@ def _load_rules_and_vars(self) -> tuple[list[Rule], list[TemplateVariables]]:
281281
rules, local_variable_list = [], []
282282
added_rules: set[RuleName] = set()
283283

284-
for index, complex_rule_config in enumerate(self.transformations.complex_rules):
284+
for index, complex_rule_config in enumerate(self.transformations.complex_rules): # pylint: disable=E1101
285285
rule, local_params, deps = self._resolve_business_rule(complex_rule_config)
286286
missing_rules = deps - added_rules
287287
if missing_rules:
@@ -295,9 +295,9 @@ def _load_rules_and_vars(self) -> tuple[list[Rule], list[TemplateVariables]]:
295295

296296
rule, local_params = self._create_rule(
297297
name="root",
298-
rules=self.transformations.rules,
299-
filters=self.transformations.filters,
300-
post_filter_rules=self.transformations.post_filter_rules,
298+
rules=self.transformations.rules, # pylint: disable=E1101
299+
filters=self.transformations.filters, # pylint: disable=E1101
300+
post_filter_rules=self.transformations.post_filter_rules, # pylint: disable=E1101
301301
)
302302
rules.append(rule)
303303
local_variable_list.append(local_params)
@@ -338,14 +338,14 @@ def load_error_message_info(self, uri):
338338

339339
def get_reference_data_config(self) -> dict[EntityName, ReferenceConfig]: # type: ignore
340340
"""Gets the reference data configuration from the transformations"""
341-
return self.transformations.reference_data
341+
return self.transformations.reference_data # pylint: disable=E1101
342342

343343
def get_rule_metadata(self) -> RuleMetadata:
344344
"""Gets the rule metadata from the Engine configuration"""
345345
rules, local_variables = self._load_rules_and_vars()
346346
return RuleMetadata(
347347
rules=rules,
348348
local_variables=local_variables,
349-
global_variables=self.transformations.parameters,
349+
global_variables=self.transformations.parameters, # pylint: disable=E1101
350350
reference_data_config=self.get_reference_data_config(),
351351
)

src/dve/core_engine/engine.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def build(
137137
debug=debug,
138138
**kwargs,
139139
)
140-
self.main_log.info(f"Output path: {self.output_prefix_uri!r}")
140+
self.main_log.info(f"Output path: {self.output_prefix_uri!r}") # pylint: disable=E1101
141141
return self
142142

143143
@classmethod
@@ -155,13 +155,13 @@ def build_from_model(cls, model_str: JSONstring):
155155
return cls.build(**EngineRunValidation(**json.loads(model_str)).dict())
156156

157157
def __enter__(self) -> "CoreEngine":
158-
self.main_log.info("Entering pipeline context.")
158+
self.main_log.info("Entering pipeline context.") # pylint: disable=E1101
159159
if self._cache_dir is not None:
160160
raise ValueError("Pipeline already within context")
161161

162162
self._cache_dir = TemporaryPrefix(self.cache_prefix_uri)
163163
self._cache_dir.__enter__()
164-
self.main_log.info(f"Pipeline will cache to {self.cache_prefix!r}")
164+
self.main_log.info(f"Pipeline will cache to {self.cache_prefix!r}") # pylint: disable=E1101
165165
return self
166166

167167
def __exit__(
@@ -170,14 +170,14 @@ def __exit__(
170170
exc_value: Optional[Exception],
171171
traceback: Optional[TracebackType],
172172
) -> None:
173-
self.main_log.info(f"Exiting pipeline context, clearing {self.cache_prefix!r}")
173+
self.main_log.info(f"Exiting pipeline context, clearing {self.cache_prefix!r}") # pylint: disable=E1101
174174
cache_dir = self._cache_dir
175175
self._cache_dir = None
176176

177177
if cache_dir is not None:
178178
cache_dir.__exit__(exc_type, exc_value, traceback)
179179

180-
self.main_log.info("Cleared cache.")
180+
self.main_log.info("Cleared cache.") # pylint: disable=E1101
181181

182182
@property
183183
def cache_prefix(self) -> URI:
@@ -198,17 +198,17 @@ def _write_entity_outputs(self, entities: SparkEntities) -> SparkEntities:
198198
"""
199199
output_entities = {}
200200

201-
self.main_log.info(f"Writing entities to the output location: {self.output_prefix_uri}")
201+
self.main_log.info(f"Writing entities to the output location: {self.output_prefix_uri}") # pylint: disable=E1101
202202
for entity_name, entity in entities.items():
203203
entity = entity.drop(RECORD_INDEX_COLUMN_NAME)
204204

205-
self.main_log.info(f"Entity: {entity_name} {type(entity)}")
205+
self.main_log.info(f"Entity: {entity_name} {type(entity)}") # pylint: disable=E1101
206206

207207
output_uri = joinuri(self.output_prefix_uri, entity_name)
208208
if get_resource_exists(output_uri):
209-
self.main_log.info(f"{output_uri} already exists - will be overwritten")
209+
self.main_log.info(f"{output_uri} already exists - will be overwritten") # pylint: disable=E1101
210210

211-
self.main_log.info(f"+ Writing parquet output to {output_uri!r}")
211+
self.main_log.info(f"+ Writing parquet output to {output_uri!r}") # pylint: disable=E1101
212212
entity.write.mode("overwrite").parquet(output_uri)
213213
spark_session = SparkSession.builder.getOrCreate()
214214
output_entities[entity_name] = spark_session.read.format("parquet").load(
@@ -228,7 +228,7 @@ def _write_outputs(self, entities: SparkEntities) -> SparkEntities:
228228

229229
def _show_available_entities(self, entities: SparkEntities, *, verbose: bool = False) -> None:
230230
"""Print current entities."""
231-
self.main_log.info("Displaying available dataframes in this run:")
231+
self.main_log.info("Displaying available dataframes in this run:") # pylint: disable=E1101
232232

233233
for entity_name, entity in entities.items():
234234
# FIXME: Currently a print statement because log messages

0 commit comments

Comments
 (0)