Skip to content

Commit 6f5f11a

Browse files
authored
Migrate to uv (#189)
2 parents b37054a + e43f79e commit 6f5f11a

File tree

9 files changed

+2577
-3857
lines changed

9 files changed

+2577
-3857
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!uv.lock
3+
!pyproject.toml
4+
!user-settings/

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
push:
88
paths:
99
- 'Dockerfile'
10-
- 'poetry.lock'
10+
- 'uv.lock'
1111
workflow_dispatch:
1212
inputs:
1313
version:

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: check-toml
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
- id: mixed-line-ending
9+
- id: trailing-whitespace

Dockerfile

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,37 @@ ARG PACKAGE_VERSION='latest'
66

77
ENV JUPYTER_SETTINGS="/home/${NB_USER}/.jupyter/lab/user-settings" \
88
PATH="/home/${NB_USER}/.local/bin:${PATH}" \
9-
POETRY_INSTALLER="https://install.python-poetry.org/install-poetry.py" \
10-
POETRY_VIRTUALENVS_CREATE=false \
9+
UV_INSTALLER="https://astral.sh/uv/install.sh" \
1110
VIRTUAL_ENV="${CONDA_DIR}"
1211
RUN mkdir -p ${JUPYTER_SETTINGS}
1312
COPY user-settings/ ${JUPYTER_SETTINGS}/
14-
COPY poetry.lock pyproject.toml ./
1513

1614
# Install utilities for plot & animation rendering
1715
RUN \
18-
apt update \
19-
&& apt install -y imagemagick ffmpeg \
16+
apt-get update \
17+
&& apt-get install -y imagemagick ffmpeg \
2018
&& apt-get clean \
2119
&& rm -rf /var/lib/apt/lists/*
2220

21+
# Use conda to install geospatial libraries (due to binary dependencies)
2322
RUN \
24-
# Use conda to install geospatial libraries (due to binary dependencies)
2523
conda config --set channel_priority strict \
2624
&& conda install -yq -c conda-forge \
27-
'gdal==3.6.2' \
28-
'geoviews==1.9.6' \
29-
'geopandas==0.12.2' \
30-
# Use poetry to install all other packages from lockfile
31-
&& fix-permissions "/home/${NB_USER}" \
32-
&& wget $POETRY_INSTALLER \
33-
&& python install-poetry.py -y \
34-
&& poetry add "pyinaturalist@${PACKAGE_VERSION}" \
35-
&& poetry install -v \
36-
# Cleanup
37-
&& poetry cache clear -q --all . \
38-
&& python install-poetry.py --uninstall -y \
39-
&& rm poetry.lock pyproject.toml install-poetry.py \
25+
'gdal==3.10' \
26+
'geoviews==1.14' \
27+
'geopandas==1.0' \
4028
&& conda clean -yaf || echo 'Failed to clear Conda cache' \
41-
&& echo 'Fixing permissions' \
29+
&& fix-permissions "${CONDA_DIR}"
30+
31+
# Install all other packages from lockfile via uv
32+
COPY uv.lock pyproject.toml ./
33+
RUN \
34+
fix-permissions "/home/${NB_USER}" \
35+
&& curl -LsSf $UV_INSTALLER | sh \
36+
&& uv add "pyinaturalist@${PACKAGE_VERSION}" \
37+
&& uv sync \
38+
&& uv cache clean \
39+
&& rm uv.lock pyproject.toml \
4240
&& fix-permissions "${CONDA_DIR}" \
4341
&& fix-permissions "/home/${NB_USER}"
4442

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
[![Docker Image Version](https://img.shields.io/docker/v/jxcook/pyinaturalist-notebook)](https://hub.docker.com/r/jxcook/pyinaturalist-notebook)
44
[![Run with Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyinat/pyinaturalist/main?filepath=examples)
55

6-
This is a simple extension of the Jupyter notebook server
6+
This is an extension of the Jupyter notebook server
77
([jupyter/scipy-notebook](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-scipy-notebook))
88
for working with [iNaturalist](https://www.inaturalist.org) data, which adds
9-
[pyinaturalist](https://github.com/pyinat/pyinaturalist) plus some extra packages for data exploration & visualization.
9+
[pyinaturalist](https://github.com/pyinat/pyinaturalist) and all dependencies needed for running
10+
[pyinaturalist example notebooks](https://pyinaturalist.readthedocs.io/en/stable/examples.html).
1011

1112
## Usage
1213
```bash

poetry.lock

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

pyproject.toml

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,32 @@
1-
[tool.poetry]
1+
[project]
22
name = "pyinaturalist-notebook"
3-
version = "0.20.0"
3+
version = "0.21.0"
44
description = "A Jupyter notebook image for iNaturalist data exploration & visualization"
5-
authors = ["Jordan Cook"]
6-
license = "MIT"
7-
package-mode = false
8-
9-
[tool.poetry.dependencies]
10-
python = "^3.10"
11-
altair = ">=4.1"
12-
altair-saver = ">=0.5"
13-
bar_chart_race = ">=0.1"
14-
beautifulsoup4 = ">=4.0"
15-
black = ">=22.3"
16-
ipyplot = ">=1.1"
17-
isort = ">=5.10"
18-
jupyterlab-code-formatter = ">=2.2"
19-
jupyterlab-geojson = ">=3.1"
20-
pillow = ">=9.1.1"
21-
plotly = ">=5.1"
22-
pyinaturalist-convert = {extras = ["all"], version = ">=0.6"}
23-
pyopenssl = ">=23.2"
24-
vega-datasets = ">=0.9"
25-
websocket-client = ">=1.3"
26-
xarray = ">=0.18"
27-
28-
# Version solving sometimes get stuck on trying every combination of these
29-
# urllib3 = "^2.0.7"
30-
# boto3 = "^1.34.13"
31-
# botocore = "^1.34.13"
32-
33-
# Specific version is optionally set via workflow variable -> Docker build arg
34-
pyinaturalist = {extras = ["all"], version = "*"}
5+
authors = [
6+
{name = "Jordan Cook"}
7+
]
8+
license = {text = "MIT"}
9+
requires-python = ">=3.10"
10+
dependencies = [
11+
"altair>=4.1",
12+
"altair-saver>=0.5",
13+
"bar_chart_race>=0.1",
14+
"beautifulsoup4>=4.0",
15+
"ipyplot>=1.1",
16+
"isort>=5.10",
17+
"jupyterlab-geojson>=3.1",
18+
"pillow>=9.1.1",
19+
"plotly>=5.1",
20+
"pyinaturalist-convert>=0.7.5",
21+
"pyarrow>=10.0",
22+
"pyopenssl>=23.2",
23+
"vega-datasets>=0.9",
24+
"websocket-client>=1.3",
25+
"xarray>=0.18",
26+
"xmltodict>=0.12",
27+
"pyinaturalist",
28+
]
3529

3630
[build-system]
37-
requires = ["poetry-core>=1.0.0"]
38-
build-backend = "poetry.core.masonry.api"
39-
40-
[tool.black]
41-
skip-string-normalization = true
42-
line-length = 100
31+
requires = ["hatchling"]
32+
build-backend = "hatchling.build"

user-settings/@ryantam626/jupyterlab_code_formatter/settings.jupyterlab-settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
"line_length": 100
88
},
99
"formatOnSave": true
10-
}
10+
}

0 commit comments

Comments
 (0)