Replace poetry by uv in the docs

This commit is contained in:
Alexis Métaireau 2025-01-06 15:04:33 +01:00
parent 4d046989ef
commit ce25d51634
No known key found for this signature in database
GPG key ID: C65C7A89A8FFC56E

View file

@ -62,10 +62,10 @@ sudo apt install -y podman dh-python build-essential make libqt6gui6 \
pipx python3 python3-dev pipx python3 python3-dev
``` ```
Install Poetry using `pipx` (recommended) and add it to your `$PATH`: Install uv using `pipx` (recommended) and add it to your `$PATH`:
_(See also a list of [alternative installation _(See also a list of [alternative installation
methods](https://python-poetry.org/docs/#installation))_ methods](https://docs.astral.sh/uv/getting-started/installation/))_
```sh ```sh
pipx ensurepath pipx ensurepath
@ -142,16 +142,16 @@ sudo dnf install -y rpm-build podman python3 python3-devel python3-uv \
sudo dnf install -y python3.12 sudo dnf install -y python3.12
``` ```
Poetry will automatically pick up the correct version when running. uv will automatically pick up the correct version when running.
</details> </details>
</td> </td>
</tr> </tr>
</table> </table>
Install Poetry using `pipx`: Install uv using `pipx`:
```sh ```sh
pipx install poetry pipx install uv
``` ```
Clone this repository: Clone this repository:
@ -160,38 +160,33 @@ Clone this repository:
git clone https://github.com/freedomofpress/dangerzone/ git clone https://github.com/freedomofpress/dangerzone/
``` ```
Change to the `dangerzone` folder, and install the poetry dependencies: Change to the `dangerzone` folder, and install the uv dependencies:
> **Note**: due to an issue with [poetry](https://github.com/python-poetry/poetry/issues/1917), if it prompts for your keyring, disable the keyring with `keyring --disable` and run the command again.
``` ```
cd dangerzone cd dangerzone
poetry install uv sync
``` ```
Build the latest container: Build the latest container:
```sh ```sh
python3 ./install/common/build-image.py uv run ./install/common/build-image.py
``` ```
Download the OCR language data: Download the OCR language data:
```sh ```sh
python3 ./install/common/download-tessdata.py uv run ./install/common/download-tessdata.py
``` ```
Run from source tree: Run from source tree:
```sh ```sh
# start a shell in the virtual environment
poetry shell
# run the CLI # run the CLI
./dev_scripts/dangerzone-cli --help uv run ./dev_scripts/dangerzone-cli --help
# run the GUI # run the GUI
./dev_scripts/dangerzone uv run ./dev_scripts/dangerzone
``` ```
> [!NOTE] > [!NOTE]
@ -201,7 +196,7 @@ poetry shell
Create a .rpm: Create a .rpm:
```sh ```sh
./install/linux/build-rpm.py uv run ./install/linux/build-rpm.py
``` ```
## Qubes OS ## Qubes OS
@ -323,10 +318,10 @@ you wish to test the Qubes conversion, run the following commands on the `dz` de
```sh ```sh
# run the CLI # run the CLI
QUBES_CONVERSION=1 poetry run ./dev_scripts/dangerzone-cli --help QUBES_CONVERSION=1 uv run ./dev_scripts/dangerzone-cli --help
# run the GUI # run the GUI
QUBES_CONVERSION=1 poetry run ./dev_scripts/dangerzone QUBES_CONVERSION=1 uv run ./dev_scripts/dangerzone
``` ```
And when creating a `.rpm` you'll need to enable the `--qubes` flag. And when creating a `.rpm` you'll need to enable the `--qubes` flag.
@ -364,8 +359,8 @@ cd dangerzone
Install Python dependencies: Install Python dependencies:
```sh ```sh
python3 -m pip install poetry python3 -m pip install uv
poetry install uv sync
``` ```
Install [Homebrew](https://brew.sh/) dependencies: Install [Homebrew](https://brew.sh/) dependencies:
@ -377,38 +372,35 @@ brew install create-dmg
Build the dangerzone container image: Build the dangerzone container image:
```sh ```sh
python3 ./install/common/build-image.py uv run ./install/common/build-image.py
``` ```
Download the OCR language data: Download the OCR language data:
```sh ```sh
python3 ./install/common/download-tessdata.py uv run ./install/common/download-tessdata.py
``` ```
Run from source tree: Run from source tree:
```sh ```sh
# start a shell in the virtual environment
poetry shell
# run the CLI # run the CLI
./dev_scripts/dangerzone-cli --help uv run ./dev_scripts/dangerzone-cli --help
# run the GUI # run the GUI
./dev_scripts/dangerzone uv run ./dev_scripts/dangerzone
``` ```
To create an app bundle, use the `build_app.py` script: To create an app bundle, use the `build_app.py` script:
```sh ```sh
poetry run ./install/macos/build-app.py uv run ./install/macos/build-app.py
``` ```
If you want to build for distribution, you'll need a codesigning certificate, and then run: If you want to build for distribution, you'll need a codesigning certificate, and then run:
```sh ```sh
poetry run ./install/macos/build-app.py --with-codesign uv run ./install/macos/build-app.py --with-codesign
``` ```
The output is in the `dist` folder. The output is in the `dist` folder.
@ -422,10 +414,10 @@ Install the latest version of Python 3.12 (64-bit) [from python.org](https://www
Install Microsoft Visual C++ 14.0 or greater. Get it with ["Microsoft C++ Build Tools"](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and make sure to select "Desktop development with C++" when installing. Install Microsoft Visual C++ 14.0 or greater. Get it with ["Microsoft C++ Build Tools"](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and make sure to select "Desktop development with C++" when installing.
Install [poetry](https://python-poetry.org/). Open PowerShell, and run: Install [uv](https://docs.astral.sh/uv/getting-started/installation/). Open PowerShell, and run:
``` ```
python -m pip install poetry python -m pip install uv
``` ```
Install git from [here](https://git-scm.com/download/win), open a Windows terminal (`cmd.exe`) and clone this repository: Install git from [here](https://git-scm.com/download/win), open a Windows terminal (`cmd.exe`) and clone this repository:
@ -434,36 +426,33 @@ Install git from [here](https://git-scm.com/download/win), open a Windows termin
git clone https://github.com/freedomofpress/dangerzone/ git clone https://github.com/freedomofpress/dangerzone/
``` ```
Change to the `dangerzone` folder, and install the poetry dependencies: Change to the `dangerzone` folder, and install the uv dependencies:
``` ```
cd dangerzone cd dangerzone
poetry install uv sync
``` ```
Build the dangerzone container image: Build the dangerzone container image:
```sh ```sh
python3 .\install\common\build-image.py uv run .\install\common\build-image.py
``` ```
Download the OCR language data: Download the OCR language data:
```sh ```sh
python3 .\install\common\download-tessdata.py uv run .\install\common\download-tessdata.py
``` ```
After that you can launch dangerzone during development with: After that you can launch dangerzone during development with:
``` ```
# start a shell in the virtual environment
poetry shell
# run the CLI # run the CLI
.\dev_scripts\dangerzone-cli.bat --help uv run .\dev_scripts\dangerzone-cli.bat --help
# run the GUI # run the GUI
.\dev_scripts\dangerzone.bat uv run .\dev_scripts\dangerzone.bat
``` ```
### If you want to build the Windows installer ### If you want to build the Windows installer
@ -494,7 +483,7 @@ You'll need a code signing certificate.
Open a command prompt, cd into the dangerzone directory, and run: Open a command prompt, cd into the dangerzone directory, and run:
``` ```
poetry run python .\setup-windows.py build uv run .\setup-windows.py build
``` ```
In `build\exe.win32-3.12\` you will find `dangerzone.exe`, `dangerzone-cli.exe`, and all supporting files. In `build\exe.win32-3.12\` you will find `dangerzone.exe`, `dangerzone-cli.exe`, and all supporting files.
@ -504,7 +493,7 @@ In `build\exe.win32-3.12\` you will find `dangerzone.exe`, `dangerzone-cli.exe`,
Note that you must have a codesigning certificate installed in order to use the `install\windows\build-app.bat` script, because it codesigns `dangerzone.exe`, `dangerzone-cli.exe` and `Dangerzone.msi`. Note that you must have a codesigning certificate installed in order to use the `install\windows\build-app.bat` script, because it codesigns `dangerzone.exe`, `dangerzone-cli.exe` and `Dangerzone.msi`.
``` ```
poetry run .\install\windows\build-app.bat uv run .\install\windows\build-app.bat
``` ```
When you're done you will have `dist\Dangerzone.msi`. When you're done you will have `dist\Dangerzone.msi`.