Files
ResInsight/GrpcInterface/Python/pyproject.toml
T
Magne Sjaastad d0d472aaa2 #14723 Python: Pin grpcio-tools to keep protobuf 6 gencode loadable
grpcio-tools 1.82.0+ (including its 1.82.0 pre-releases) bundles a
protoc that emits protobuf 7.35.x gencode, which no protobuf 6 runtime
can load. Pin grpcio-tools below that (excluding pre-releases via the
'.dev0' trick, since a plain '<1.82' bound already let a 1.82.0rc
release slip through once) and add a CI check that verifies the
generated *_pb2.py files stay within the protobuf floor declared in
pyproject.toml.

Only the load-bearing bounds are kept: protobuf's '>=6.33.5' floor
(must match the emitted gencode) and grpcio-tools' '<1.82.0.dev0'
ceiling. Non-load-bearing bounds (protobuf's '<8', grpcio-tools'
'>=1.81') were dropped since they don't change dependency resolution
or protect against anything the above doesn't already cover.
2026-09-11 05:46:28 -04:00

162 lines
4.8 KiB
TOML

[build-system]
requires = ["setuptools>=70.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "rips"
dynamic = ["version"]
description = "Python Interface for ResInsight"
readme = "README.md"
license = "GPL-3.0-or-later"
license-files = ["LICENSE"]
requires-python = ">=3.11"
authors = [{name = "Ceetron Solutions", email = "info@ceetronsolutions.com"}]
dependencies = [
"grpcio",
# Floor must match the gencode version emitted by the pinned grpcio-tools
# below: the protobuf runtime refuses to load gencode newer than itself.
# No upper bound: protobuf runtimes stay backward compatible with older
# gencode, so nothing here caps how new a runtime a user can install.
"protobuf>=6.33.5",
"typing_extensions",
]
[project.optional-dependencies]
dev = [
# 1.82.x bundles a protoc that emits protobuf 7.35.x gencode, which no
# protobuf 6 runtime can load - including its 1.82.0 pre-releases, which
# is why the bound goes below ".dev0" rather than just "<1.82": a plain
# "<1.82" bound already let a 1.82.0 release candidate slip through in
# CI once (pre-release versions sort below their final release).
# No lower bound: the resolver already prefers the newest version
# satisfying the upper bound, so ">=1.81" wasn't changing what gets
# installed, only guarding against a future resolver picking something
# much older if 1.81.x ever became unavailable.
# Generating 6.x gencode keeps rips importable on both 6.x and 7.x
# runtimes, so it stays installable next to packages that cap protobuf
# below 7 (ortools and friends).
"grpcio-tools<1.82.0.dev0",
"pytest",
"mypy",
"types-protobuf",
"packaging>=22.0",
]
[project.urls]
Homepage = "http://www.resinsight.org"
[tool.uv]
# Supply-chain hardening: never resolve/install packages published within the
# last week, to avoid pulling freshly published (potentially compromised)
# releases. CI also enforces this via the UV_EXCLUDE_NEWER env var, since this
# setting is only discovered when uv runs from this directory.
exclude-newer = "1 week"
[tool.setuptools.dynamic]
version = {attr = "rips._version.__version__"}
[tool.setuptools.packages.find]
include = ["rips*"]
[tool.setuptools.package-data]
rips = [
"py.typed",
"*.py",
"generated/*.py",
"PythonExamples/*.py",
"tests/*.py",
]
[tool.mypy]
python_version = "3.11"
show_error_codes = true
show_column_numbers = true
strict = true
ignore_missing_imports = true
implicit_reexport = true
allow_redefinition = false
strict_optional = true
warn_no_return = true
warn_unused_configs = true
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_return_any = true
strict_equality = true
[[tool.mypy.overrides]]
module = "rips.grpc_retry_interceptor.*"
disable_error_code = ["misc", "no-untyped-def", "no-untyped-call"]
[[tool.mypy.overrides]]
module = "rips.pdmobject.*"
disable_error_code = ["assignment", "return-value", "call-arg", "no-untyped-def", "no-untyped-call", "no-any-return"]
[[tool.mypy.overrides]]
module = "rips.case.*"
disable_error_code = ["no-untyped-def", "no-any-return"]
[[tool.mypy.overrides]]
module = "rips.grid.*"
disable_error_code = ["no-untyped-def", "no-untyped-call"]
[[tool.mypy.overrides]]
module = "rips.gridcasegroup.*"
disable_error_code = ["no-any-return", "no-untyped-def"]
[[tool.mypy.overrides]]
module = "rips.project.*"
disable_error_code = ["no-untyped-def", "no-any-return", "attr-defined"]
[[tool.mypy.overrides]]
module = "rips.well_log.*"
disable_error_code = ["attr-defined", "no-any-return"]
[[tool.mypy.overrides]]
module = "rips.well_log_plot.*"
disable_error_code = ["no-any-return"]
[[tool.mypy.overrides]]
module = "rips.well_path_collection.*"
disable_error_code = ["attr-defined"]
[[tool.mypy.overrides]]
module = "rips.contour_map.*"
disable_error_code = ["no-redef"]
[[tool.mypy.overrides]]
module = "rips.plot.*"
disable_error_code = ["no-untyped-def"]
[[tool.mypy.overrides]]
module = "rips.view.*"
disable_error_code = ["no-untyped-def"]
[[tool.mypy.overrides]]
module = "rips.instance.*"
disable_error_code = ["no-untyped-def", "no-untyped-call", "attr-defined"]
[[tool.mypy.overrides]]
module = "rips.well_path.*"
disable_error_code = ["attr-defined"]
[[tool.mypy.overrides]]
module = "rips.simulation_well.*"
disable_error_code = ["no-any-return", "attr-defined"]
[[tool.mypy.overrides]]
module = "rips.generated.generated_classes.*"
disable_error_code = ["no-any-return"]
[[tool.mypy.overrides]]
module = "rips.surface.*"
disable_error_code = ["attr-defined", "no-any-return"]
[[tool.mypy.overrides]]
module = "rips.category_mapping.*"
disable_error_code = ["attr-defined", "no-any-return"]