Skip to content

Commit

Permalink
[PYG-231] 😶 Require 3.10 (#309)
Browse files Browse the repository at this point in the history
* build: Require 3.10

* build: upgrade toolkit

* build; changelog

* refactor: regen

* build: pydantic v1 pyproject.toml

* refactor: regen
  • Loading branch information
doctrino authored Sep 29, 2024
1 parent 205ed0e commit 3988979
Show file tree
Hide file tree
Showing 20 changed files with 574 additions and 661 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

env:
PYTHON_VERSION: '3.9'
PYTHON_VERSION: '3.10'

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [main]

env:
PYTHON_VERSION: '3.9'
PYTHON_VERSION: '3.10'

jobs:
lint:
Expand Down
14 changes: 14 additions & 0 deletions cdf.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[cdf]
default_organization_dir = "tests"
default_env = "dev"

[modules]
# This is the version of the modules. It should not be changed manually.
# It will be updated by the 'cdf module upgrade' command.
version = "0.3.0b3"


[plugins]
run = false
pull = false
dump = false
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Changes are grouped as follows
### Added
- Support for `Enum` in `MockGenerator`.

### Removed
- Support for Python `3.9` is dropped.

## [0.99.34] - 24-09-06
### Changed
- If a view has a property named `type` or `version` this is now prefixed with the view external id instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EquipmentUnitClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
cognite-sdk = 7.62.4
pydantic = 1.10.7
Data Model:
Expand Down
2 changes: 1 addition & 1 deletion examples-pydantic-v1/omni_multi_pydantic_v1/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class OmniMultiClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
cognite-sdk = 7.62.4
pydantic = 1.10.7
"""
Expand Down
2 changes: 1 addition & 1 deletion examples-pydantic-v1/omni_pydantic_v1/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OmniClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
cognite-sdk = 7.62.4
pydantic = 1.10.7
Data Model:
Expand Down
2 changes: 1 addition & 1 deletion examples-pydantic-v1/omni_sub_pydantic_v1/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OmniSubClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
cognite-sdk = 7.62.4
pydantic = 1.10.7
Data Model:
Expand Down
129 changes: 129 additions & 0 deletions examples-pydantic-v1/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
[tool.poetry]
name = "cognite-pygen"
version = "0.99.34"
description = "Cognite Python SDK Generator"
readme = "README.md"
authors = ["Cognite <support@cognite.com>"]
license = "Apache-2.0"
documentation = "https://cognite-pygen.readthedocs-hosted.com/en/latest/"
homepage = "https://cognite-pygen.readthedocs-hosted.com/en/latest/"
repository = "https://github.com/cognitedata/pygen"
packages = [{ include="cognite", from="." }]

[tool.black]
line-length = 120
target_version = ['py39']
include = '\.py$'

[tool.ruff]
# See https://beta.ruff.rs/docs/rules for an overview of ruff rules
line-length = 120
target-version = "py39"
exclude = ["examples","examples-pydantic-v1", "scripts"]
fix = true

[tool.ruff.lint]
select = ["E","W","F","I","RUF","TID","UP", "B", "FLY", "PTH", "ERA"]
fixable = ["E","W","F","I","RUF","TID","UP", "B", "FLY", "PTH", "ERA"]
ignore = [
# This is causing issues for pydantic which does not support use of X | Y for type annotations before 3.10
"UP007", # Use X | Y for type annotations
# Typer do function calls when setting up the CLI.
"B008", # Do not perform function call {name} in argument defaults
# This is done when setting the pygen configs, and useful for getting pretty docs.
# In that case, this is also safe as the function calls produced immutable data.
"RUF009", #Do not perform function call in defaults
]

[tool.ruff.lint.isort]
known-first-party = ["markets_pydantic_v1", "movie_domain_pydantic_v1", "shop_pydantic_v1"]
known-third-party = ["cognite.client"]

[tool.mypy]
explicit_package_bases = true
mypy_path = "examples"
plugins = ["pydantic.mypy"]

[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true

[tool.pygen]
data_models = [
["IntegrationTestsImmutable", "Movie", "2"],
]
tenant_id = "<tenant-id>"
client_id = "<client-id>"
cdf_cluster = "<cdf-cluster>"
cdf_project = "<cdf-project>"
top_level_package = "movie_domain.client"
client_name = "MovieClient"
output_dir = "docs/examples"

[tool.poetry.scripts]
pygen = "cognite.pygen.cli:main"


[tool.poetry.dependencies]
python = "^3.10"
cognite-sdk = {version = "7.62.4"}
pydantic = "1.10.7"
Jinja2 = ">=3.1"
inflect = ">=6.0"

toml = {version=">=0.10", optional=true}
packaging = {version=">=21.3", optional=true}
typer = {version = ">=0.9", extras = ["rich"], optional=true }
black = {version=">=24.4.2", optional = true}
build = {version=">=1.1", optional=true}

[tool.poetry.extras]
cli = ["packaging", "typer", "toml", "build"]
format = ["black"]
all = ["packaging", "typer", "toml", "black", "build"]


[tool.poetry.dev-dependencies]
twine = "*"
pre-commit = "*"
python-dotenv = "*"
pytest = "*"
pytest-cov = "*"
pytest-mock = "*"
toml = "*"
pandas = "*"
pyyaml = "*"
mypy = "^1.5"
mkdocs = {version="^1.6.0", optional=true}
mkdocs-material = {version="^9.5.26", optional=true}
mkdocs-jupyter = {version="^0.24.7", optional=true}
mkdocs-glightbox = {version="^0.4.0", optional=true}
mkdocstrings-python = {version="^1.10.3", optional=true}
pandas-stubs = "^2"
typer = "^0.12"
types-PyYAML = "^6"
types-toml = "^0.10"
IPython = "*"
matplotlib = "*"
tabulate = "*"
pytest-icdiff = "^0.8"
Faker = "*"
hypothesis = "*"
jupyterlab = "*"
cognite-toolkit = "0.3.0b3"

[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning:pkg_resources",
]
addopts = "--doctest-modules"
markers = [
"full: Requiers all optional dependencies to run.",
]
pythonpath = [".", "examples", "examples-pydantic-v1"]
testpaths = ["tests", "cognite/pygen"]

[build-system]
requires = ["poetry-core>=1.3"]
build-backend = "poetry.core.masonry.api"
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ScenarioInstanceClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
cognite-sdk = 7.62.4
pydantic = 1.10.7
Data Model:
Expand Down
2 changes: 1 addition & 1 deletion examples-pydantic-v1/windmill_pydantic_v1/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class WindmillClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
cognite-sdk = 7.62.4
pydantic = 1.10.7
Data Model:
Expand Down
4 changes: 2 additions & 2 deletions examples/equipment_unit/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class EquipmentUnitClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
pydantic = 2.9.1
cognite-sdk = 7.62.4
pydantic = 2.9.2
Data Model:
space: IntegrationTestsImmutable
Expand Down
4 changes: 2 additions & 2 deletions examples/omni/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class OmniClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
pydantic = 2.9.1
cognite-sdk = 7.62.4
pydantic = 2.9.2
Data Model:
space: pygen-models
Expand Down
4 changes: 2 additions & 2 deletions examples/omni_multi/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class OmniMultiClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
pydantic = 2.9.1
cognite-sdk = 7.62.4
pydantic = 2.9.2
"""

Expand Down
4 changes: 2 additions & 2 deletions examples/omni_sub/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class OmniSubClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
pydantic = 2.9.1
cognite-sdk = 7.62.4
pydantic = 2.9.2
Data Model:
space: pygen-models
Expand Down
4 changes: 2 additions & 2 deletions examples/scenario_instance/client/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class ScenarioInstanceClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
pydantic = 2.9.1
cognite-sdk = 7.62.4
pydantic = 2.9.2
Data Model:
space: IntegrationTestsImmutable
Expand Down
4 changes: 2 additions & 2 deletions examples/windmill/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class WindmillClient:
Generated with:
pygen = 0.99.34
cognite-sdk = 7.60.0
pydantic = 2.9.1
cognite-sdk = 7.62.4
pydantic = 2.9.2
Data Model:
space: power-models
Expand Down
Loading

0 comments on commit 3988979

Please sign in to comment.