How we install the libraries
We give your bot its own Python environment (.venv) and install into it from the first file we find, in this order:
requirements.txt:uv pip install -r requirements.txt.uv.lock:uv sync --locked --no-dev. Runuv lockafter every change topyproject.toml, because a lockfile that doesn't match stops the install.poetry.lockorpdm.lock: we install the project frompyproject.tomlwithuv pip install ., without the lockfile, and the console sayspoetry.lock is not used, installing from pyproject.toml.Pipfile:pipenv install.pyproject.tomlalone:uv pip install ..
To get the exact versions you tested with Poetry or PDM, add a requirements.txt with pinned versions, since it comes first. Pin every library with ==, such as discord.py==2.7.1; "Run your bot" warns you when a library has no version.
We only install again when the install command, the Python version, the dependency file or its partner changes: pyproject.toml for a lockfile, Pipfile.lock for a Pipfile. Otherwise the console shows dependencies are up to date (uv).
Python version
We read the version from the first file we find: .python-version, then runtime.txt such as python-3.11.9, then python_version in Pipfile, then .tool-versions. Without any of them, your bot runs on Python 3.12.
When your code asks for another version, we install it with uv on the first deployment that asks, and the console shows creating .venv with Python 3.11 through uv. When the version changes, we rebuild the environment: Python changed to 3.11, rebuilding .venv.
How we start your bot
The first match wins:
- The start command in your bot's settings.
- The
startfield inserverk.json. - The
worker:orbot:line of aProcfile. main.py, thenbot.py,app.py,src/main.pyandsrc/bot.py.python -mwith the one folder at the top of your code that holds a__main__.py, such aspython -m mybot. Folders namedtests,test,docs,examplesandscriptsdon't count.
A file starts as .venv/bin/python -u main.py. A command you write in the settings, in serverk.json or in a Procfile runs with .venv/bin first on the path, so python there is your bot's own Python.
What the runtime has
ffmpeg, libopus and libsodium for voice bots, and the build tools for libraries that build during the install. Everything your bot prints reaches the console at once, because PYTHONUNBUFFERED=1 is set.
Did this guide help you?
Improve this guide
Guides are open source. Found a fix or an addition? Open a pull request on github.com/serverkgg/bot-python