Skip to content

Integrate python SDK into main python project #4625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes something that happened when the wrong Python version was running? It doesn't seem like something that would be required.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and No
it was uncovered because the tests did run with 3.10 instead of 3.12 but officially we should support 3.10 (pyproject.toml) so we shouldn't use a 3.11 feature.


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
Loading