Skip to content

Commit 10a7e5d

Browse files
committed
Integrate python SDK into main python project
1 parent 04fbfed commit 10a7e5d

File tree

8 files changed

+52
-1293
lines changed

8 files changed

+52
-1293
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ jobs:
252252
git config --global credential.helper /usr/local/bin/infrahub-git-credential"
253253
- name: "Setup Python environment"
254254
run: |
255-
poetry config virtualenvs.create false
256-
pip install toml invoke
255+
poetry config virtualenvs.create true --local
256+
poetry env use 3.12
257257
- name: "Install dependencies"
258258
run: "poetry install --no-interaction --no-ansi"
259259
- name: "Unit Tests"
260-
run: "invoke backend.test-unit"
260+
run: "poetry run invoke backend.test-unit"
261261
- name: "Coveralls : Unit Tests"
262262
uses: coverallsapp/github-action@v2
263263
continue-on-error: true
@@ -305,16 +305,16 @@ jobs:
305305
git config --global credential.helper /usr/local/bin/infrahub-git-credential"
306306
- name: "Setup Python environment"
307307
run: |
308-
poetry config virtualenvs.create false
309-
pip install toml invoke
308+
poetry config virtualenvs.create true --local
309+
poetry env use 3.12
310310
- name: "Install dependencies"
311311
run: "poetry install --no-interaction --no-ansi"
312312
- name: "Mypy Tests"
313-
run: "invoke backend.mypy"
313+
run: "poetry run invoke backend.mypy"
314314
- name: "Pylint Tests"
315-
run: "invoke backend.pylint"
315+
run: "poetry run invoke backend.pylint"
316316
- name: "Integration Tests"
317-
run: "invoke backend.test-integration"
317+
run: "poetry run invoke backend.test-integration"
318318
- name: "Coveralls : Integration Tests"
319319
uses: coverallsapp/github-action@v2
320320
continue-on-error: true
@@ -366,12 +366,12 @@ jobs:
366366
git config --global credential.helper /usr/local/bin/infrahub-git-credential"
367367
- name: "Setup Python environment"
368368
run: |
369-
poetry config virtualenvs.create false
370-
pip install toml invoke
369+
poetry config virtualenvs.create true --local
370+
poetry env use 3.12
371371
- name: "Install dependencies"
372372
run: "poetry install --no-interaction --no-ansi"
373373
- name: "Unit Tests"
374-
run: "invoke backend.test-unit"
374+
run: "poetry run invoke backend.test-unit"
375375

376376
backend-validate-generated:
377377
if: |
@@ -757,8 +757,8 @@ jobs:
757757
git config --global credential.helper /usr/local/bin/infrahub-git-credential"
758758
- name: "Setup Python environment"
759759
run: |
760-
poetry config virtualenvs.create false
761-
pip install toml invoke
760+
poetry config virtualenvs.create true --local
761+
poetry env use 3.12
762762
- name: "Install dependencies"
763763
run: "poetry install --no-interaction --no-ansi"
764764
- name: Update PATH

backend/infrahub/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import importlib.metadata
22

3-
__version__ = importlib.metadata.version("infrahub")
3+
__version__ = importlib.metadata.version("infrahub-server")

backend/infrahub/menu/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass, field
4-
from typing import TYPE_CHECKING, Self
4+
from typing import TYPE_CHECKING
55

66
from pydantic import BaseModel, Field
7+
from typing_extensions import Self
78

89
from infrahub.core.node import Node
910
from infrahub.core.protocols import CoreMenuItem

backend/infrahub/workflows/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import importlib
2-
from typing import Any, Awaitable, Callable, Self, TypeVar
2+
from typing import Any, Awaitable, Callable, TypeVar
33
from uuid import UUID
44

55
from prefect.client.orchestration import PrefectClient
66
from prefect.client.schemas.actions import DeploymentScheduleCreate
77
from prefect.client.schemas.objects import FlowRun
88
from prefect.client.schemas.schedules import CronSchedule
99
from pydantic import BaseModel
10+
from typing_extensions import Self
1011

1112
from infrahub import __version__
1213

