Skip to content

Commit c78a787

Browse files
committed
chore(gapic): update status and conductor files
1 parent 9ae1839 commit c78a787

3 files changed

Lines changed: 128 additions & 0 deletions

File tree

.conductor/prompt.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Project Context: Python Version Upgrade for Handwritten Libraries
2+
3+
## Mission Statement
4+
To update handwritten client libraries in the `google-cloud-python` monorepo to drop support for older Python versions and align with current support policies.
5+
6+
## Core Workflow
7+
Before doing any work, you MUST read the workflow file:
8+
1. Read `.conductor/workflow.md` for the step-by-step process.
9+
10+
## Project Persona
11+
Adopt the persona of a meticulous Python software developer who:
12+
- Values clean, maintainable code and clear documentation.
13+
- Creates small, focused commits with descriptive messages following Conventional Commits.
14+
- Thoroughly verifies changes before pushing.
15+
16+
## Technical Context
17+
- **Stack:** Python 3
18+
- **Tools:** `version_scanner.py` (custom script for finding version references).
19+
20+
## Guidelines
21+
- **Commit Style:** Conventional Commits (`feat(scope): ...`, `chore(scope): ...`).
22+
- **Candor:** Prioritize correctness over flattery. Suggest improvements if found.
23+
- **Scope of Review:** Remember to check for both package-level and repo-wide references (like in `ci/` and `.github/`) when reviewin' scan results.
24+
25+
## Handling Version References in Comments
26+
When running the version scanner, you will find references to old versions (e.g., 3.7) in comments. Follow these three principles to handle them:
27+
1. **Principle of Ubiquity (Remove):** If a comment references a version older than our minimum supported version and the feature is now standard, remove the reference or the comment.
28+
2. **Principle of Tracked Debt (TODO + Issue):** If the reference points to a potential improvement (tech debt), remove the version reference and replace it with a tracked TODO referencing an issue number (e.g., `# TODO: See Issue #XYZ to use feature...`).
29+
3. **Principle of Explicit Exception (Ignore Pragma):** If you MUST keep the version reference for critical technical context, keep the comment and add `# version-scanner: ignore` at the end of the line.
30+
31+
## Lessons Learned (from proto-plus PR)
32+
- **Leapfrogging:** It is feasible to jump multiple versions (e.g., 3.7 to 3.10) in one go for packages with few references, saving time and reducing PR count.
33+
- **Ambiguous Refs:** Use full refs like `refs/remotes/origin/main` when branching off remote main to avoid ambiguity if local branches with similar names exist.
34+
- **Worktree Cleanliness:** New worktrees might inherit modifications if the base branch has uncommitted changes in the index. Use `git stash` to clean them up before switching branches.
35+
- **GitHub CLI Limitations:** `gh pr edit` may fail due to GraphQL warnings (e.g., Projects classic deprecation). Always be ready to provide the PR description for manual copy-paste as a fallback.
36+
- **PR Descriptions:** Use `gh pr create --body-file` with a temporary file to avoid shell escaping issues with newlines (`\n`).
37+
- **Tech Debt Hygiene:** Prefer tracked TODOs with issue numbers over vague comments about version features to avoid false positives in the scanner.

