diff --git a/.gitignore b/.gitignore index cc25484..3c4a994 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,8 @@ provider/**/schema-embed.json **/.gradle go.work.sum + +__pycache__ +venv +sdk/python/build +sdk/python/*.egg-info diff --git a/Makefile b/Makefile index 424d613..99baa56 100644 --- a/Makefile +++ b/Makefile @@ -59,15 +59,17 @@ build_nodejs: build_python: PYPI_VERSION := $(shell pulumictl get version --language python) build_python: - $(WORKING_DIR)/bin/$(TFGEN) python --out sdk/python/ + rm -rf sdk/python/ + $(WORKING_DIR)/bin/$(TFGEN) python --overlays provider/overlays/python --out sdk/python/ cd sdk/python/ && \ - echo "module fake_python_module // Exclude this directory from Go tools\n\ngo 1.17" > go.mod && \ - cp ../../README.md . && \ - python3 setup.py clean --all 2>/dev/null && \ + 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 && \ - 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 && rm ./bin/go.mod && \ - cd ./bin && python3 setup.py build sdist + 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 . clean: rm -rf sdk/{dotnet,nodejs,go,python} diff --git a/provider/cmd/pulumi-resource-cockroach/schema.json b/provider/cmd/pulumi-resource-cockroach/schema.json index b20ceb0..037acf1 100644 --- a/provider/cmd/pulumi-resource-cockroach/schema.json +++ b/provider/cmd/pulumi-resource-cockroach/schema.json @@ -53,7 +53,9 @@ }, "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/cockroachdb/terraform-provider-cockroach)\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-cockroach` repo](https://github.com/pulumiverse/pulumi-cockroach/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-cockroach` repo](https://github.com/cockroachdb/terraform-provider-cockroach/issues).", "compatibility": "tfbridge20", - "pyproject": {} + "pyproject": { + "enabled": true + } } }, "config": { diff --git a/provider/go.mod b/provider/go.mod index 7a7fd62..b39556a 100644 --- a/provider/go.mod +++ b/provider/go.mod @@ -1,8 +1,6 @@ module github.com/pulumiverse/pulumi-cockroach/provider -go 1.21.12 - -toolchain go1.22.1 +go 1.21 require ( github.com/cockroachdb/terraform-provider-cockroach/shim v0.0.0 diff --git a/provider/resources.go b/provider/resources.go index ebda662..245402c 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -171,6 +171,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( diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml new file mode 100644 index 0000000..0a695fa --- /dev/null +++ b/sdk/python/pyproject.toml @@ -0,0 +1,22 @@ +[project] + name = "pulumiverse_cockroach" + description = "A Pulumi package to create and managed Cockroach DB resources in Pulumi programs." + dependencies = ["parver>=0.2.1", "pulumi>=3.0.0,<4.0.0", "semver>=2.8.1"] + keywords = ["pulumi", "cockroach", "pulumiverse"] + readme = "README.md" + requires-python = ">=3.8" + version = "0.0.0" + [project.license] + text = "Apache-2.0" + [project.urls] + Homepage = "https://www.cockroachlabs.com/" + Repository = "https://github.com/pulumiverse/pulumi-cockroach" + +[build-system] + requires = ["setuptools>=61.0"] + build-backend = "setuptools.build_meta" + +[tool] + [tool.setuptools] + [tool.setuptools.package-data] + pulumiverse_cockroach = ["py.typed", "pulumi-plugin.json"] diff --git a/sdk/python/setup.py b/sdk/python/setup.py deleted file mode 100644 index 87fadc8..0000000 --- a/sdk/python/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** -# *** Do not edit by hand unless you're certain you know what you are doing! *** - -import errno -from setuptools import setup, find_packages -from setuptools.command.install import install -from subprocess import check_call - - -VERSION = "0.0.0" -def readme(): - try: - with open('README.md', encoding='utf-8') as f: - return f.read() - except FileNotFoundError: - return "cockroach Pulumi Package - Development Version" - - -setup(name='pulumiverse_cockroach', - python_requires='>=3.8', - version=VERSION, - description="A Pulumi package to create and managed Cockroach DB resources in Pulumi programs.", - long_description=readme(), - long_description_content_type='text/markdown', - keywords='pulumi cockroach pulumiverse', - url='https://www.cockroachlabs.com/', - project_urls={ - 'Repository': 'https://github.com/pulumiverse/pulumi-cockroach' - }, - license='Apache-2.0', - packages=find_packages(), - package_data={ - 'pulumiverse_cockroach': [ - 'py.typed', - 'pulumi-plugin.json', - ] - }, - install_requires=[ - 'parver>=0.2.1', - 'pulumi>=3.0.0,<4.0.0', - 'semver>=2.8.1' - ], - zip_safe=False)