Skip to content

Commit 175f7fb

Browse files
committed
feat: modernize packaging with pyproject.toml and uv
- Migrate package metadata from setup.py to pyproject.toml (PEP 621) - Keep dynamic version reading from __init__.py for compatibility - Use modern dependency-groups format (PEP 735) for dev dependencies - Add uv for fast dependency management (10-100x faster than pip) - Update all CI/CD workflows to use uv - Add .python-version file for consistent Python version - Update CONTRIBUTING.md with uv instructions - Use modern build tool instead of setup.py commands - Fix license format to use SPDX identifier Benefits: - Faster dependency installation and resolution with uv - Modern Python packaging standards compliance - Better dependency locking with uv.lock - Simpler, more maintainable configuration - Consistent Python version across environments
1 parent d31224c commit 175f7fb

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

.github/CONTRIBUTING.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,50 @@ information on using pull requests.
2323

2424
## Setup local environment
2525

26-
Clone the project and run the following commands to setup your environment
26+
Clone the project and install [uv](https://github.com/astral-sh/uv) (our package manager):
2727

2828
```sh
29-
python3.11 -m venv venv
30-
source venv/bin/activate
31-
pip3 install --upgrade pip
32-
python3.11 -m pip install -e ".[dev]"
29+
# Install uv (if not already installed)
30+
curl -LsSf https://astral.sh/uv/install.sh | sh
31+
32+
# Clone and setup the project
33+
git clone https://github.com/firebase/firebase-functions-python.git
34+
cd firebase-functions-python
35+
uv sync --dev
3336
```
3437

35-
(this also applies to setting up samples environment for each sample)
38+
This will automatically:
39+
- Create a virtual environment
40+
- Install all runtime and development dependencies
41+
- Use the Python version specified in `.python-version` (3.10)
42+
43+
(For samples, you can use the same approach but run `uv sync` in each sample directory)
3644

3745
### Running tests
3846

3947
Without coverage:
4048
```bash
41-
python3.11 -m pytest
49+
uv run pytest
4250
```
4351

4452
With coverage:
4553
```bash
46-
python3.11 -m pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv
54+
uv run pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv
4755
```
4856

4957
### Formatting code
5058

5159
```bash
52-
python3.11 -m ruff format .
60+
uv run ruff format .
5361
```
5462

5563
### Running lints & type checking
5664

5765
```bash
5866
# Type checking
59-
python3.11 -m mypy .
67+
uv run mypy .
6068
# Linting
61-
python3.11 -m ruff check .
69+
uv run ruff check .
6270
```
6371

6472
### Generating Docs

.github/workflows/release.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,23 @@ jobs:
4141
with:
4242
python-version: '3.10'
4343

44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v3
46+
with:
47+
enable-cache: true
48+
4449
- name: Install dependencies
4550
run: |
46-
pip install --upgrade pip
47-
python -m pip install -e ".[dev]"
51+
uv sync --dev
4852
4953
- name: Test with pytest & coverage
5054
run: |
51-
python -m pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv
55+
uv run pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv
5256
5357
# Build the Python Wheel and the source distribution.
5458
- name: Package release artifacts
5559
run: |
56-
python -m pip install setuptools wheel
57-
python setup.py bdist_wheel sdist
60+
uv run python -m build
5861
5962
# Attach the packaged artifacts to the workflow output. These can be manually
6063
# downloaded for later inspection if necessary.

0 commit comments

Comments
 (0)