Skip to content

Commit e523dd4

Browse files
authored
chore: migrate from poetry to uv (#174)
* chore: migrate from poetry to uv Relates: apify/crawlee-python#628 * fix update package version * update package version using sed
1 parent 22b5eb4 commit e523dd4

File tree

7 files changed

+58
-45
lines changed

7 files changed

+58
-45
lines changed

.github/workflows/python_bump_and_update_changelog.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,18 @@ jobs:
4040
with:
4141
python-version: ${{ inputs.python_version }}
4242

43-
- name: Install poetry
44-
run: pipx install --python ${{ inputs.python_version }} poetry
43+
- name: Set up uv package manager
44+
uses: astral-sh/setup-uv@v5
45+
with:
46+
python-version: ${{ inputs.python_version }}
4547

4648
- name: Update package version in pyproject.toml
47-
run: poetry version ${{ inputs.version_number }}
49+
shell: bash
50+
run: |
51+
new_version="${{ inputs.version_number }}"
52+
echo "Updating version in pyproject.toml to ${new_version}"
53+
# Update the "version" key in the [project] section of pyproject.toml.
54+
sed -i '/^\[project\]/,/^\[/ s/^\(version\s*=\s*\)".*"/\1"'${new_version}'"/' pyproject.toml
4855
4956
- name: Update CHANGELOG.md
5057
uses: DamianReeves/write-file-action@master

.github/workflows/python_docs_check.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ jobs:
3636
with:
3737
python-version: ${{ inputs.python_version }}
3838

39+
- name: Set up uv package manager
40+
uses: astral-sh/setup-uv@v5
41+
with:
42+
python-version: ${{ inputs.python_version }}
43+
3944
- name: Install Python dependencies
40-
run: |
41-
pipx install --python ${{ inputs.python_version }} poetry
42-
make install-dev
45+
run: make install-dev
4346

4447
- name: Build API reference
4548
run: make build-api-reference

.github/workflows/python_integration_tests.yaml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ jobs:
3333
with:
3434
python-version: ${{ matrix.python-version }}
3535

36+
- name: Set up uv package manager
37+
uses: astral-sh/setup-uv@v5
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
3641
- name: Install Python dependencies
37-
run: |
38-
pipx install --python ${{ matrix.python-version }} poetry
39-
make install-dev
42+
run: make install-dev
4043

4144
- name: Run integration tests
4245
run: make INTEGRATION_TESTS_CONCURRENCY=8 integration-tests
@@ -77,14 +80,15 @@ jobs:
7780
with:
7881
python-version: ${{ matrix.python-version }}
7982

80-
- name: Install Python dependencies
81-
run: |
82-
pipx install --python ${{ matrix.python-version }} poetry
83-
# This forces poetry to use specific Python version when installing a project.
84-
# Raises error, if this Python version does not match project specific Python constraints.
85-
poetry config virtualenvs.use-poetry-python true
86-
poetry env use ${{ matrix.python-version }}
87-
make install-dev
83+
- name: Set up Python ${{ matrix.python-version }}
84+
uses: actions/setup-python@v5
85+
with:
86+
python-version: ${{ matrix.python-version }}
87+
88+
- name: Set up uv package manager
89+
uses: astral-sh/setup-uv@v5
90+
with:
91+
python-version: ${{ matrix.python-version }}
8892

8993
- name: Run integration tests
9094
run: make INTEGRATION_TESTS_CONCURRENCY=8 integration-tests

.github/workflows/python_lint_check.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ jobs:
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222

23+
- name: Set up uv package manager
24+
uses: astral-sh/setup-uv@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
2328
- name: Install Python dependencies
24-
run: |
25-
pipx install --python ${{ matrix.python-version }} poetry
26-
# This forces poetry to use specific Python version when installing a project.
27-
# Raises error, if this Python version does not match project specific Python constraints.
28-
poetry config virtualenvs.use-poetry-python true
29-
poetry env use ${{ matrix.python-version }}
30-
make install-dev
29+
run: make install-dev
3130

3231
- name: Run lint check
3332
run: make lint

.github/workflows/python_type_check.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ jobs:
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222

23+
- name: Set up uv package manager
24+
uses: astral-sh/setup-uv@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
2328
- name: Install Python dependencies
24-
run: |
25-
pipx install --python ${{ matrix.python-version }} poetry
26-
# This forces poetry to use specific Python version when installing a project.
27-
# Raises error, if this Python version does not match project specific Python constraints.
28-
poetry config virtualenvs.use-poetry-python true
29-
poetry env use ${{ matrix.python-version }}
30-
make install-dev
29+
run: make install-dev
3130

3231
- name: Run type check
3332
run: make type-check

.github/workflows/python_unit_tests.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,13 @@ jobs:
2828
with:
2929
python-version: ${{ matrix.python-version }}
3030

31-
- name: Install Poetry for version checking
32-
run: |
33-
pip install poetry
31+
- name: Set up uv package manager
32+
uses: astral-sh/setup-uv@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
3435

3536
- name: Install Python dependencies
36-
run: |
37-
pipx install --python ${{ matrix.python-version }} poetry
38-
# This forces poetry to use specific Python version when installing a project.
39-
# Raises error, if this Python version does not match project specific Python constraints.
40-
poetry config virtualenvs.use-poetry-python true
41-
poetry env use ${{ matrix.python-version }}
42-
make install-dev
37+
run: make install-dev
4338

4439
- name: Run unit tests
4540
run: make unit-tests

prepare-pypi-distribution/action.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ runs:
2929
with:
3030
python-version: ${{ inputs.python_version }}
3131

32+
- name: Set up uv package manager
33+
uses: astral-sh/setup-uv@v5
34+
with:
35+
python-version: ${{ inputs.python_version }}
36+
3237
- name: Install dependencies
3338
shell: bash
34-
run: |
35-
pipx install --python ${{ inputs.python_version }} poetry
36-
make install-dev
39+
run: make install-dev
3740

3841
# Updates the version number in the project's configuration.
3942
- name: Set version in pyproject.toml
@@ -55,7 +58,10 @@ runs:
5558
.[0] + 1
5659
'
5760
)
58-
poetry version "${{ inputs.version_number }}b$next_beta"
61+
new_version="${{ inputs.version_number }}b${next_beta}"
62+
echo "Updating version in pyproject.toml to ${new_version}"
63+
# Update the "version" key in the [project] section of pyproject.toml.
64+
sed -i '/^\[project\]/,/^\[/ s/^\(version\s*=\s*\)".*"/\1"'${new_version}'"/' pyproject.toml
5965
fi
6066
6167
# Builds the package.

0 commit comments

Comments
 (0)