Skip to content

Commit 86cb1f4

Browse files
anuraagai2y
andauthored
Rework to connectrpc org (#144)
* chore: rework to connectrpc org * Fix protoc pyproject * Some remaining case-insensitive connecpys * pyproject * docs: Update README and add GitHub Actions workflows per review feedback - Add GitHub Actions workflows for project management and PR linting - Fix package import names (connectrpc not connect_python) - Fix class names to match actual implementation - Remove incorrect CORS feature claim - Add comprehensive streaming examples for all RPC types - Add Examples section highlighting Eliza chatbot demo - Add WSGI support documentation - Add Advanced Features section (GET support, CORS, limits, editions) - Improve installation instructions Addresses review comments from @bufdev on PR #144 * Cleanup * Fix workflow * Fix warning * publish * Add Peter to maintainers --------- Co-authored-by: i2y <[email protected]> Co-authored-by: Yasushi Itoh <[email protected]>
1 parent eed635b commit 86cb1f4

File tree

113 files changed

+1429
-2586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1429
-2586
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Community Code of Conduct
2+
3+
Connect follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).

.github/CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributing
2+
3+
We'd love your help making `connect-python` better!
4+
5+
If you'd like to add new exported APIs, please [open an issue][open-issue]
6+
describing your proposal - discussing API changes ahead of time makes
7+
pull request review much smoother. In your issue, pull request, and any other
8+
communications, please remember to treat your fellow contributors with
9+
respect!
10+
11+
Note that for a contribution to be accepted, you must sign off on all commits
12+
in order to affirm that they comply with the [Developer Certificate of Origin][dco].
13+
14+
## Setup
15+
16+
[Fork][fork], then clone the repository:
17+
18+
```
19+
git clone [email protected]:your_github_username/connect-python.git
20+
cd connect-python
21+
git remote add upstream https://github.com/connectrpc/connect-python.git
22+
git fetch upstream
23+
```
24+
25+
Make sure that the tests and the linters pass.
26+
Their usage is described [here](https://github.com/connectrpc/connect-python?tab=readme-ov-file#development).
27+
28+
## Making Changes
29+
30+
Start by creating a new branch for your changes:
31+
32+
```
33+
git checkout main
34+
git fetch upstream
35+
git rebase upstream/main
36+
git checkout -b cool_new_feature
37+
```
38+
39+
Make your changes. When you're satisfied with your changes, push them to your fork.
40+
41+
```
42+
git commit -a
43+
git push origin cool_new_feature
44+
```
45+
46+
Then use the GitHub UI to open a pull request.
47+
48+
At this point, you're waiting on us to review your changes. We _try_ to respond
49+
to issues and pull requests within a few business days, and we may suggest some
50+
improvements or alternatives. Once your changes are approved, one of the
51+
project maintainers will merge them.
52+
53+
We're much more likely to approve your changes if you:
54+
55+
- Add tests for new functionality.
56+
- Write a [good commit message][commit-message].
57+
- Maintain backward compatibility.
58+
59+
[fork]: https://github.com/connectrpc/connect-python/fork
60+
[open-issue]: https://github.com/connectrpc/connect-python/issues/new
61+
[dco]: https://developercertificate.org
62+
[commit-message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Add issues and PRs to project
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
- reopened
8+
- transferred
9+
pull_request_target:
10+
types:
11+
- opened
12+
- reopened
13+
issue_comment:
14+
types:
15+
- created
16+
17+
# GitHub token created from secret so default token not used.
18+
permissions: {}
19+
20+
jobs:
21+
call-workflow-add-to-project:
22+
name: Call workflow to add issue to project
23+
uses: connectrpc/base-workflows/.github/workflows/add-to-project.yaml@main
24+
secrets: inherit

.github/workflows/ci.yaml

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555

5656
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
5757
with:
58-
go-version-file: go.work
58+
go-version-file: protoc-gen-connect-python/go.mod
5959
cache-dependency-path: "**/go.mod"
6060

6161
- run: uv sync
@@ -68,28 +68,70 @@ jobs:
6868
uv run pyright
6969
7070
- name: run python tests
71-
run: uv run pytest ${{ matrix.coverage == 'cov' && '--cov=connecpy --cov-report=xml' || '' }}
71+
run: uv run pytest ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
7272

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

7979
- name: run tests with minimal dependencies
80-
run: uv run --exact pytest ${{ matrix.coverage == 'cov' && '--cov=connecpy --cov-report=xml' || '' }}
80+
run: uv run --exact pytest ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
8181
working-directory: noextras
8282

8383
- name: run Go tests
8484
run: go test ./...
85-
working-directory: protoc-gen-connecpy
85+
working-directory: protoc-gen-connect-python
8686

87-
- name: build Go archives
88-
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
87+
- uses: codecov/codecov-action@v5
88+
if: ${{ matrix.coverage == 'cov' }}
89+
90+
publish:
91+
runs-on: ubuntu-24.04
92+
needs: build
93+
steps:
94+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
95+
96+
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
97+
98+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
99+
with:
100+
python-version-file: pyproject.toml
101+
102+
- run: uv sync --frozen
103+
104+
- name: Modify package name for TestPyPI
105+
run: |
106+
# The 'connect-python' name is claimed on TestPyPI. No big
107+
# deal, we can use a different name since this is just to test
108+
# publishing really.
109+
# TODO: Update now that this is in connectrpc
110+
sed -i 's/name = "connect-python"/name = "firetiger-connect-python"/' pyproject.toml
111+
112+
- run: uv build
113+
114+
- name: build codegen archives
89115
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
90116
with:
91117
version: "~> v2"
92118
args: release --snapshot --clean
119+
workdir: protoc-gen-connect-python
93120

94-
- uses: codecov/codecov-action@v5
95-
if: ${{ matrix.coverage == 'cov' }}
121+
- run: |
122+
uv sync --frozen
123+
uv run python scripts/generate_wheels.py
124+
working-directory: protoc-gen-connect-python
125+
126+
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
127+
if: github.event_name != 'pull_request'
128+
with:
129+
repository-url: https://test.pypi.org/legacy/
130+
skip-existing: true
131+
132+
- name: publish protoc-gen-connect-python
133+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
134+
if: github.event_name != 'pull_request'
135+
with:
136+
packages-dir: protoc-gen-connect-python/dist
137+
skip-existing: true

.github/workflows/pr-title.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint PR Title
2+
# Prevent writing to the repository using the CI token.
3+
# Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
4+
permissions:
5+
pull-requests: read
6+
on:
7+
pull_request:
8+
# By default, a workflow only runs when a pull_request's activity type is opened,
9+
# synchronize, or reopened. We explicity override here so that PR titles are
10+
# re-linted when the PR text content is edited.
11+
types:
12+
- opened
13+
- edited
14+
- reopened
15+
- synchronize
16+
jobs:
17+
lint:
18+
uses: bufbuild/base-workflows/.github/workflows/pr-title.yaml@main

.github/workflows/release.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525

2626
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2727
with:
28-
go-version-file: go.work
28+
go-version-file: protoc-gen-connect-python/go.mod
2929
cache-dependency-path: "**/go.mod"
3030

3131
- run: uv sync --frozen
3232

3333
- run: uv build
3434

35-
- name: build Go archives
35+
- name: build codegen archives
3636
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
3737
with:
3838
version: "~> v2"
@@ -43,19 +43,19 @@ jobs:
4343
- run: |
4444
uv sync --frozen
4545
uv run python scripts/generate_wheels.py
46-
working-directory: protoc-gen-connecpy
46+
working-directory: protoc-gen-connect-python
4747
4848
- uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
4949
with:
5050
subject-checksums: out/checksums.txt
5151

52-
- name: publish connecpy
52+
- name: publish connect-python
5353
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
5454
with:
5555
skip-existing: true
5656

57-
- name: publish protoc-gen-connecpy
57+
- name: publish protoc-gen-connect-python
5858
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
5959
with:
60-
packages-dir: protoc-gen-connecpy/dist
60+
packages-dir: protoc-gen-connect-python/dist
6161
skip-existing: true

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ venv.bak/
119119
.vscode
120120

121121
# generated Go binary
122-
protoc-gen-connecpy/protoc-gen-connecpy
122+
protoc-gen-connect-python/protoc-gen-connect-python
123123

124124
# goreleaser archives
125125
out/

DEVELOPMENT.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Development
2+
3+
## Setting Up Development Environment
4+
5+
### Prerequisites
6+
7+
- Python 3.10 or later
8+
- [uv](https://docs.astral.sh/uv/) for dependency management
9+
10+
### Installation
11+
12+
1. Clone the repository:
13+
14+
```bash
15+
git clone https://github.com/connectrpc/connect-python
16+
cd connect-python
17+
```
18+
19+
2. Install dependencies:
20+
21+
```bash
22+
uv sync
23+
```
24+
25+
## Development Workflow
26+
27+
We use `just` as a task runner. Available commands:
28+
29+
```bash
30+
# Run all checks
31+
uv run just check
32+
33+
# Format code
34+
uv run just format
35+
36+
# Run type checking
37+
uv run just typecheck
38+
39+
# Run tests
40+
uv run just test
41+
42+
# Run conformance tests
43+
uv run just conformance
44+
```
45+
46+
## Code Style
47+
48+
We use:
49+
50+
- **ruff** for linting and formatting
51+
- **pyright** for type checking
52+
- **pytest** for testing
53+
54+
The project follows strict type checking and formatting standards.
55+
56+
## Testing
57+
58+
### Unit Tests
59+
60+
```bash
61+
uv run just test
62+
```
63+
64+
### Conformance Tests
65+
66+
The project uses the official Connect conformance test suite. Go must be installed to run them.
67+
68+
```bash
69+
uv run just conformance
70+
```
71+
72+
## Code Generation
73+
74+
The project includes protobuf code generation for examples and tests:
75+
76+
```bash
77+
uv run just generate
78+
```
79+
80+
## Documentation
81+
82+
### Building Documentation
83+
84+
```bash
85+
# Build documentation
86+
uv run just docs
87+
88+
# Serve documentation locally
89+
uv run just docs-serve
90+
```
91+
92+
### Writing Documentation
93+
94+
- Use MyST markdown for documentation files
95+
- Place API documentation in `docs/api.md`
96+
- Place examples in `docs/examples.md`
97+
- Update the main `docs/index.md` for structural changes
98+
99+
## Contributing
100+
101+
1. Fork the repository
102+
2. Create a feature branch
103+
3. Make your changes
104+
4. Run the full test suite: `uv run just check`
105+
5. Submit a pull request
106+
107+
### Pull Request Guidelines
108+
109+
- Ensure all tests pass
110+
- Add tests for new functionality
111+
- Update documentation as needed
112+
- Follow the existing code style
113+
- Write clear commit messages

0 commit comments

Comments
 (0)