Skip to content

chore: modernize Python tooling setup (Phase 1) #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

taeold
Copy link
Collaborator

@taeold taeold commented Jul 1, 2025

Summary

This PR modernizes the Python tooling setup for the Firebase Functions Python SDK, replacing legacy tools with modern alternatives for better performance and developer experience.

Changes

1. Migrate to comprehensive pyproject.toml

  • Move all package metadata from setup.py to pyproject.toml
  • Configure build system with setuptools backend
  • Include private package in distribution
  • Use SPDX license identifier (Apache-2.0)

2. Add uv for dependency management

  • Replace pip/venv with uv for 10-100x faster dependency installation
  • Add .python-version file for consistent Python version
  • Configure .gitignore to exclude uv.lock

3. Configure ruff for linting and formatting

  • Replace pylint with ruff for much faster linting
  • Replace yapf with ruff format for consistent formatting
  • Use modern Python formatting standards (Black-style)
  • Enable Python 3.10+ syntax improvements

4. Update GitHub Actions workflows

  • Replace venv/pip with uv in all workflows
  • Update linting to use ruff instead of pylint
  • Update formatting check to use ruff instead of yapf
  • Use python -m build instead of setup.py bdist_wheel

5. Prepare for future formatting

  • Add .git-blame-ignore-revs file for the upcoming formatting commit
  • Configure ruff with modern defaults (trailing commas, consistent quotes)

Test plan

  • Build works with pyproject.toml: uv run python -m build
  • Tests pass: uv run pytest
  • Linting works: uv run ruff check .
  • Type checking works: uv run mypy .
  • CI passes with new tooling
  • Release workflow builds correctly

Next Steps (separate PRs)

  1. Phase 2: Apply ruff formatting and remove setup.py
  2. Phase 3: Add tox and pre-commit hooks
  3. Phase 4: Update documentation
  4. Phase 5: Additional enhancements

This is a non-breaking change that sets up the tooling without applying formatting yet, to make the PR easier to review.

- Migrate to comprehensive pyproject.toml configuration
  - Move all package metadata from setup.py
  - Configure build system with setuptools backend
  - Include private package in distribution
  - Use SPDX license identifier (Apache-2.0)
- Add uv for fast dependency management with .python-version
- Configure ruff for linting and formatting (replacing pylint/yapf)
  - Use modern Python formatting standards (Black-style)
  - Enable Python 3.10+ syntax improvements
  - Configure to match existing code style where possible
- Update GitHub Actions workflows
  - Replace venv/pip with uv for faster installs
  - Replace pylint with ruff check
  - Replace yapf with ruff format
  - Use python -m build instead of setup.py
- Add .git-blame-ignore-revs for future formatting changes
- Update .gitignore to exclude uv.lock

This is Phase 1 of the modernization plan. Next steps:
- Remove setup.py after verifying builds work
- Apply ruff formatting in separate commit
- Add tox configuration for multi-version testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant