Commit Graph

29 Commits

Author SHA1 Message Date
Bob Haddleton 3931d503fc
Merge pull request #140 from negz/terminal
Shutdown gracefully on SIGTERM
2025-04-23 14:06:31 -05:00
Jesús Fernández 47180d9798
**Summary:**
Functions depending on function-sdk-python 0.6.0 are giving a segmentation fault.
When (re)running the tests for this module, the following is shown:

```
runtime_version.py:98: UserWarning: Protobuf gencode version 5.29.0 is exactly one major version older than the runtime version 6.30.2 at crossplane/function/proto/v1beta1/run_function.proto. Please update the gencode to avoid compatibility violations in the next runtime release.
```

Apparently when renovatebot opened a PR with a bump up on `protobuf` version,
the major version change violated the constraint with `grpcio-tools`, which
has the following dependency:

```
Collecting protobuf<6.0dev,>=5.26.1 (from grpcio-tools==1.71.0)
```

This makes incompatible to have different versions of protobuf for the `build`
venv and the `generate` one.

Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
2025-04-10 12:11:43 +02:00
Nic Cope cdaf6697c5 Shutdown gracefully on SIGTERM
Signed-off-by: Nic Cope <nicc@rk0n.org>
2025-04-01 07:00:44 -07:00
Nic Cope fcec201f01 Run hatch fmt
This file wasn't formatted before making it into main. Not sure why the
linter didn't catch it...

Signed-off-by: Nic Cope <nicc@rk0n.org>
2025-04-01 06:59:38 -07:00
Nic Cope f295c0144b Let tools know this library supports type hints
https://typing.python.org/en/latest/spec/distributing.html#packaging-type-information
https://typing.python.org/en/latest/guides/libraries.html#marking-a-package-as-providing-type-information

It turns out we need to add a py.typed file so that tools will know this
library has type hints. As far as I can tell we don't need to do
anything special to have our build tool (Hatch) include this file when
it builds and packages the library.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2025-04-01 06:23:58 -07:00
J. Fernández 54d6e39371
Merge branch 'main' into main 2025-01-15 10:01:42 +01:00
Nic Cope 064ffe7458
Merge pull request #112 from crossplane/fix_unit_tests
Bump protobuf and add defensive checks to get_* helpers
2025-01-08 11:19:46 -08:00
Christopher Haar 70e86c0d30 fix(defaults): add apiVersion and kind
Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
2025-01-06 17:10:32 +01:00
Bob Haddleton 685918f02d Bump protobuf and add defensive checks to get_* helpers
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
2024-12-18 14:27:11 -06:00
Jesús Fernández 36e5600356
chore: stick to grpcio 1.67.0
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
2024-11-26 20:04:55 +01:00
Jesús Fernández c632b0c1ad
feat: use json_format.ParseDict to convert dicts to structs
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
2024-11-25 12:08:06 +01:00
Jesús Fernández 25e49cf3bd
fix: structs containing listvalues are properly converted
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
2024-11-13 22:23:14 +01:00
Nic Cope df655cabec Use class matches in resource.update()
This was introduced in 3.10, and seems like a much better way to handle
matching a type.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-10-09 18:04:33 -07:00
Nic Cope 974bdc45a6 Add a resource.update convenience function
This function can be used to add or update a resource.

For example, to add a desired composed bucket (assuming the "bucket"
resource doesn't yet exist):

```python
resource.update(rsp.desired.resources["bucket"], bucket)
```

Or to update the desired XR:

```python
resource.update(rsp.desired.composite.resource, partial_xr)
```

The source resource can be a dictionary, a protobuf struct, or a
Pydantic model.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-10-09 18:04:33 -07:00
Bob Haddleton f197e4153b Update grpc proto to 1.66
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
2024-08-30 16:22:12 -05:00
Nic Cope 39b1128332 Return a response, not a request
Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-08-16 17:17:05 -07:00
Nic Cope 0f7d85f43d Promote composition functions to v1
Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-08-16 15:05:29 -07:00
Jesús Fernández 556607ede7
fix: recursively convert struct to dict
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
2024-08-13 10:13:28 +02:00
Nic Cope d1c067e388
Merge pull request #62 from bobh66/loop
Fix different loop errors on python 3.12
2024-06-26 13:38:13 -07:00
Bob Haddleton 86e715d718 Add support for credentials
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
2024-06-26 13:36:08 -05:00
Bob Haddleton a24b927baf Fix different loop errors in 3.12
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
2024-06-25 18:35:10 -05:00
vibe e1851feb69 feat: generate extra resources proto
Signed-off-by: vibe <francoc137@icloud.com>
2024-01-25 06:20:38 -08:00
Nic Cope c1e5e20bef Use Python-compatible versions
See https://packaging.python.org/en/latest/specifications/version-specifiers/#examples-of-compliant-version-schemes

Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-01-03 18:37:34 -08:00
Nic Cope 29edf77d58 Push to PyPI
I _think_ this should push to PyPI only when the CI workflow is run with
a version input, similar to how builds work for functions.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-01-03 18:13:21 -08:00
Nic Cope 2c9e248f03
Merge pull request #16 from negz/grandmaster-flash
Add license headers
2023-11-21 19:10:08 -08:00
Nic Cope 502f567d4a Add license headers
Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-11-21 19:06:10 -08:00
Nic Cope 667a56db88 Add convenience functions for returning results
Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-11-21 18:11:26 -08:00
Nic Cope 383783c0f9 Remove stale TODO WRT insecure port
It appears that it does override secure port

Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-11-19 14:06:29 -08:00
Nic Cope e247d8766e Break the SDK out into its own repo
I prototyped this in https://github.com/negz/function-auto-python.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-11-19 13:37:50 -08:00