Skip to content

Commit ada25db

Browse files
authored
Merge pull request #1231 from DhavalGojiya/feat/migrate-to-uv
Migrate project dependency management from Pipenv to uv
2 parents bc78e12 + b16aa4d commit ada25db

12 files changed

Lines changed: 1618 additions & 1669 deletions

File tree

.github/workflows/documentation.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,44 @@ env:
2525
jobs:
2626
build:
2727
runs-on: ubuntu-latest
28+
env:
29+
PYTHONUNBUFFERED: 1
30+
UV_PYTHON: "3.9"
31+
UV_LOCKED: 1
2832
steps:
2933
- uses: actions/checkout@v6
3034
with:
3135
fetch-depth: 0
3236
lfs: true
37+
3338
- name: Setup Github Pages
3439
uses: actions/configure-pages@v5
40+
3541
- name: Install Python
3642
uses: actions/setup-python@v5
3743
with:
3844
python-version: "3.9"
39-
cache: "pipenv"
40-
- name: Install pipenv
41-
run: pip install pipenv
42-
- name: Install dependencies
43-
run: |
44-
pipenv install --dev --python=3.9 --deploy
45+
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
48+
with:
49+
version: "0.11.16"
50+
4551
- name: Build docs
4652
run: |
47-
pipenv run sphinx-apidoc -f -o docs meilisearch/
48-
pipenv run sphinx-build docs ./docs/_build/html/
53+
uv run --only-group docs sphinx-apidoc -f -o docs meilisearch/
54+
uv run --only-group docs sphinx-build docs ./docs/_build/html/
4955
# CNAME file is required for GitHub pages custom domain
5056
- name: Create CNAME file
5157
run: |
5258
echo "$CUSTOM_DOMAIN" > ./docs/_build/html/CNAME
5359
echo "Created CNAME in ./docs/_build/html/: $CUSTOM_DOMAIN"
60+
5461
- name: Upload artifacts
5562
uses: actions/upload-pages-artifact@v3
5663
with:
5764
path: "./docs/_build/html"
65+
5866
deploy:
5967
needs: build
6068
environment:

.github/workflows/pre-release-tests.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,28 @@ jobs:
1616
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1717
name: integration-tests-against-rc
1818
runs-on: ubuntu-latest
19+
env:
20+
PYTHONUNBUFFERED: 1
21+
UV_PYTHON: ${{ matrix.python-version }}
22+
UV_LOCKED: 1
1923
steps:
2024
- uses: actions/checkout@v6
25+
2126
- name: Set up Python ${{ matrix.python-version }}
2227
uses: actions/setup-python@v5
2328
with:
2429
python-version: ${{ matrix.python-version }}
25-
cache: "pipenv"
26-
- name: Install pipenv
27-
run: pip install pipenv
28-
- name: Install dependencies
29-
run: pipenv install --dev --python=${{ matrix.python-version }} --deploy
30+
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
33+
with:
34+
version: "0.11.16"
35+
3036
- name: Get the latest Meilisearch RC
3137
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
38+
3239
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
3340
run: docker run -d -p 7700:7700 getmeili/meilisearch-enterprise:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
41+
3442
- name: Test with pytest
35-
run: pipenv run pytest
43+
run: uv run pytest

