@@ -49,9 +49,7 @@ Used cache and log files (will be created if necessary):
4949## Setup
5050### Quickstart using ` pip `
5151
52- This project uses [ uv] ( https://github.com/astral-sh/uv ) for managing dependencies.
53- If you just want to try the bot and skip the development setup,
54- you can use ` pip ` instead of ` uv ` (requires Python >= 3.11):
52+ If you just want to try the bot and skip the development setup, you can use ` pip ` (requires Python >= 3.11):
5553
5654``` shell
5755# create and activate virtual environment (optional, but recommended)
@@ -69,13 +67,13 @@ export PRETIX_TOKEN=... # Windows: $env:PRETIX_TOKEN = '...'
6967run-bot --config your-config-file.toml
7068```
7169
72- ### Development setup using ` uv `
70+ ### Full Development Setup
7371
74- Install ` uv ` as documented [ here] ( https://docs.astral.sh/uv/getting-started/installation/ ) , then run ` uv sync --dev ` to create/update a
75- virtual environment with all dependencies according to [ ` uv.lock ` ] ( ./uv.lock ) .
76-
77- If required, ` uv ` will download the required Python version, as specified in
78- [ ` .python-version ` ] ( ./.python-version ) .
72+ * Install ` uv ` as documented [ here] ( https://docs.astral.sh/uv/getting-started/installation/ ) .
73+ * Run ` uv sync --dev ` to create/update a virtual environment with all dependencies according to [ ` uv.lock ` ] ( ./uv.lock ) .
74+ * Run ` . .venv/bin/activate ` (Windows: ` .venv/Scripts/activate ` ) to activate the virtual environment
75+ * Run ` pre-commit install ` to install the [ pre-commit ] ( https://pre-commit.com/ ) hooks.
76+ * Run ` pre-commit run --all-files ` to verify your setup. All checks should pass .
7977
8078To run the bot, use the following:
8179
@@ -85,31 +83,28 @@ export DISCORD_BOT_TOKEN=... # Windows: $env:DISCORD_BOT_TOKEN = '...'
8583export PRETIX_TOKEN=... # Windows: $env:PRETIX_TOKEN = '...'
8684
8785# run the bot with a given config file
88- uv run run-bot --config your-config-file.toml
86+ run-bot --config your-config-file.toml
8987```
9088
91- #### Useful ` uv ` commands
89+ #### Working with ` uv `
9290
91+ This is a list of useful commands when working with ` uv ` .
9392Please refer to the [ uv documentation] ( https://docs.astral.sh/uv ) or ` uv help ` for details.
9493
9594``` shell
96- # generate .venv/ from uv.lock
97- uv sync
98- uv sync --dev # include dev dependencies
99-
100- # activate uv-generated venv
95+ # activate uv-generated virtual environment ("venv")
10196. .venv/bin/activate # Windows: '.venv/Scripts/activate'
10297
103- # execute command inside uv-generated venv
104- uv run [command]
105-
106- # reset all packages to versions pinned in uv.lock
98+ # create/synchronize venv based on uv.lock file
10799uv sync
108100uv sync --dev # include dev dependencies
109101
102+ # execute command inside uv-generated venv (can be skipped if venv is activated)
103+ uv run [command]
104+
110105# add package
111106uv add [package]
112- uv add --dev [package] # install as dev dependency
107+ uv add --dev [package] # as dev dependency
113108
114109# upgrade packages
115110uv lock --upgrade
@@ -120,11 +115,12 @@ uv remove [package]
120115
121116### Development tools
122117
123- * Format code: ` uv run --dev ruff format `
124- * Check code format: ` uv run --dev ruff format --check `
125- * Sort imports: ` uv run --dev ruff check --select I001 --fix `
126- * Check code style: ` uv run --dev ruff check . `
127- * Run tests: ` uv run --dev pytest . `
118+ * Run everything: ` pre-commit run --all-files `
119+ * Format code: ` ruff format `
120+ * Check code format: ` ruff format --check `
121+ * Fix imports: ` ruff check --select I001,F401 --fix `
122+ * Check code style: ` ruff check . `
123+ * Run tests: ` pytest `
128124
129125### Deployment
130126
@@ -137,3 +133,4 @@ Related files:
137133* [ ansible/deploy-playbook.yml] ( ./ansible/deploy-playbook.yml ) : The Ansible Playbook
138134* [ Dockerfile] ( ./Dockerfile ) : The Docker container recipe
139135* [ compose.yaml] ( ./compose.yaml ) : The Docker Compose recipe
136+ * [ prod-config.toml] ( ./prod-config.toml ) : The Prod bot configuration
0 commit comments