How can i test my python sdk locally? The document...
# package-authoring
b
How can i test my python sdk locally? The documentation says to run pip install pulumi_foo... but pulumi_foo has not been published yet.
b
b
thanks!
👍🏻 1
@big-architect-71258 Another silly question.. how can I test my go sdk locally? I've tried everything I can think of, but my go knowledge is just not that great,
b
@brash-school-3769 You have to replace the module reference in the go.mod file of your test program to the local path of the GO SDK on your computer. Could be a relative or absolute path. https://go.dev/doc/modules/gomod-ref#replace
Again: the directory of provider binary must at the first place of your PATH environment variable in the SHELL session in which you execute your Pulumi test program
b
Thanks!
🙂 1
Now I'm getting something like
Copy code
go: finding module for package <http://github.com/gtheo/pulumi-foo/sdk|github.com/gtheo/pulumi-foo/sdk>
go: golang imports
	<http://github.com/gtheo/pulumi-foo/sdk|github.com/gtheo/pulumi-foo/sdk>: module <http://github.com/gtheo/pulumi-foo/sdk@latest|github.com/gtheo/pulumi-foo/sdk@latest> found (v0.0.0-00010101000000-000000000000, replaced by /Users/gtheo/Documents/01_projects/pulumi_foo/pulumi-foo/sdk), but does not contain package <http://github.com/gtheo/pulumi-foo/sdk|github.com/gtheo/pulumi-foo/sdk>
b
Seems the package name in
go.mod
at
/Users/gtheo/Documents/01_projects/pulumi_foo/pulumi-foo/sdk
is not
<http://github.com/gtheo/pulumi-foo/sdk|github.com/gtheo/pulumi-foo/sdk>
b
by package name you mean the top level module statement?
👍🏻 1
thats the odd thing, it does match.
🤔 1
b
How does your go.mod file in your test project look like? And what's the contents in the SDK folder?
b
\/sdk
Copy code
$ls
dotnet go     go.mod go.sum nodejs python
test/go.mod
Copy code
module golang

go 1.22

replace <http://github.com/gtheo/pulumi-foo/sdk|github.com/gtheo/pulumi-foo/sdk> => /Users/gtheo/Documents/01_projects/pulumi_foo/pulumi-foo/sdk

require <http://github.com/pulumi/pulumi/sdk/v3|github.com/pulumi/pulumi/sdk/v3> v3.117.0

require <http://github.com/gtheo/pulumi-foo/sdk/go|github.com/gtheo/pulumi-foo/sdk/go> v0.0.0

require (
	...
)
b
Sorry not the contents of the SDK folder, but the contents of the go.mod file therein. My bad. Sorry
b
sdk/go.mod
Copy code
module <http://github.com/gtheo/pulumi-foo/sdk|github.com/gtheo/pulumi-foo/sdk>

go 1.22

require (
	<http://github.com/blang/semver|github.com/blang/semver> v3.5.1+incompatible
	<http://github.com/pulumi/pulumi/sdk/v3|github.com/pulumi/pulumi/sdk/v3> v3.124.0
)

require (
	...
)
b
I've to admit this is kinda odd. Let me check something locally with the pulumi-time provider.
♥️ 1
b
Thank you so much for your assitance on this.
b
It simply worked on my side. go.mod test project:
Copy code
module <http://github.com/tmeckel/pulumi-time-test|github.com/tmeckel/pulumi-time-test>

go 1.21.12

replace <http://github.com/pulumiverse/pulumi-time/sdk|github.com/pulumiverse/pulumi-time/sdk> => ../pulumi-time/sdk

require (
	<http://github.com/pulumi/pulumi/sdk/v3|github.com/pulumi/pulumi/sdk/v3> v3.87.0
	<http://github.com/pulumiverse/pulumi-time/sdk|github.com/pulumiverse/pulumi-time/sdk> v0.0.17
)
Works with full path or relative path. When I deliberately add an error to on of the local code files I get the expected error message.
Copy code
# <http://github.com/pulumiverse/pulumi-time/sdk/go/time|github.com/pulumiverse/pulumi-time/sdk/go/time>
../pulumi-time/sdk/go/time/rotating.go:101:2: undefined: FOO
b
interesting. I'll keep poking around.
👍🏻 1
b
Try clean your GO mod and build caches:
Copy code
go clean -cache -modcache
b
Do you mind sharing your directory structure for the sdk folder?
b