Skip to content

Commit

Permalink
chore: refactor python dep report to compare to previous docker image…
Browse files Browse the repository at this point in the history
… version
  • Loading branch information
lladdy committed Nov 20, 2024
1 parent c25f94b commit aae345f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.idea
cache

config.py
config.py

before.requirements.txt
after.requirements.txt
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ This image contains all the different technologies and dependencies for agents t
To bump the python version:
1. Set the `PYTHON_VERSION` environment variable in the [Dockerfile](docker/Dockerfile.bot) to the desired version. This will ensure it is installed in the image.
2. Update the `python` version range entry in the [pyproject.toml](pyproject.toml). This will ensure compatible dependencies are installed.
3. Follow the steps below to bump the dependencies and generate a report as they might change based upon the new python version.

### Bumping Python dependencies
### Bumping Python dependencies and generating a report

The [pyproject.toml](pyproject.toml) file describes required dependencies for the bot image.
To bump the dependencies, first set any specifically desired versions (or leave them as "*") in the `pyproject.toml` file.
Then run the following command:
```
# Report the previous requirements.txt file
PREVIOUS_VERSION=v0.0.0 # the previous version arenaclient-bot-base image that we're comparing to
# Take the requirements output from the console of the following command and save it to before.requirements.txt
docker run -it aiarena/arenaclient-bot-base:${PREVIOUS_VERSION} bash -c "pip install poetry && poetry export -f requirements.txt --without-hashes"
# This will build the bot image and then run `poetry update` which will update the `poetry.lock` file with the latest versions.
# After running this, copy the requirements.txt content output from the console and save it to after.requirements.txt
docker compose -f docker/docker-compose.yml run --rm poetry-update
```
This will build the bot image and then run `poetry update` which will update the `poetry.lock` file with the latest versions.
It will also generate a report in the output of the command showing the changes made.
# This will generate a report showing the changes made.
python ./requirements_diff.py
```
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ services:
- ../pyproject.toml:/root/pyproject.toml
- ../requirements_diff.py:/root/requirements_diff.py
working_dir: /root/
command: bash -c "pip install poetry && poetry export -f requirements.txt --output ./before.requirements.txt --without-hashes && poetry update && poetry export -f requirements.txt --output after.requirements.txt --without-hashes && python ./requirements_diff.py"
command: bash -c "pip install poetry && poetry update && poetry export -f requirements.txt --without-hashes"

0 comments on commit aae345f

Please sign in to comment.