Skip to content

Commit

Permalink
chore: use plugin.Start for python language plugin (#3193)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesbillman authored Oct 25, 2024
1 parent 78cc2ce commit dee85c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ build-python-plugin: build-zips build-protos
shopt -s extglob

if [ "${FTL_DEBUG:-}" = "true" ]; then
go build -o "{{RELEASE}}/ftl-language-python" -tags release -gcflags=all="-N -l" -ldflags "-X github.com/TBD54566975/ftl.Version={{VERSION}} -X github.com/TBD54566975/ftl.Timestamp={{TIMESTAMP}}" "./python-runtime/cmd"
go build -o "{{RELEASE}}/ftl-language-python" -tags release -gcflags=all="-N -l" -ldflags "-X github.com/TBD54566975/ftl.Version={{VERSION}} -X github.com/TBD54566975/ftl.Timestamp={{TIMESTAMP}}" "./python-runtime/cmd/ftl-language-python"
else
mk "{{RELEASE}}/ftl-language-python" : !(build|integration) -- go build -o "{{RELEASE}}/ftl-language-python" -tags release -ldflags "-X github.com/TBD54566975/ftl.Version={{VERSION}} -X github.com/TBD54566975/ftl.Timestamp={{TIMESTAMP}}" "./python-runtime/cmd"
mk "{{RELEASE}}/ftl-language-python" : !(build|integration) -- go build -o "{{RELEASE}}/ftl-language-python" -tags release -ldflags "-X github.com/TBD54566975/ftl.Version={{VERSION}} -X github.com/TBD54566975/ftl.Timestamp={{TIMESTAMP}}" "./python-runtime/cmd/ftl-language-python"
fi

export DATABASE_URL := "postgres://postgres:secret@localhost:15432/ftl?sslmode=disable"
Expand Down
58 changes: 0 additions & 58 deletions python-runtime/cmd/ftl-language-python.go

This file was deleted.

23 changes: 23 additions & 0 deletions python-runtime/cmd/ftl-language-python/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"context"

"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/language/languagepbconnect"
"github.com/TBD54566975/ftl/common/plugin"
pythonplugin "github.com/TBD54566975/ftl/python-runtime/python-plugin"
)

func main() {
plugin.Start(
context.Background(),
"ftl-language-python",
createService,
languagepbconnect.LanguageServiceName,
languagepbconnect.NewLanguageServiceHandler,
)
}

func createService(ctx context.Context, config any) (context.Context, *pythonplugin.Service, error) {
return ctx, pythonplugin.New(), nil
}
2 changes: 1 addition & 1 deletion scripts/ftl-language-python
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ ftldir="$(dirname "$(readlink -f "$0")")/.."
name="ftl-language-python"
dest="${ftldir}/build/devel"
mkdir -p "$dest"
(cd "${ftldir}/python-runtime/cmd" && "${ftldir}/bin/go" build -ldflags="-s -w -buildid=" -o "$dest/${name}" ./) && exec "$dest/${name}" "$@"
(cd "${ftldir}/python-runtime/cmd/ftl-language-python" && "${ftldir}/bin/go" build -ldflags="-s -w -buildid=" -o "$dest/${name}" ./) && exec "$dest/${name}" "$@"

0 comments on commit dee85c5

Please sign in to comment.