.github/workflows/pypi-publish.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,30 @@ on:
88
jobs:
99
deploy:
1010
runs-on: ubuntu-latest
11+
env:
12+
PYTHONUNBUFFERED: 1
13+
UV_PYTHON: "3.9"
1114
steps:
1215
- uses: actions/checkout@v6
16+
1317
- name: Set up Python
1418
uses: actions/setup-python@v5
1519
with:
1620
python-version: "3.9"
17-
cache: "pipenv"
21+
1822
- name: Check release validity
1923
run: sh .github/scripts/check-release.sh
20-
- name: Install pipenv
21-
run: pip install pipenv
22-
- name: Install dependencies
23-
run: |
24-
pipenv install
25-
pipenv run pip3 install build setuptools wheel twine
24+
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
27+
with:
28+
version: "0.11.16"
29+
enable-cache: false
30+
2631
- name: Build and publish
2732
env:
2833
TWINE_USERNAME: __token__
2934
TWINE_PASSWORD: "pypi-${{ secrets.PYPI_API_TOKEN }}"
3035
run: |
31-
pipenv run python3 -m build
32-
pipenv run twine upload dist/*
36+
uv build
37+
uvx twine@6.2.0 upload dist/*

.github/workflows/tests.yml

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,89 +18,120 @@ jobs:
1818
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1919
name: integration-tests
2020
runs-on: ubuntu-latest
21+
env:
22+
PYTHONUNBUFFERED: 1
23+
UV_PYTHON: ${{ matrix.python-version }}
24+
UV_LOCKED: 1
2125
steps:
2226
- uses: actions/checkout@v6
27+
2328
- name: Set up Python ${{ matrix.python-version }}
2429
uses: actions/setup-python@v5
2530
with:
2631
python-version: ${{ matrix.python-version }}
27-
cache: "pipenv"
28-
- name: Install pipenv
29-
run: pip install pipenv
30-
- name: Install dependencies
31-
run: pipenv install --dev --python=${{ matrix.python-version }} --deploy
32+
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
35+
with:
36+
version: "0.11.16"
37+
3238
- name: Meilisearch (latest version) setup with Docker
3339
run: docker run -d -p 7700:7700 getmeili/meilisearch-enterprise:latest meilisearch --no-analytics --master-key=masterKey
40+
3441
- name: Test with pytest
35-
run: pipenv run pytest --cov-report=xml
42+
run: uv run pytest --cov-report=xml
3643

3744
pylint:
3845
name: pylint
3946
runs-on: ubuntu-latest
47+
env:
48+
PYTHONUNBUFFERED: 1
49+
UV_PYTHON: "3.9"
50+
UV_LOCKED: 1
4051
steps:
4152
- uses: actions/checkout@v6
53+
4254
- name: Set up Python 3.9
4355
uses: actions/setup-python@v5
4456
with:
4557
python-version: "3.9"
46-
cache: "pipenv"
47-
- name: Install pipenv
48-
run: pip install pipenv
49-
- name: Install dependencies
50-
run: pipenv install --dev --python=3.9 --deploy
58+
59+
- name: Install uv
60+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
61+
with:
62+
version: "0.11.16"
63+
5164
- name: Linter with pylint
52-
run: pipenv run pylint meilisearch tests
65+
run: uv run pylint meilisearch tests
5366

5467
mypy:
5568
name: mypy
5669
runs-on: ubuntu-latest
70+
env:
71+
PYTHONUNBUFFERED: 1
72+
UV_PYTHON: "3.9"
73+
UV_LOCKED: 1
5774
steps:
5875
- uses: actions/checkout@v6
76+
5977
- name: Set up Python 3.9
6078
uses: actions/setup-python@v5
6179
with:
6280
python-version: 3.9
63-
cache: "pipenv"
64-
- name: Install pipenv
65-
run: pip install pipenv
66-
- name: Install dependencies
67-
run: pipenv install --dev --python=3.9 --deploy
81+
82+
- name: Install uv
83+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
84+
with:
85+
version: "0.11.16"
86+
6887
- name: mypy type check
69-
run: pipenv run mypy meilisearch
88+
run: uv run mypy meilisearch
7089

7190
black:
7291
name: black
7392
runs-on: ubuntu-latest
93+
env:
94+
PYTHONUNBUFFERED: 1
95+
UV_PYTHON: "3.9"
96+
UV_LOCKED: 1
7497
steps:
7598
- uses: actions/checkout@v6
99+
76100
- name: Set up Python 3.9
77101
uses: actions/setup-python@v5
78102
with:
79103
python-version: 3.9
80-
cache: "pipenv"
81-
- name: Install pipenv
82-
run: pip install pipenv
83-
- name: Install dependencies
84-
run: pipenv install --dev --python=3.9 --deploy
104+
105+
- name: Install uv
106+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
107+
with:
108+
version: "0.11.16"
109+
85110
- name: black
86-
run: pipenv run black meilisearch tests --check
111+
run: uv run black meilisearch tests --check
87112

88113
isort:
89114
name: isort
90115
runs-on: ubuntu-latest
116+
env:
117+
PYTHONUNBUFFERED: 1
118+
UV_PYTHON: "3.9"
119+
UV_LOCKED: 1
91120
steps:
92121
- uses: actions/checkout@v6
122+
93123
- name: Set up Python 3.9
94124
uses: actions/setup-python@v5
95125
with:
96126
python-version: 3.9
97-
cache: "pipenv"
98-
- name: Install pipenv
99-
run: pip install pipenv
100-
- name: Install dependencies
101-
run: pipenv install --dev --python=3.9 --deploy
127+
128+
- name: Install uv
129+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
130+
with:
131+
version: "0.11.16"
132+
102133
- name: isort
103-
run: pipenv run isort meilisearch tests --check-only
134+
run: uv run isort meilisearch tests --check-only
104135

105136
yaml-lint:
106137
name: Yaml linting check

.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,9 @@ target/
9696
profile_default/
9797
ipython_config.py
9898

99-
# pyenv
99+
# uv
100100
.python-version
101101

102-
# pipenv
103-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
104-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
105-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
106-
# install all needed dependencies.
107-
#Pipfile.lock
108-
109102
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
110103
__pypackages__/
111104

CONTRIBUTING.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ You can set up your local environment natively or using `docker`, check out the
4444

4545
Example of running all the checks with docker:
4646
```bash
47-
docker-compose run --rm package bash -c "pipenv install --dev && pipenv run mypy meilisearch && pipenv run pylint meilisearch tests && pipenv run pytest tests"
47+
docker-compose run --rm package bash -c "uv run mypy meilisearch && uv run pylint meilisearch tests && uv run pytest tests"
4848
```
4949

5050
To install dependencies:
5151

5252
```bash
53-
pipenv install --dev
53+
uv sync
5454
```
5555

5656
### Tests and Linter <!-- omit in toc -->
@@ -62,23 +62,23 @@ Your PR also needs to be formatted using black and isort.
6262
# Tests
6363
curl -L https://install.meilisearch.com | sh # download Meilisearch
6464
./meilisearch --master-key=masterKey --no-analytics # run Meilisearch
65-
pipenv run pytest tests
65+
uv run pytest tests
6666
# MyPy
67-
pipenv run mypy meilisearch
67+
uv run mypy meilisearch
6868
# Linter
69-
pipenv run pylint meilisearch tests
69+
uv run pylint meilisearch tests
7070
# Black
71-
pipenv run black meilisearch tests
71+
uv run black meilisearch tests
7272
# Isort
73-
pipenv run isort meilisearch tests
73+
uv run isort meilisearch tests
7474
```
7575

7676
Optionally tox can be used to run test on all supported version of Python, mypy, and linting.
7777

7878
```bash
7979
docker pull getmeili/meilisearch:latest # Fetch the latest version of Meilisearch image from Docker Hub
8080
docker run -p 7700:7700 getmeili/meilisearch:latest meilisearch --master-key=masterKey --no-analytics
81-
pipenv run tox
81+
uv run tox
8282
```
8383

8484
To check if your `yaml` files are correctly formatted, you need to [install yamllint](https://yamllint.readthedocs.io/en/stable/quickstart.html#installing-yamllint) and then run `yamllint .`

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
FROM python:3.9-buster
22

3-
COPY Pipfile .
4-
COPY Pipfile.lock .
3+
COPY pyproject.toml .
4+
COPY uv.lock .
55

66
RUN apt-get update -y
77

8-
# Install pipenv and compilation dependencies
9-
RUN pip3 install pipenv
10-
RUN pipenv install --dev
8+
# Install uv
9+
COPY --from=ghcr.io/astral-sh/uv:0.11.16 /uv /uvx /bin/
10+
11+
# Install dependencies
12+
RUN uv sync --frozen --no-install-project

Pipfile

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)