Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a665f45
start migrating to uv
falkoschindler Oct 21, 2025
5f3018b
Merge branch 'uv2' into uv
falkoschindler Nov 21, 2025
cf01c3a
update workflow files
falkoschindler Nov 21, 2025
e3e27ed
update devcontainer
falkoschindler Nov 21, 2025
d8c9642
add missing pip for mypy
falkoschindler Nov 21, 2025
819481f
Merge branch 'main' into uv
falkoschindler Nov 21, 2025
37428fd
Merge branch 'main' into uv
falkoschindler Nov 26, 2025
9047d2d
configure version as dynamic
codingpaula Nov 26, 2025
23c1002
update uv.lock
codingpaula Nov 26, 2025
195304b
remove --group dev since uv includes dev dependencies by default in u…
codingpaula Nov 26, 2025
20eb483
add types to dev dependencies
codingpaula Nov 26, 2025
5a13c90
remove step to install pip for mypy since mypy now should have all th…
codingpaula Nov 26, 2025
86dee4d
add scipy to ignored packages and remove mypy config to install types
codingpaula Nov 27, 2025
05aa5e4
fix development dockerfile by not having the user's venv in the image
codingpaula Nov 28, 2025
f1e516b
add uv run in front of the commands
codingpaula Nov 28, 2025
315b0f6
remove specific tests requirements since we use dev requirements in p…
codingpaula Nov 28, 2025
197f2fe
update fly dockerfile to use uv
codingpaula Dec 1, 2025
ae8e984
fix 404 when directly going to examples
codingpaula Dec 1, 2025
a9981db
simplify release dockerfile
codingpaula Dec 1, 2025
24c07db
remove setting of version since we now have a dynamic version
codingpaula Dec 1, 2025
2b9170f
add comment about anonymous volume
codingpaula Dec 1, 2025
5665694
introduce dev group "website"
falkoschindler Dec 1, 2025
e7f8aef
cleanup Docker containers
falkoschindler Dec 2, 2025
54c4ddc
fix Docker CMDs
falkoschindler Dec 2, 2025
bf641f6
fix installation of requirements
codingpaula Dec 2, 2025
f125f03
remove uv run from bash script call
codingpaula Dec 2, 2025
9091fbb
add uv run --no-sync to properly call examples
codingpaula Dec 2, 2025
68caa97
Use uv run to probe python version?
evnchn Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
FROM python:3.9

ENV POETRY_VERSION=2.1.2 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=false \
POETRY_VIRTUALENVS_CREATE=false \
DEBIAN_FRONTEND=noninteractive \
ENV DEBIAN_FRONTEND=noninteractive \
DISPLAY=:99

