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 7598cd5
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 1,298 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
40 changes: 40 additions & 0 deletions docs/docs/infrahubctl/infrahubctl-menu.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# `infrahubctl menu`

Manage the menu in a remote Infrahub instance.

**Usage**:

```console
$ infrahubctl menu [OPTIONS] COMMAND [ARGS]...
```

**Options**:

* `--install-completion`: Install completion for the current shell.
* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
* `--help`: Show this message and exit.

**Commands**:

* `load`: Load one or multiple menu files into...

## `infrahubctl menu load`

Load one or multiple menu files into Infrahub.

**Usage**:

```console
$ infrahubctl menu load [OPTIONS] MENUS...
```

**Arguments**:

* `MENUS...`: [required]

**Options**:

* `--debug / --no-debug`: [default: no-debug]
* `--branch TEXT`: Branch on which to load the menu. [default: main]
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.
40 changes: 40 additions & 0 deletions docs/docs/infrahubctl/infrahubctl-object.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# `infrahubctl object`

Manage objects in a remote Infrahub instance.

**Usage**:

```console
$ infrahubctl object [OPTIONS] COMMAND [ARGS]...
```

**Options**:

* `--install-completion`: Install completion for the current shell.
* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
* `--help`: Show this message and exit.

**Commands**:

* `load`: Load one or multiple objects files into...

## `infrahubctl object load`

Load one or multiple objects files into Infrahub.

**Usage**:

```console
$ infrahubctl object load [OPTIONS] PATHS...
```

**Arguments**:

* `PATHS...`: [required]

**Options**:

* `--debug / --no-debug`: [default: no-debug]
* `--branch TEXT`: Branch on which to load the objects. [default: main]
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.
2 changes: 1 addition & 1 deletion docs/docs/python-sdk/reference/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ The following settings can be defined in the `Config` class
<!-- vale on -->
**Description**: Default connection timeout in seconds<br />
**Type**: `integer`<br />
**Default value**: 10<br />
**Default value**: 60<br />
**Environment variable**: `INFRAHUB_TIMEOUT`<br />
<!-- vale off -->
## transport
Expand Down
Loading

0 comments on commit 7598cd5

Please sign in to comment.