backend/tests/unit/git/test_git_rpc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Any, Optional, Self
3+
from typing import TYPE_CHECKING, Any, Optional
44
from unittest.mock import AsyncMock, patch
55

66
from infrahub_sdk import UUIDT, Config, InfrahubClient
7+
from typing_extensions import Self
78

89
from infrahub.core.constants import InfrahubKind, RepositoryInternalStatus
910
from infrahub.exceptions import RepositoryError

poetry.lock

Lines changed: 1 addition & 1260 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.poetry]
2-
name = "infrahub"
2+
name = "infrahub-server"
33
version = "1.0.0-dev0"
44
description = "Infrahub is taking a new approach to Infrastructure Management by providing a new generation of datastore to organize and control all the data that defines how an infrastructure should run."
55
authors = ["OpsMill <[email protected]>"]
@@ -16,20 +16,15 @@ classifiers = [
1616
"Programming Language :: Python :: 3.12",
1717
]
1818

19-
packages = [{ include = "infrahub", from = "backend" }]
20-
21-
22-
[tool.poetry.group.test-scale]
23-
optional = true
19+
packages = [
20+
{ include = "infrahub", from = "backend" },
21+
{ include = "infrahub_sdk", from = "python_sdk" }
22+
]
2423

2524
[tool.poetry.dependencies]
2625
python = "^3.10, < 3.13"
2726
neo4j = "~5.24"
2827
neo4j-rust-ext = "^5.24.0.0"
29-
infrahub-sdk = { path = "python_sdk", extras = [
30-
"ctl",
31-
"tests",
32-
], develop = true }
3328
pydantic = "2.7.2"
3429
pydantic-settings = "~2.2"
3530
pytest = "~7.4"
@@ -40,6 +35,11 @@ email-validator = "~2.1"
4035
redis = { version = "^5.0.0", extras = ["hiredis"] }
4136
typer = "0.12.3"
4237
prefect = "3.0.3"
38+
ujson = "^5"
39+
Jinja2 = "^3"
40+
gitpython = "^3"
41+
pyyaml = "^6"
42+
toml = "^0.10"
4343

4444
# Dependencies specific to the API Server
4545
fastapi = "~0.112"
@@ -61,6 +61,17 @@ nats-py = "^2.7.2"
6161
netaddr = "1.3.0"
6262
authlib = "1.3.2"
6363

64+
65+
# Dependencies specific to the SDK
66+
rich = "^13"
67+
pyarrow = "^14"
68+
numpy = [
69+
{ version = "^1.24.2", optional = true, python = ">=3.9,<3.12" },
70+
{ version = "^1.26.2", optional = true, python = ">=3.12" },
71+
]
72+
73+
74+
6475
[tool.poetry.group.dev.dependencies]
6576
yamllint = "*"
6677
pylint = "~3.1"
@@ -90,16 +101,20 @@ pytest-env = "^1.1.3"
90101
testcontainers = "^4.8.1"
91102
pytest-timeout = "^2.3.1"
92103

93-
[tool.poetry.group.test-scale.dependencies]
94-
locust = "^2.20.1"
95-
docker = "^7.0.0"
96-
matplotlib = "^3.8"
97-
pandas = "^2.2"
104+
# [tool.poetry.group.test-scale.dependencies]
105+
# locust = "^2.20.1"
106+
# docker = "^7.0.0"
107+
# matplotlib = "^3.8"
108+
# pandas = "^2.2"
98109

99110
[tool.poetry.scripts]
100111
infrahub = "infrahub.cli:app"
101112
infrahub-git-credential = "infrahub.git_credential.helper:app"
102113
infrahub-git-askpass = "infrahub.git_credential.askpass:app"
114+
infrahubctl = "infrahub_sdk.ctl.cli:app"
115+
116+
[tool.poetry.plugins."pytest11"]
117+
"pytest-infrahub" = "infrahub_sdk.pytest_plugin.plugin"
103118

104119
[tool.poetry.plugins."prefect.collections"]
105120
"infrahubasync" = "infrahub.workers.infrahub_async"

0 commit comments

Comments
 (0)