Skip to content

Commit

Permalink
Integrate python SDK into main python project
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarros committed Oct 15, 2024
1 parent 04fbfed commit 10a7e5d
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 1,293 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ jobs:
git config --global credential.helper /usr/local/bin/infrahub-git-credential"
- name: "Setup Python environment"
run: |
poetry config virtualenvs.create false
pip install toml invoke
poetry config virtualenvs.create true --local
poetry env use 3.12
- name: "Install dependencies"
run: "poetry install --no-interaction --no-ansi"
- name: "Unit Tests"
run: "invoke backend.test-unit"
run: "poetry run invoke backend.test-unit"
- name: "Coveralls : Unit Tests"
uses: coverallsapp/github-action@v2
continue-on-error: true
Expand Down Expand Up @@ -305,16 +305,16 @@ jobs:
git config --global credential.helper /usr/local/bin/infrahub-git-credential"
- name: "Setup Python environment"
run: |
poetry config virtualenvs.create false
pip install toml invoke
poetry config virtualenvs.create true --local
poetry env use 3.12
- name: "Install dependencies"
run: "poetry install --no-interaction --no-ansi"
- name: "Mypy Tests"
run: "invoke backend.mypy"
run: "poetry run invoke backend.mypy"
- name: "Pylint Tests"
run: "invoke backend.pylint"
run: "poetry run invoke backend.pylint"
- name: "Integration Tests"
run: "invoke backend.test-integration"
run: "poetry run invoke backend.test-integration"
- name: "Coveralls : Integration Tests"
uses: coverallsapp/github-action@v2
continue-on-error: true
Expand Down Expand Up @@ -366,12 +366,12 @@ jobs:
git config --global credential.helper /usr/local/bin/infrahub-git-credential"
- name: "Setup Python environment"
run: |
poetry config virtualenvs.create false
pip install toml invoke
poetry config virtualenvs.create true --local
poetry env use 3.12
- name: "Install dependencies"
run: "poetry install --no-interaction --no-ansi"
- name: "Unit Tests"
run: "invoke backend.test-unit"
run: "poetry run invoke backend.test-unit"

backend-validate-generated:
if: |
Expand Down Expand Up @@ -757,8 +757,8 @@ jobs:
git config --global credential.helper /usr/local/bin/infrahub-git-credential"
- name: "Setup Python environment"
run: |
poetry config virtualenvs.create false
pip install toml invoke
poetry config virtualenvs.create true --local
poetry env use 3.12
- name: "Install dependencies"
run: "poetry install --no-interaction --no-ansi"
- name: Update PATH
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import importlib.metadata

__version__ = importlib.metadata.version("infrahub")
__version__ = importlib.metadata.version("infrahub-server")
3 changes: 2 additions & 1 deletion backend/infrahub/menu/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from __future__ import annotations

from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Self
from typing import TYPE_CHECKING

from pydantic import BaseModel, Field
from typing_extensions import Self

from infrahub.core.node import Node
from infrahub.core.protocols import CoreMenuItem
Expand Down
3 changes: 2 additions & 1 deletion backend/infrahub/workflows/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import importlib
from typing import Any, Awaitable, Callable, Self, TypeVar
from typing import Any, Awaitable, Callable, TypeVar
from uuid import UUID

from prefect.client.orchestration import PrefectClient
from prefect.client.schemas.actions import DeploymentScheduleCreate
from prefect.client.schemas.objects import FlowRun
from prefect.client.schemas.schedules import CronSchedule
from pydantic import BaseModel
from typing_extensions import Self

from infrahub import __version__

Expand Down
3 changes: 2 additions & 1 deletion backend/tests/unit/git/test_git_rpc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Optional, Self
from typing import TYPE_CHECKING, Any, Optional
from unittest.mock import AsyncMock, patch

from infrahub_sdk import UUIDT, Config, InfrahubClient
from typing_extensions import Self

from infrahub.core.constants import InfrahubKind, RepositoryInternalStatus
from infrahub.exceptions import RepositoryError
Expand Down
1,261 changes: 1 addition & 1,260 deletions poetry.lock

Large diffs are not rendered by default.

45 changes: 30 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "infrahub"
name = "infrahub-server"
version = "1.0.0-dev0"
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."
authors = ["OpsMill <[email protected]>"]
Expand All @@ -16,20 +16,15 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]

packages = [{ include = "infrahub", from = "backend" }]


[tool.poetry.group.test-scale]
optional = true
packages = [
{ include = "infrahub", from = "backend" },
{ include = "infrahub_sdk", from = "python_sdk" }
]

[tool.poetry.dependencies]
python = "^3.10, < 3.13"
neo4j = "~5.24"
neo4j-rust-ext = "^5.24.0.0"
infrahub-sdk = { path = "python_sdk", extras = [
"ctl",
"tests",
], develop = true }
pydantic = "2.7.2"
pydantic-settings = "~2.2"
pytest = "~7.4"
Expand All @@ -40,6 +35,11 @@ email-validator = "~2.1"
redis = { version = "^5.0.0", extras = ["hiredis"] }
typer = "0.12.3"
prefect = "3.0.3"
ujson = "^5"
Jinja2 = "^3"
gitpython = "^3"
pyyaml = "^6"
toml = "^0.10"

# Dependencies specific to the API Server
fastapi = "~0.112"
Expand All @@ -61,6 +61,17 @@ nats-py = "^2.7.2"
netaddr = "1.3.0"
authlib = "1.3.2"


# Dependencies specific to the SDK
rich = "^13"
pyarrow = "^14"
numpy = [
{ version = "^1.24.2", optional = true, python = ">=3.9,<3.12" },
{ version = "^1.26.2", optional = true, python = ">=3.12" },
]



[tool.poetry.group.dev.dependencies]
yamllint = "*"
pylint = "~3.1"
Expand Down Expand Up @@ -90,16 +101,20 @@ pytest-env = "^1.1.3"
testcontainers = "^4.8.1"
pytest-timeout = "^2.3.1"

[tool.poetry.group.test-scale.dependencies]
locust = "^2.20.1"
docker = "^7.0.0"
matplotlib = "^3.8"
pandas = "^2.2"
# [tool.poetry.group.test-scale.dependencies]
# locust = "^2.20.1"
# docker = "^7.0.0"
# matplotlib = "^3.8"
# pandas = "^2.2"

[tool.poetry.scripts]
infrahub = "infrahub.cli:app"
infrahub-git-credential = "infrahub.git_credential.helper:app"
infrahub-git-askpass = "infrahub.git_credential.askpass:app"
infrahubctl = "infrahub_sdk.ctl.cli:app"

[tool.poetry.plugins."pytest11"]
"pytest-infrahub" = "infrahub_sdk.pytest_plugin.plugin"

[tool.poetry.plugins."prefect.collections"]
"infrahubasync" = "infrahub.workers.infrahub_async"
Expand Down

0 comments on commit 10a7e5d

Please sign in to comment.