Skip to content

Commit 821eca5

Browse files
chore: Remove all traces of poetry
1 parent 088fa72 commit 821eca5

8 files changed

Lines changed: 47 additions & 77 deletions

File tree

.devcontainer/python/Dockerfile

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ FROM mcr.microsoft.com/devcontainers/python:${VARIANT}
33

44

55
ARG DEBIAN_FRONTEND=noninteractive
6-
ARG POETRY_VERSION=1.8.3
7-
ARG POETRY_VIRTUALENVS_PATH
6+
ARG UV_VERSION=0.7.15
87
ENV USER=vscode
98

109
RUN DEBIAN_FRONTEND=noninteractive \
11-
&& apt-get update \
10+
&& apt-get update \
1211
&& apt-get install -y build-essential --no-install-recommends make \
1312
ca-certificates \
1413
git \
@@ -34,27 +33,21 @@ USER $USER
3433
ENV HOME="/home/$USER"
3534
ENV PATH="${HOME}/.local/bin:$PATH"
3635

37-
# Set poetry related env vars
38-
# Set poetry virtualenv path in writable dir outsde mounted workspace
39-
ENV POETRY_VIRTUALENVS_PATH="$HOME/.venv"
40-
ENV POETRY_VIRTUALENVS_CREATE=true
41-
ENV POETRY_VIRTUALENVS_IN_PROJECT=false
42-
ENV POETRY_VIRTUALENVS_PROMPT='ecalc-py{python_version}'
4336
ENV PIP_DEFAULT_TIMEOUT=100
4437

4538
# Python and poetry installation
4639
RUN echo $(which python) && echo $(which python3) \
4740
&& python3 -m pip install --upgrade pip pipx \
48-
&& pipx install "poetry==${POETRY_VERSION}" \
41+
&& pipx install "uv==${UV_VERSION}" \
4942
&& pip install pre-commit \
50-
&& poetry --version \
43+
&& uv --version \
5144
&& pre-commit --version
5245

5346
# Set workdir to ecalc project
5447
WORKDIR /workspaces/ecalc
5548

5649
# Copy essential file (devcontainer setup takes care of other files)
57-
COPY pyproject.toml poetry.lock ./
50+
COPY pyproject.toml uv.lock ./
5851

5952
# Install poetry environment without root package
60-
RUN poetry install --no-interaction --no-ansi --no-root
53+
RUN uv sync --locked

Dockerfile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ ENV PYTHONUNBUFFERED=1 \
66
PIP_NO_CACHE_DIR=1 \
77
PIP_DISABLE_PIP_VERSION_CHECK=1 \
88
PIP_DEFAULT_TIMEOUT=100 \
9-
# poetry:
10-
POETRY_VERSION=1.8.3 \
11-
POETRY_NO_INTERACTION=1 \
12-
POETRY_VIRTUALENVS_CREATE=false \
13-
POETRY_CACHE_DIR='/var/cache/pypoetry' \
14-
POETRY_HOME='/usr/local' \
9+
# uv:
10+
UV_VERSION=0.7.15 \
1511
# pipx:
1612
PIPX_BIN_DIR=/opt/pipx/bin \
1713
PIPX_HOME=/opt/pipx/home \
@@ -22,23 +18,23 @@ ENV PYTHONUNBUFFERED=1 \
2218
RUN apt-get update && apt-get install -y \
2319
default-jre \
2420
&& python -m pip install --upgrade pip pipx \
25-
&& pipx install "poetry==$POETRY_VERSION" \
26-
&& poetry --version \
21+
&& pipx install "uv==$UV_VERSION" \
22+
&& uv --version \
2723
# Cleaning cache:
2824
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
2925
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
3026

3127
WORKDIR /project/libecalc/
3228

33-
COPY ./pyproject.toml ./poetry.lock ./
29+
COPY ./pyproject.toml ./uv.lock ./
3430

3531
# Building all dependencies first to get a python environment we can use for dev
36-
RUN python3 -m venv $VIRTUAL_ENV && poetry install --no-interaction --no-ansi --no-root
32+
RUN python3 -m venv $VIRTUAL_ENV && uv sync --locked
3733

3834
FROM dev AS build
3935

4036
COPY . .
41-
RUN python3 -m venv $VIRTUAL_ENV && poetry install
37+
RUN python3 -m venv $VIRTUAL_ENV && uv sync --locked
4238

4339
WORKDIR /project/libecalc/src/
4440

