Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
71c150d
Add `create_diff` to the clients to manually create a diff between tw…
minitriga Sep 8, 2025
565674f
Fix issue with `render` ctl command not using branch environment vari…
minitriga Sep 9, 2025
8c266e7
Remove unnecessary assignments before `return` statement
ogenstad Sep 10, 2025
a406bb0
Merge pull request #542 from opsmill/pog-returns
ogenstad Sep 11, 2025
30e661d
add livestream to docs
petercrocker Sep 13, 2025
e358da2
Merge pull request #544 from opsmill/pmc-20250913-docs
petercrocker Sep 13, 2025
4ec8102
fix issue with double quotes in HFID
BeArchiTek Sep 15, 2025
10618ee
Merge pull request #547 from opsmill/bkr-fix-hfid-double-quotes
BeArchiTek Sep 15, 2025
285b5a4
Merge branch 'stable' into 'develop' with resolved conflicts
ogenstad Sep 16, 2025
e7ed981
Format with ruff
ogenstad Sep 16, 2025
c111658
IFC-1811: Replace toml package with tomllib and tomli optionally (#551)
solababs Sep 17, 2025
654fc80
Merge pull request #550 from opsmill/pog-stable-to-develop-20250916
ogenstad Sep 17, 2025
10cb555
Initial plan
Copilot Sep 17, 2025
40489aa
Fix JsonDecodeError to include server response content in error message
Copilot Sep 17, 2025
9340fd2
Add convert_object_type method (#554)
LucasG0 Sep 19, 2025
f321523
Add support for clearing optional attributes (#548)
minitriga Sep 22, 2025
471bfac
Add support for clearing optional attributes (#548) (#557)
infrahub-github-bot-app[bot] Sep 22, 2025
840d98a
IHS-147: Fix schema load failure exception (#555)
solababs Sep 22, 2025
6cdd780
Add to object conversion input (#558)
LucasG0 Sep 24, 2025
7858a62
Add changelog entry for issue #473 JsonDecodeError fix
Copilot Sep 30, 2025
1c94694
Merge pull request #553 from opsmill/copilot/fix-473
BeArchiTek Sep 30, 2025
f9ccf10
Merge pull request #559 from opsmill/stable
dgarros Sep 30, 2025
2c16773
Object file range expansion (#561)
minitriga Sep 30, 2025
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
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
- name: "Install dependencies"
run: npm install
- name: "Setup Python environment"
run: "pip install invoke toml"
run: "pip install invoke"
- name: "Build docs website"
run: "invoke docs"

Expand Down Expand Up @@ -176,7 +176,7 @@ jobs:
- name: "Install dependencies"
run: "poetry install --no-interaction --no-ansi --extras ctl"
- name: "Setup environment"
run: "pip install invoke toml"
run: "poetry run pip install invoke"
- name: "Validate generated documentation"
run: "poetry run invoke docs-validate"

Expand Down Expand Up @@ -236,7 +236,11 @@ jobs:
run: |
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }} --python python${{ matrix.python-version }}
poetry config virtualenvs.create true --local
pip install invoke toml codecov
pip install invoke codecov
- name: "Install tomli for Python < 3.11"
if: matrix.python-version == '3.9' || matrix.python-version == '3.10'
run: |
pip install tomli
- name: "Install Package"
run: "poetry install --all-extras"
- name: "Mypy Tests"
Expand Down Expand Up @@ -289,7 +293,7 @@ jobs:
run: |
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
poetry config virtualenvs.create true --local
pip install invoke toml codecov
pip install invoke codecov
- name: "Install Package"
run: "poetry install --all-extras"
- name: "Integration Tests"
Expand Down Expand Up @@ -362,7 +366,7 @@ jobs:
# run: |
# pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
# poetry config virtualenvs.create true --local
# pip install invoke toml codecov
# pip install invoke codecov

# - name: "Install Package"
# run: "poetry install --all-extras"
Expand Down
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.11.9
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
1 change: 1 addition & 0 deletions changelog/+convert-object-type.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `convert_object_type` method to allow converting an object to another type.
1 change: 1 addition & 0 deletions changelog/+escape-hfid.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed issue with improperly escaped special characters in `hfid` fields and other string values in GraphQL mutations by implementing proper JSON-style string escaping
1 change: 1 addition & 0 deletions changelog/464.housekeeping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle error gracefully when loading schema instead of failing with an exception
1 change: 1 addition & 0 deletions changelog/473.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
JsonDecodeError now includes server response content in error message when JSON decoding fails, providing better debugging information for non-JSON server responses.
1 change: 1 addition & 0 deletions changelog/528.housekeeping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace toml package with tomllib and tomli optionally for when Python version is less than 3.11
2 changes: 2 additions & 0 deletions changelog/529.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add `create_diff` method to create a diff summary between two timestamps
Update `get_diff_summary` to accept optional time range parameters
1 change: 1 addition & 0 deletions changelog/535.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix branch handling in `_run_transform` and `execute_graphql_query` functions in Infrahubctl to use environment variables for branch management.
1 change: 1 addition & 0 deletions changelog/549.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow the ability to clear optional attributes by setting them to None if they have been mutated by the user.
1 change: 1 addition & 0 deletions changelog/560.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the ability to perform range expansions in object files. This feature allows users to define patterns in string fields that will be expanded into multiple objects, facilitating bulk object creation and management. The implementation includes validation to ensure that all expanded lists have the same length, preventing inconsistencies. Documentation has been updated to explain how to use this feature, including examples of valid and invalid configurations.
7 changes: 7 additions & 0 deletions docs/docs/python-sdk/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
---
title: Python SDK
---
import VideoPlayer from '../../src/components/VideoPlayer';

The Infrahub Python SDK greatly simplifies how you can interact with Infrahub programmatically.

## Videos

<center>
<VideoPlayer url='https://www.youtube.com/live/RbRz8_t0FBs?feature=shared' light />
</center>

## Blog posts

- [Querying Data in Infrahub via the Python SDK](https://www.opsmill.com/querying-data-in-infrahub-via-the-python-sdk/)
Expand Down
83 changes: 83 additions & 0 deletions docs/docs/python-sdk/topics/object_file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,86 @@ Metadata support is planned for future releases. Currently, the Object file does
2. Keep object files organized by model type or purpose.
3. Validate object files before loading them into production environments.
4. Use comments in your YAML files to document complex relationships or dependencies.

## Range Expansion in Object Files

The Infrahub Python SDK supports **range expansion** for string fields in object files. This feature allows you to specify a range pattern (e.g., `[1-5]`) in any string value, and the SDK will automatically expand it into multiple objects during validation and processing.

### How Range Expansion Works

- Any string field containing a pattern like `[1-5]`, `[10-15]`, or `[1,3,5]` will be expanded into multiple objects.
- If multiple fields in the same object use range expansion, **all expanded lists must have the same length**. If not, validation will fail.
- The expansion is performed before validation and processing, so all downstream logic works on the expanded data.

### Examples

#### Single Field Expansion

```yaml
spec:
kind: BuiltinLocation
data:
- name: AMS[1-3]
type: Country
```

This will expand to:

```yaml
- name: AMS1
type: Country
- name: AMS2
type: Country
- name: AMS3
type: Country
```

#### Multiple Field Expansion (Matching Lengths)

```yaml
spec:
kind: BuiltinLocation
data:
- name: AMS[1-3]
description: Datacenter [A-C]
type: Country
```

This will expand to:

```yaml
- name: AMS1
description: Datacenter A
type: Country
- name: AMS2
description: Datacenter B
type: Country
- name: AMS3
description: Datacenter C
type: Country
```

#### Error: Mismatched Range Lengths

If you use ranges of different lengths in multiple fields:

```yaml
spec:
kind: BuiltinLocation
data:
- name: AMS[1-3]
description: "Datacenter [10-15]"
type: Country
```

This will **fail validation** with an error like:

```bash
Range expansion mismatch: fields expanded to different lengths: [3, 6]
```

### Notes

- Range expansion is supported for any string field in the `data` section.
- If no range pattern is present, the field is left unchanged.
- If expansion fails for any field, validation will fail with an error message.
2 changes: 1 addition & 1 deletion docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const config: Config = {
additionalLanguages: ["bash", "python", "markup-templating", "django", "json", "toml", "yaml"],
},
} satisfies Preset.ThemeConfig,

markdown: {
format: "mdx",
preprocessor: ({ filePath, fileContent }) => {
Expand Down
Loading