Skip to content

Commit

Permalink
Convert Python SDK to pyproject.toml setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ringods committed Oct 30, 2024
1 parent ac66688 commit cb3fda5
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 2,414 deletions.
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@ build_nodejs:: install_plugins tfgen # build the node sdk

build_python:: PYPI_VERSION := $(shell pulumictl get version --language python)
build_python:: install_plugins tfgen # build the python sdk
$(WORKING_DIR)/bin/$(TFGEN) python --overlays provider/overlays/python --out sdk/python/
rm -rf sdk/python/
PULUMI_CONVERT=$(PULUMI_CONVERT) PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION=$(PULUMI_CONVERT) $(WORKING_DIR)/bin/$(TFGEN) python --out sdk/python/
cd sdk/python/ && \
cp ../../README.md . && \
python3 setup.py clean --all 2>/dev/null && \
rm -rf ./bin/ ../python.bin/ && cp -R . ../python.bin && mv ../python.bin ./bin && \
sed -i.bak -e 's/^VERSION = .*/VERSION = "$(PYPI_VERSION)"/g' -e 's/^PLUGIN_VERSION = .*/PLUGIN_VERSION = "$(VERSION)"/g' ./bin/setup.py && \
rm ./bin/setup.py.bak && \
cd ./bin && python3 setup.py build sdist
printf "module fake_python_module // Exclude this directory from Go tools\n\ngo 1.17\n" > go.mod && \
cp ../../README.md . && \
rm -rf ./bin/ ../python.bin/ && cp -R . ../python.bin && mv ../python.bin ./bin && \
rm ./bin/go.mod && \
python3 -m venv venv && \
./venv/bin/python -m pip install build==1.2.1 && \
cd ./bin && \
../venv/bin/python -m build .

build_go:: install_plugins tfgen # build the go sdk
$(WORKING_DIR)/bin/$(TFGEN) go --overlays provider/overlays/go --out sdk/go/
Expand Down
4 changes: 3 additions & 1 deletion provider/cmd/pulumi-resource-grafana/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
},
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/grafana/terraform-provider-grafana)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-grafana` repo](https://github.com/pulumiverse/pulumi-grafana/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-grafana` repo](https://github.com/grafana/terraform-provider-grafana/issues).",
"compatibility": "tfbridge20",
"pyproject": {}
"pyproject": {
"enabled": true
}
}
},
"config": {
Expand Down
1 change: 1 addition & 0 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ func Provider() tfbridge.ProviderInfo {
Requires: map[string]string{
"pulumi": ">=3.0.0,<4.0.0",
},
PyProject: struct{ Enabled bool }{true},
},
Golang: &tfbridge.GolangInfo{
ImportBasePath: filepath.Join(
Expand Down
3 changes: 3 additions & 0 deletions sdk/python/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module fake_python_module // Exclude this directory from Go tools

go 1.17
296 changes: 0 additions & 296 deletions sdk/python/pulumiverse_grafana/api_key.py

This file was deleted.

Loading

0 comments on commit cb3fda5

Please sign in to comment.