Skip to content

Commit 56d6277

Browse files
authored
uv dependency management system (#105)
* uv lock * uv publish * remove poetry * poetry also for light package * typo * ruff check * force updated deps * uv
1 parent f6b0c5d commit 56d6277

File tree

19 files changed

+4905
-7584
lines changed

19 files changed

+4905
-7584
lines changed

.github/workflows/check.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@ jobs:
1616
python-version: "3.10"
1717
- name: Add libmagic for python-magic on linux
1818
run: sudo apt-get install libmagic1
19-
- name: Install Poetry
20-
uses: snok/install-poetry@v1
2119
- name: Install dependencies
2220
run: |
23-
poetry install --without dev
24-
poetry run pip install pytest
21+
pip install uv
22+
uv pip install -r pyproject.toml --system
2523
- name: Test import
2624
run: |
2725
export AWS_ACCESS_KEY_ID=${{ secrets.S3_ACCESS_KEY }}
2826
export AWS_SECRET_ACCESS_KEY=${{ secrets.S3_SECRET_KEY }}
29-
# python example/download.py
27+
# python example/download.py
3028
- name: Test with pytest
3129
run: |
32-
poetry run pytest
30+
uv run pytest
3331

.github/workflows/lint.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ jobs:
1616
python-version: "3.10"
1717
- name: Add libmagic for python-magic on linux
1818
run: sudo apt-get install libmagic1
19-
- name: Install Poetry
20-
uses: snok/install-poetry@v1
2119
- name: Install dependencies
2220
run: |
23-
poetry install --without dev
21+
pip install uv
22+
uv pip install -r pyproject.toml --system
2423
- name: Lint with flake8
2524
run: |
2625
cd cartiflette
Lines changed: 17 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,31 @@
11
name: test_and_publish
22

3-
on:
3+
on:
44
push:
55
tags:
66
- 'client-*'
77

8+
89
jobs:
9-
test:
10+
run:
11+
name: "Build and publish release"
1012
runs-on: ubuntu-latest
11-
defaults:
12-
run:
13-
working-directory: ./python-package/cartiflette
13+
1414
steps:
15-
#----------------------------------------------
16-
# check-out repo and set-up python
17-
#----------------------------------------------
18-
- name: Check out repository
19-
uses: actions/checkout@v3
20-
- name: Set up python
21-
id: setup-python
22-
uses: actions/setup-python@v4
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v3
2319
with:
24-
python-version: '3.9'
25-
#----------------------------------------------
26-
# ----- install & configure poetry -----
27-
#----------------------------------------------
28-
- name: Install Poetry
29-
uses: snok/install-poetry@v1
20+
enable-cache: true
21+
cache-dependency-glob: uv.lock
3022

31-
#----------------------------------------------
32-
# install dependencies if cache does not exist
33-
#----------------------------------------------
34-
- name: Install dependencies
35-
run: poetry install --no-interaction --without dev
23+
- name: Set up Python
24+
run: uv python install 3.12 # Or whatever version I want to use.
3625

37-
#----------------------------------------------
38-
# add only pytest for tests (not the full dev dependencies)
39-
#----------------------------------------------
40-
- name: Add pytest
41-
run: poetry run pip install pytest
26+
- name: Build
27+
run: uv build
4228

43-
#----------------------------------------------
44-
# add only pytest-cov for tests (not the full dev dependencies)
45-
#----------------------------------------------
46-
- name: Add pytest-cov
47-
run: poetry run pip install pytest-cov
29+
- name: Publish
30+
run: uv publish --token ${{ secrets.PAT_PYPI }}
4831

49-
#----------------------------------------------
50-
# run test suite
51-
#----------------------------------------------
52-
- name: Run tests
53-
run: poetry run pytest --cov -W error
54-
55-
publish:
56-
runs-on: ubuntu-latest
57-
defaults:
58-
run:
59-
working-directory: ./python-package/cartiflette
60-
needs: test
61-
steps:
62-
#----------------------------------------------
63-
# check-out repo and set-up python
64-
#----------------------------------------------
65-
- name: Check out repository
66-
uses: actions/checkout@v3
67-
- name: Set up python
68-
id: setup-python
69-
uses: actions/setup-python@v4
70-
with:
71-
python-version: '3.9'
72-
#----------------------------------------------
73-
# ----- install & configure poetry -----
74-
#----------------------------------------------
75-
- name: Install Poetry
76-
uses: snok/install-poetry@v1
77-
78-
#----------------------------------------------
79-
# config pypi token
80-
#----------------------------------------------
81-
- name: Set pypi token
82-
run: poetry config pypi-token.pypi ${{secrets.PAT_PYPI}}
83-
84-
#----------------------------------------------
85-
# build
86-
#----------------------------------------------
87-
- name: Build
88-
run: poetry build
89-
90-
#----------------------------------------------
91-
# run test suite
92-
#----------------------------------------------
93-
- name: Publish to Pypi
94-
run: poetry publish

.github/workflows/pypi.yml

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,30 @@
1-
name: Upload Python Package
1+
# publish.yml
22

3-
on:
4-
push:
5-
branches:
6-
- 'pypi'
3+
name: "Publish"
74

8-
permissions:
9-
contents: read
5+
on:
6+
release:
7+
types: ["published"]
108

119
jobs:
12-
release-build:
10+
run:
11+
name: "Build and publish release"
1312
runs-on: ubuntu-latest
1413

1514
steps:
16-
- uses: actions/checkout@v4 # Ensure actions are pinned properly
17-
18-
- uses: actions/setup-python@v5
19-
with:
20-
python-version: "3.x"
21-
22-
- name: Build release distributions
23-
run: |
24-
python -m pip install build
25-
python -m build
15+
- uses: actions/checkout@v4
2616

27-
- name: Upload distributions
28-
uses: actions/upload-artifact@v4
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v3
2919
with:
30-
name: release-dists
31-
path: dist/
32-
33-
publish:
34-
runs-on: ubuntu-latest
35-
36-
needs:
37-
- release-build
38-
39-
permissions:
40-
id-token: write
41-
contents: read # Added this permission
20+
enable-cache: true
21+
cache-dependency-glob: uv.lock
4222

43-
environment:
44-
name: publish
45-
url: https://pypi.org/p/cartiflette
23+
- name: Set up Python
24+
run: uv python install 3.12 # Or whatever version I want to use.
4625

47-
steps:
48-
- name: Retrieve release distributions
49-
uses: actions/download-artifact@v4
50-
with:
51-
name: release-dists
52-
path: dist/
26+
- name: Build
27+
run: uv build
5328

54-
- name: Publish release distributions to PyPI
55-
uses: pypa/gh-action-pypi-publish@release/v1
56-
with:
57-
user: __token__
58-
password: ${{ secrets.PYPI_PASSWORD }} # Ensure the secret name is correct
29+
- name: Publish
30+
run: uv publish --password ${{ secrets.PYPI_PASSWORD }}

Dockerfile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,15 @@ ENV \
1414
PYTHONHASHSEED=random \
1515
PIP_NO_CACHE_DIR=off \
1616
PIP_DISABLE_PIP_VERSION_CHECK=on \
17-
PIP_DEFAULT_TIMEOUT=100 \
18-
# Poetry's configuration:
19-
POETRY_NO_INTERACTION=1 \
20-
POETRY_VIRTUALENVS_CREATE=false \
21-
POETRY_CACHE_DIR='/var/cache/pypoetry' \
22-
POETRY_HOME='/usr/local'
17+
PIP_DEFAULT_TIMEOUT=100
2318

2419
# Create structure
2520
COPY pyproject.toml .
26-
COPY poetry.lock .
21+
COPY uv.lock .
2722
COPY README.md .
2823
COPY cartiflette ./cartiflette
2924
COPY docker/test.py .
3025

31-
RUN curl https://install.python-poetry.org/ | python -
32-
RUN poetry install --only main --no-interaction
26+
RUN pip install uv && uv pip install -r pyproject.toml --system
3327

34-
CMD ["python", "test.py"]
28+
CMD ["python", "test.py"]

argo-pipeline/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""A simple API to expose cartiflette files"""
22
import typing
33
from fastapi import FastAPI, Response
4-
from fastapi.responses import FileResponse
54

65
from cartiflette.api import download_from_cartiflette_inner
76
from cartiflette.config import PATH_WITHIN_BUCKET

example/dev_get_BV.ipynb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,7 @@
4747
"metadata": {},
4848
"outputs": [],
4949
"source": [
50-
"import os\n",
51-
"import ftplib\n",
52-
"import glob\n",
53-
"import re\n",
54-
"import typing\n",
5550
"import tempfile\n",
56-
"import yaml\n",
57-
"import py7zr\n",
58-
"import geopandas as gpd\n",
59-
"import requests #added\n",
60-
"from tqdm import tqdm\n",
6151
"import zipfile\n",
6252
"import pandas as pd\n",
6353
"import dev"

misc/test_import.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
import os
21

3-
import cartiflette.s3 as s3

0 commit comments

Comments
 (0)