Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,37 +67,32 @@ jobs:
go-version-file: protoc-gen-connect-python/go.mod
cache-dependency-path: "**/go.mod"

- run: uv sync --all-packages
- run: uv sync --frozen

- name: run lints
if: startsWith(matrix.os, 'ubuntu-')
run: |
uv run ruff format --check .
uv run ruff check .
uv run pyright
run: uv run poe lint

- name: run python tests
run: uv run pytest ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
run: uv run poe test ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}

- name: run conformance tests
# TODO: Debug stdin/stdout issues on Windows
if: ${{ !startsWith(matrix.os, 'windows-') }}
run: uv run pytest ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
working-directory: conformance
run: uv run poe test-conformance ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}

- name: run OTel tests
run: uv run pytest ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
working-directory: connectrpc-otel
run: uv run poe test-otel ${{ matrix.coverage == 'cov' && '--cov=connectrpc_otel --cov-report=xml' || '' }}

- name: run Go tests
run: go test ./...
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few more that look worth getting into tasks but didn't go too far this time

working-directory: protoc-gen-connect-python

- name: check running `just generate` does not create a diff
- name: check running generate does not create a diff
# NOTE: running on macOS as our sed command only works there
# We expect uv.lock to change when matrix.resolution == "lowest-direct", so we don't check it there.
if: ${{ startsWith(matrix.os, 'macos-') && matrix.resolution == 'highest' }}
run: uv run just checkgenerate
run: uv run poe checkgenerate
env:
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0

- run: uv run --group docs --no-dev zensical build --clean
- run: uv run poe docs-build

- uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
if: github.event_name != 'pull_request'
Expand Down
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ $ git commit -s -m "your commit message"