# Install packages
RUN apt-get update && apt-get install --no-install-recommends -y \
sudo git build-essential chromium chromium-driver \
sudo git build-essential chromium chromium-driver curl \
&& rm -rf /var/lib/apt/lists/*

# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

# Create remote user
ARG USERNAME=vscode
ARG USER_UID=1000
Expand All @@ -26,11 +25,10 @@ ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"
ENV CHROME_BINARY_LOCATION=/usr/bin/chromium

# Install nicegui
RUN pip install -U pip && pip install poetry==$POETRY_VERSION
COPY pyproject.toml poetry.lock README.md ./
RUN poetry install --all-extras --no-root
RUN pip install latex2mathml
COPY pyproject.toml uv.lock* README.md ./
RUN uv sync --all-extras --no-dev
RUN uv pip install latex2mathml

USER $USERNAME

ENTRYPOINT ["poetry", "run", "python", "-m", "debugpy", "--listen" ,"5678", "main.py"]
ENTRYPOINT ["uv", "run", "python", "-m", "debugpy", "--listen" ,"5678", "main.py"]
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
},
// More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "vscode",
"postCreateCommand": "poetry install --all-extras"
"postCreateCommand": "uv sync --all-extras --group dev"
}
16 changes: 10 additions & 6 deletions .github/workflows/_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: abatilo/actions-poetry@v4
- uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: "3.9"
cache: "poetry"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python
run: uv python install 3.9
- name: Install dependencies
run: poetry install --all-extras --with dev
run: uv sync --all-extras --group dev
- name: Install pip for mypy
if: matrix.target.name == 'mypy'
run: uv pip install pip
- name: ${{ matrix.target.name }}
run: poetry run ${{ matrix.target.command }}
run: uv run ${{ matrix.target.command }}
4 changes: 1 addition & 3 deletions .github/workflows/_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call:
inputs:
version:
description: "Version to build (e.g., v1.2.3)"
description: "Version to build (e.g., 1.2.3)"
required: true
type: string

Expand All @@ -18,8 +18,6 @@ jobs:
run: |
DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPOSITORY#*/}
VERSION=${{ inputs.version }}
# Remove 'v' prefix if present
VERSION=${VERSION#v}
SHORTREF=${GITHUB_SHA::8}
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"

Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call:
inputs:
version:
description: "Version to publish (e.g., v1.2.3)"
description: "Version to publish (e.g., 1.2.3)"
required: true
type: string

Expand All @@ -13,27 +13,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: "3.x"
- uses: abatilo/actions-poetry@v4
- run: poetry version ${{ inputs.version }}
- run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python
run: uv python install
- name: Update version
run: |
sed -i "/^\[project\]/,/^version = /s/version = .*/version = \"${{ inputs.version }}\"/" pyproject.toml
- name: Build and publish
run: |
uv build
uv publish --token ${{ secrets.PYPI_API_TOKEN }}
- uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: ${{ contains(inputs.version, 'rc') }}
name: ${{ inputs.version }}
tag_name: ${{ inputs.version }}
name: v${{ inputs.version }}
tag_name: v${{ inputs.version }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Verify PyPI package
run: |
for i in {1..100}
do
sleep 2
python -m pip install 'nicegui==${{ inputs.version }}' && break
python -m pip install "nicegui==${{ inputs.version }}" && break
done
sleep 5
17 changes: 9 additions & 8 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@ jobs:
timeout-minutes: 40
steps:
- uses: actions/checkout@v6
- uses: abatilo/actions-poetry@v4
- uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python }}
cache: "poetry"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python
run: uv python install ${{ matrix.python }}
- name: Install dependencies
run: |
set -x
poetry install --all-extras --with dev
uv sync --all-extras --group dev
- uses: nanasess/[email protected]
- name: ${{ matrix.python }} / ${{ matrix.scope }}
if: matrix.scope == 'pytest'
run: poetry run pytest
run: uv run pytest
- uses: actions/upload-artifact@v5
if: matrix.scope == 'pytest' && failure()
with:
Expand All @@ -45,9 +46,9 @@ jobs:
retention-days: 14
- name: ${{ matrix.python }} / ${{ matrix.scope }}
if: matrix.scope == 'startup'
run: poetry run ./test_startup.sh
run: uv run ./test_startup.sh
- name: Restore dependencies for effective caching
if: matrix.scope == 'startup' && always()
run: |
set -x
poetry install --all-extras --with dev
uv sync --all-extras --group dev
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:
steps:
- name: Extract version
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
run: |
VERSION=${GITHUB_REF#refs/tags/}
# Remove 'v' prefix if present
VERSION=${VERSION#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT

pypi:
needs: extract-version
Expand Down
12 changes: 9 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,18 @@ The simplest way to setup a fully functioning development environment is to star

### Locally

To set up a local development environment for NiceGUI, you'll need to have Python 3.9+ and pip installed.
To set up a local development environment for NiceGUI, you'll need to have Python 3.9+ and [uv](https://docs.astral.sh/uv/) installed.

You can then use the following command to install NiceGUI in editable mode:
You can install uv using:

```bash
python3 -m pip install -e .
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Then use the following command to install NiceGUI in editable mode with all dependencies:

```bash
uv sync --all-extras --group dev
```

This will install the `nicegui` package and all its dependencies, and link it to your local development environment so that changes you make to the code will be immediately reflected.
Expand Down
6 changes: 3 additions & 3 deletions development.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ FROM python:3.9-slim

RUN apt update && apt install curl build-essential -y

RUN python -m pip install --no-cache-dir poetry \
&& poetry config virtualenvs.create false
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

WORKDIR /app

COPY . .
RUN poetry install --all-extras
RUN uv sync --all-extras

RUN pip install latex2mathml

Expand Down
14 changes: 6 additions & 8 deletions fly.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ RUN pip install \
pytest \
selenium

RUN curl -sSL https://install.python-poetry.org | python3 - && \
cd /usr/local/bin && \
ln -s ~/.local/bin/poetry && \
poetry config virtualenvs.create false
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

WORKDIR /app

COPY pyproject.toml poetry.lock* ./
COPY pyproject.toml uv.lock* ./

RUN poetry install --no-root --extras "plotly matplotlib highcharts"
RUN uv sync --no-dev --extra plotly --extra matplotlib --extra highcharts

RUN pip install latex2mathml slowapi

Expand All @@ -36,10 +34,10 @@ ADD . .
# ensure unique version to not serve cached and hence potentially wrong static files
ARG VERSION=unknown
RUN if [ "$VERSION" = "unknown" ]; then echo "Error: VERSION build argument is required. Use: fly deploy --build-arg VERSION=$(git describe --abbrev=0 --tags --match 'v*' 2>/dev/null | sed 's/^v//' || echo '0.0.0')" && exit 1; fi
RUN sed -i "/\[tool.poetry\]/,/]/s/version = .*/version = \"$VERSION\"/" pyproject.toml
RUN sed -i "/^\[project\]/,/^version = /s/version = .*/version = \"$VERSION\"/" pyproject.toml

ENV POETRY_DYNAMIC_VERSIONING_BYPASS=$VERSION
RUN pip install .
RUN uv pip install --system .

EXPOSE 8080

Expand Down
Loading