diff --git a/README.md b/README.md index 66116d9..5fa20d9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To learn how to use this template: If you just want to jump in and get started: 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 tests for your logic in `test/test_fn.py` 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 [python]: https://python.org [docker]: https://www.docker.com -[cli]: https://docs.crossplane.io/latest/cli \ No newline at end of file +[cli]: https://docs.crossplane.io/latest/cli diff --git a/function/__version__.py b/function/__version__.py new file mode 100644 index 0000000..528b4be --- /dev/null +++ b/function/__version__.py @@ -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" diff --git a/pyproject.toml b/pyproject.toml index b54f560..85b0f23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [build-system] -requires = ["hatchling", "hatch-vcs"] +requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "function-template-python" +name = "function" description = 'A composition function' readme = "README.md" requires-python = ">=3.11" @@ -17,17 +17,9 @@ classifiers = [ ] dependencies = [ - # TODO(negz): Push to PyPI instead. We're currently waiting on our request - # 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. + "crossplane-function-sdk-python==0.1.0", "click==8.1.7", "grpcio==1.60.0", - "protobuf==4.25.1", ] dynamic = ["version"] @@ -44,10 +36,8 @@ function = "function.main:cli" packages = ["function"] [tool.hatch.version] -source = "vcs" - -[tool.hatch.metadata] -allow-direct-references = true +path = "function/__version__.py" +validate-bump = false # Allow going from 0.0.0.dev0+x to 0.0.0.dev0+y. [tool.hatch.envs.default] type = "virtual"