.conductor/status.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Status: Python Version Upgrade for Handwritten Libraries
2+
3+
**Current State:** Prepped PRs for 3 packages to leapfrog to Python 3.10.
4+
5+
## Completed Packages
6+
7+
### 1. proto-plus
8+
- **Status:** PR Created
9+
- **PR:** #16912
10+
- **Branch:** `chore/update-python-version-proto-plus`
11+
- **Changes:**
12+
- Dropped Python 3.7, 3.8, 3.9 support.
13+
- Required Python >= 3.10 in `pyproject.toml`.
14+
- Updated `noxfile.py` matrix.
15+
- Refactored `repeated.py` to use walrus operator.
16+
- Tracked tech debt in Issue #16911 for `_ignore_` usage.
17+
18+
### 2. sqlalchemy-spanner
19+
- **Status:** PR Created
20+
- **PR:** #16913
21+
- **Branch:** `chore/update-python-version-sqlalchemy-spanner`
22+
- **Changes:**
23+
- Dropped Python 3.7, 3.8, 3.9 support.
24+
- Required Python >= 3.10 in `setup.py`.
25+
- Updated `noxfile.py` matrix and removed dead code.
26+
27+
### 3. django-google-spanner
28+
- **Status:** PR Created
29+
- **PR:** #16914
30+
- **Branch:** `chore/update-python-version-django-google-spanner`
31+
- **Changes:**
32+
- Dropped Python 3.7, 3.8, 3.9 support.
33+
- Required Python >= 3.10 in `setup.py`.
34+
- Updated `noxfile.py` matrix and removed dead code.
35+
36+
### 4. gapic-generator
37+
- **Status:** PR Updated (#16910)
38+
- **Branch:** `feat/gapic-version-fixes`
39+
- **Changes:**
40+
- Leapfrogged to Python 3.10.
41+
- Updated `setup.py`, `noxfile.py`, and templates.
42+
- Refactored `wrappers.py` to use `@functools.cache`.
43+
- Removed stale 3.9 constraints templates.
44+
- Added ignore pragmas for false positives (and updated scanner to support `ignore-next-line`).
45+
- Verified clean scan (except root workflows and Pandoc).
46+
47+
## Next Steps
48+
- [ ] Wait for feedback on how to handle generated code entanglement in `gapic-generator`.
49+
- [ ] Review and merge PRs #16910, #16912, #16913, #16914.
50+
- [ ] Continue with other packages in the small packages list if approved.

.conductor/workflow.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Workflow: Updating Packages for Python Version Upgrades
2+
3+
This workflow outlines the steps to take a package or set of packages and update them against a new runtime version (e.g., dropping 3.7 or upgrading to a new min version).
4+
5+
## Steps
6+
7+
1. **Branching and Worktree:**
8+
* Create a new branch for the updates (e.g., `chore/update-python-<version>-<pkg>`).
9+
* Use the dedicated worktree (`chore-update-handwritten`) for these updates. You do not need a new worktree for every package.
10+
* Keep the scanner branch (`feat/add-version-scanner`) open in the `main` worktree for tool fixes.
11+
* Ensure the branch is up to date with the latest `main` from GitHub (`git fetch origin` and `git merge origin/main`).
12+
13+
2. **Scanning:**
14+
* Run the `version_scanner.py` script to identify references to the version being updated or dropped.
15+
* Example command:
16+
```bash
17+
python3 scripts/version_scanner/version_scanner.py -d python -v <version> --package <package-name> -p <worktree-path>
18+
```
19+
* Use `--package-file` if targeting multiple packages.
20+
21+
3. **Analysis:**
22+
* Review the scan results (CSV file or Google Sheet).
23+
* Filter out false positives (e.g., version numbers in package names or unrelated strings like `pandoc-3.7`).
24+
* Identify actual references that need updates.
25+
* **[IMPORTANT] Check for Root-Level Matches:** When reviewin' scan results, always look for matches labeled as `[Root/None]` in the package summary. These often represent shared CI scripts (`ci/`) or GitHub workflows (`.github/`) that may need updates to align with the new Python version requirements of the package being processed.
26+
27+
4. **Implementation:**
28+
* **Documentation:** Update references to minimum supported versions in `README.rst`, `docs/index.rst`, etc.
29+
* **Configuration:** Update `setup.py`, `pyproject.toml`, `mypy.ini`, etc.
30+
* **CI Scripts:** Update matrix or checks in `ci/run_single_test.sh`, `ci/run_conditional_tests.sh`, or `noxfile.py`.
31+
* **Post-Processing:** Update or remove dead code in `.librarian` YAML files if applicable.
32+
* **Comments:** Apply the principles in `prompt.md` when handling version references in comments (Ubiquity, Tracked Debt, Explicit Exception).
33+
34+
5. **Review and Commit:**
35+
* Review edits with the user or team.
36+
* Create **small, tightly focused commits** for each file or logical change.
37+
* Follow Conventional Commits specification.
38+
39+
6. **Push and PR:**
40+
* Push the branch to GitHub.
41+
* Create a Pull Request.

0 commit comments

Comments
 (0)