Merge pull request #18 from negz/pipsqueak

Use crossplane-function-sdk-python from PyPI, not git
This commit is contained in:
Nic Cope 2024-01-04 17:18:50 -08:00 committed by GitHub
commit 137e88e402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 17 deletions

View File

@ -10,7 +10,7 @@ To learn how to use this template:
If you just want to jump in and get started: If you just want to jump in and get started:
1. Replace `function-template-python` with your function's name in 1. Replace `function-template-python` with your function's name in
`pyproject.toml` and `package/crossplane.yaml`. `package/crossplane.yaml`.
1. Add your logic to `RunFunction` in `function/fn.py` 1. Add your logic to `RunFunction` in `function/fn.py`
1. Add tests for your logic in `test/test_fn.py` 1. Add tests for your logic in `test/test_fn.py`
1. Update this file, `README.md`, to be about your function! 1. Update this file, `README.md`, to be about your function!
@ -35,4 +35,4 @@ $ crossplane xpkg build -f package --embed-runtime-image=runtime
[functions]: https://docs.crossplane.io/latest/concepts/composition-functions [functions]: https://docs.crossplane.io/latest/concepts/composition-functions
[python]: https://python.org [python]: https://python.org
[docker]: https://www.docker.com [docker]: https://www.docker.com
[cli]: https://docs.crossplane.io/latest/cli [cli]: https://docs.crossplane.io/latest/cli

18
function/__version__.py Normal file
View File

@ -0,0 +1,18 @@
# Copyright 2023 The Crossplane Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The version of the function."""
# This is set at build time, using "hatch version"
__version__ = "0.0.0"

View File

@ -1,9 +1,9 @@
[build-system] [build-system]
requires = ["hatchling", "hatch-vcs"] requires = ["hatchling"]
build-backend = "hatchling.build" build-backend = "hatchling.build"
[project] [project]
name = "function-template-python" name = "function"
description = 'A composition function' description = 'A composition function'
readme = "README.md" readme = "README.md"
requires-python = ">=3.11" requires-python = ">=3.11"
@ -17,17 +17,9 @@ classifiers = [
] ]
dependencies = [ dependencies = [
# TODO(negz): Push to PyPI instead. We're currently waiting on our request "crossplane-function-sdk-python==0.1.0",
# for a new PyPI org for Crossplane to be approved. Once we're using a PyPI
# package (e.g. a wheel), confirm that run_function_pb2.pyi is installed. This
# interface file makes working with RunFunctionRequest and RunFunctionResponse
# a lot easier, since it contains all the type metadata.
"function-sdk-python @ git+https://github.com/crossplane/function-sdk-python",
# Pin at least the things we import directly.
"click==8.1.7", "click==8.1.7",
"grpcio==1.60.0", "grpcio==1.60.0",
"protobuf==4.25.1",
] ]
dynamic = ["version"] dynamic = ["version"]
@ -44,10 +36,8 @@ function = "function.main:cli"
packages = ["function"] packages = ["function"]
[tool.hatch.version] [tool.hatch.version]
source = "vcs" path = "function/__version__.py"
validate-bump = false # Allow going from 0.0.0.dev0+x to 0.0.0.dev0+y.
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.envs.default] [tool.hatch.envs.default]
type = "virtual" type = "virtual"