- Python 3.10 or later
- [uv](https://docs.astral.sh/uv/) for dependency management
- [just](https://just.systems/) for running tasks

### Installation

Expand All @@ -38,13 +37,13 @@ $ git commit -s -m "your commit message"
2. Verify everything is working:

```console
$ uv run just check
$ uv run poe check
```

## Development Workflow

We use `just` as our task runner.
Run `uv run just --list` to see all available commands.
We use `poe` as our task runner.
Run `uv run poe` to see all available commands.

## Submitting a Pull Request

Expand All @@ -57,7 +56,7 @@ Run `uv run just --list` to see all available commands.
2. Make your changes and ensure all checks pass:

```console
$ uv run just check
$ uv run poe check
```

3. Commit with a sign-off and a clear message, then push to your fork and open a pull
Expand Down
21 changes: 9 additions & 12 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,20 @@

## Development Workflow

We use `just` as a task runner. Available commands:
We use `poe` as a task runner. Available commands:

```bash
# Run all checks
uv run just check
uv run poe check

# Format code
uv run just format

# Run type checking
uv run just typecheck
uv run poe format

# Run tests
uv run just test
uv run poe test

# Run conformance tests
uv run just conformance
uv run poe test-conformance
```

## Code Style
Expand All @@ -58,23 +55,23 @@ The project follows strict type checking and formatting standards.
### Unit Tests

```bash
uv run just test
uv run poe test
```

### Conformance Tests

The project uses the official Connect conformance test suite. Go must be installed to run them.

```bash
uv run just conformance
uv run poe test-conformance
```

## Code Generation

The project includes protobuf code generation for examples and tests:

```bash
uv run just generate
uv run poe generate
```

## Releasing
Expand All @@ -90,7 +87,7 @@ Documentation is contained in the [connectrpc/connectrpc.com](https://github.com
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Run the full test suite: `uv run just check`
4. Run the full smoke check suite: `uv run poe check`
5. Submit a pull request

### Pull Request Guidelines
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,7 @@ Set up a virtual env:
uv sync
```

Then, use `uv run just` to do development checks, or check out `uv run just --list` for other targets.
`just` is run via `uv` as a development dependency, but you can also install it globally and omit the `uv run` from the commands.
Then, use `uv run poe check` to do development checks, or check out `uv run poe` for other targets.

## Status

Expand Down
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ This document outlines how to create a release of connect-python.

2. On a new branch, update version strings with the `bump` command, either to the next minor or patch version, based on the changes that are included in this new release.

- If there are only bug fixes and no new features, run `uv run just bump patch`.
- If there are features being released, run `uv run just bump minor`.
- If there are only bug fixes and no new features, run `uv run poe bump --version patch`.
- If there are features being released, run `uv run poe bump --version minor`.

Note the new version X.Y.Z in the updated files.

Expand Down
1 change: 0 additions & 1 deletion connect-python.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"golang.go",
"ms-python.python",
"ms-python.vscode-pylance",
"nefrob.vscode-just-syntax",
],
},
"settings": {
Expand Down
73 changes: 0 additions & 73 deletions justfile

This file was deleted.

118 changes: 118 additions & 0 deletions poe_tasks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#:schema https://json.schemastore.org/partial-poe.json
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't mind putting it directly in pyproject.toml but I tend to split it out to prevent an ever-growing project config file


[env]
BUF_VERSION = "v1.67.0"

[tasks.bump]
help = "Bump the project version"
sequence = [
{ cmd = "uv version --active --bump=${_version}" },
{ cmd = "uv version --active --directory protoc-gen-connect-python --bump=${_version}" }
]
args = [
{ name = "_version", help = "The type of version bump to apply", choices = [
"patch",
"minor",
"major"
] }
]
Comment on lines +12 to +18
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was just kicking the tires and noticed this doesn't working without an arg supplied; make it a required arg?: https://poethepoet.natn.io/guides/args_guide.html

Suggested change
args = [
{ name = "_version", help = "The type of version bump to apply", choices = [
"patch",
"minor",
"major"
] }
]
args = [
{ name = "_version", required = true, help = "The type of version bump to apply", choices = [
"patch",
"minor",
"major"
] }
]


[tasks.check]
help = "Run smoke checks"
sequence = ["lint", "test", "test-otel"]

[tasks.checkgenerate]
help = "Used in CI to verify that generate doesn't produce a diff"
sequence = [
"generate",
{ shell = 'test -z "$(git status --porcelain | tee /dev/stderr)"' },
]

[tasks.docs-build]
help = "Build documentation"
cmd = "zensical build"
executor = { type = "uv", group = "docs" }

[tasks.docs-serve]
help = "Start documentation local server"
cmd = "zensical serve"
executor = { type = "uv", group = "docs" }

[tasks.format]
help = "Apply all possible auto-formatting to files"
sequence = ["format-python", "format-toml"]

[tasks.format-python]
help = "Apply auto-formatting to Python files"
sequence = [
{ cmd = "ruff check --fix --unsafe-fixes --exit-zero" },
{ cmd = "ruff format" }
]

[tasks.format-toml]
help = "Apply auto-formatting to TOML files"
cmd = "tombi format"

[tasks.generate]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to the tombi schema supporting the new groups feature (hint hint :) )

https://poethepoet.natn.io/guides/help_guide.html#grouping-tasks

help = "Generate all files"
sequence = [
"generate-conformance",
"generate-example",
"generate-status",
"generate-test",
"format",
]

[tasks.generate-conformance]
help = "Generate conformance files"
sequence = [
{ cmd = "go run github.com/bufbuild/buf/cmd/buf@${BUF_VERSION} generate" },
{ shell = "find test/gen -type f -exec sed -i '' 's/from connectrpc.conformance.v1/from gen.connectrpc.conformance.v1/' {} +", env = { "LC_ALL" = "c" } },
]
cwd = "conformance"

[tasks.generate-example]
help = "Generate example files"
cmd = "go run github.com/bufbuild/buf/cmd/buf@${BUF_VERSION} generate"
cwd = "example"

[tasks.generate-status]
help = "Generate gRPC status"
cmd = "go run github.com/bufbuild/buf/cmd/buf@${BUF_VERSION} generate"

[tasks.generate-test]
help = "Generate test files"
cmd = "go run github.com/bufbuild/buf/cmd/buf@${BUF_VERSION} generate"
cwd = "test"

[tasks.lint]
help = "Apply all possible linting to files"
sequence = ["lint-python", "lint-toml", "lint-types"]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm always torn on whether lint should run typechecks since it is pretty slow, but I went with it this time since I feel it is the simplest model

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still love to investigate ty someday, maybe when they're a little more stable...


[tasks.lint-python]
help = "Apply linting to Python files"
sequence = [{ cmd = "ruff check" }, { cmd = "ruff format --check" }]

[tasks.lint-toml]
help = "Apply linting to TOML files"
cmd = "tombi lint"

[tasks.lint-types]
help = "Apply type checking to Python files"
cmd = "pyright"

[tasks.test]
help = "Run unit tests"
cmd = "pytest"

[tasks.test-conformance]
help = "Run conformance tests. These are very slow"
cmd = "pytest"
cwd = "conformance"

[tasks.test-otel]
help = "Run connectrpc-otel tests"
# Use uv run to make sure the package is built before running tests.
# Instrumentation tests require package metadata.
cmd = "uv run pytest"
cwd = "connectrpc-otel"
2 changes: 1 addition & 1 deletion protoc-gen-connect-python/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/connectrpc/connect-python/protoc-gen-connect-python

go 1.25.0
go 1.25.7
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to match the latest buf, or otherwise go-version-file selects a too-old Go. While I like to keep this at 0, it is less important for non-libraries, especially ones commonly used with buf


require (
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dev = [
"grpcio-tools==1.80.0",
"gunicorn==25.3.0",
"hypercorn==0.18.0",
"just-bin==1.48.1; sys_platform != 'win32'",
"poethepoet==0.44.0",
"pyright[nodejs]==1.1.408",
"pyvoy==0.3.0",
"ruff==0.15.9",
Expand Down
Loading
Loading