@@ -59,7 +55,7 @@ RUN mkdir /dist
5955
RUN poetry version $ECALC_VERSION
6056

6157
# Finally build the libecalc package
62-
RUN poetry build
58+
RUN uv build
6359
RUN cp dist/*.whl /dist/
6460
RUN chown -R $ECALC_USER:$ECALC_GROUP /dist/
6561

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,27 @@ See [Examples](#examples) below to use one of our predefined examples.
104104

105105
## Development and Contribution
106106

107+
For package management during development, we use uv.
108+
Read more here https://docs.astral.sh/uv/.
109+
In short, it can replace several tools like pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more. While
110+
staying being performant.
111+
112+
Depending on the platform / tools you have at disposal, you can install it in many different ways:
113+
114+
**Mac**
115+
116+
```shell
117+
brew install uv
118+
```
119+
120+
**OS independent (with pipx)**
121+
122+
```shell
123+
pipx install uv
124+
```
125+
126+
See https://docs.astral.sh/uv/getting-started/installation/ for several other options.
127+
107128
We welcome all kinds of contributions, including code, bug reports, issues, feature requests, and documentation.
108129
The preferred way of submitting a contribution is to either make an issue on GitHub or by forking the project on GitHub
109130
and making a pull request.

docs/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,21 @@ This will start a web-server that you can access in the web-browser. Follow the
109109
In order to generate the API reference documentation while also building the docs, use the following:
110110
```
111111
$ npm run build
112-
$ poetry run python make-api-reference.py
112+
$ uv run python make-api-reference.py
113113
$ npm run serve
114114
```
115115

116116
### Generate CLI reference documentation
117117
In order to generate the CLI reference documentation, use the following:
118118
```
119-
$ poetry run typer src/ecalc_cli/main.py utils docs > ./docs/docs/about/getting_started/cli/cli_reference.md
119+
$ uv run typer src/ecalc_cli/main.py utils docs > ./docs/docs/about/getting_started/cli/cli_reference.md
120120
```
121121

122122
### Generate JSON Schema
123123
In order to generate the JSON Schema documentation, use the following (from `src`):
124124
```
125125
$ cd src
126-
$ poetry run python generate_json_schema.py > ../docs/docs/about/getting_started/yaml/ecalc_json_schema.json
126+
$ uv run python generate_json_schema.py > ../docs/docs/about/getting_started/yaml/ecalc_json_schema.json
127127
```
128128

129129
Then build the documentation:
@@ -134,12 +134,12 @@ $ npm run build && npm run serve
134134
## Python alternative
135135
To avoid dependency on NodeJS and npm for some users, we have made it possible to edit/view the docs using python:
136136

137-
```
138-
$ poetry install
137+
```shell
138+
uv sync
139139
```
140140

141-
```
142-
$ mkdocs serve
141+
```shell
142+
mkdocs serve
143143
```
144144

145145
This will open a browser.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ dev = [
8181
]
8282

8383
[tool.uv]
84-
required-version = "0.7.7"
84+
required-version = "==0.7.*"
8585
package = true
8686

8787
[tool.pytest.ini_options]

test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ pytest [other_args] --snapshot-update -m "not dockersnapshot"
4242
If you want to run the dockersnapshot tests and update snapshots without docker compose, and ad-hoc, you can run the following command, from libecalc root:
4343

4444
```bash
45-
docker run --rm -v .:/project/libecalc -w /project/libecalc -t $(docker build -q . -f Dockerfile --target build) poetry run pytest -m dockersnapshot --snapshot-update
45+
docker run --rm -v .:/project/libecalc -w /project/libecalc -t $(docker build -q . -f Dockerfile --target build) uv run pytest -m dockersnapshot --snapshot-update
4646
```

test/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
working_dir: /project/libecalc
88
volumes:
99
- ../:/project/libecalc
10-
command: ["poetry", "run", "pytest", "-m", "dockersnapshot", "--snapshot-update"]
10+
command: [ "uv", "run", "pytest", "-m", "dockersnapshot", "--snapshot-update" ]
1111
platform: linux/amd64
1212

1313
test:
@@ -18,4 +18,4 @@ services:
1818
working_dir: /project/libecalc
1919
volumes:
2020
- ../:/project/libecalc
21-
command: ["poetry", "run", "pytest", "-n", "auto"]
21+
command: [ "uv", "run", "pytest", "-n", "auto" ]

uv.lock

Lines changed: 1 addition & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)