Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #923 +/- ##
=======================================
Coverage 99.63% 99.63%
=======================================
Files 103 103
Lines 8238 8238
=======================================
Hits 8208 8208
Misses 30 30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There's a potential problem when using This has been reported as astral-sh/uv#12481 but it was closed by This has also been discussed in explosion/spaCy#13747 where it was suggested to call e.g. OTOH, this only affects development installs (and currently Docker images that also use |
|
Note to self: The EDIT: Done in 65abb14 |
juhoinkinen
left a comment
There was a problem hiding this comment.
I noticed that the Dockerimage size doubles, and AI tools recommended the changes as in the attached file.
There was a problem hiding this comment.
There is a possibilty to enable bytecode compilation for uv installs (apparently uv does not perform it by default?); we could add UV_COMPILE_BYTECODE=1 to Dockerfile (although when I checked its effect with plain annif command, I cannot see a difference in startup time).
|
The mentioned Dockerfile here, with .txt extension to allow sharing in GitHub. |
|
@juhoinkinen Thanks for the review! I made the suggested changes. The Docker image size is now 2.36 GB, which is close to the current But now SonarCloud complains about ownership of copied files. See full explanation. The problem (if it is a problem indeed) is not new but SonarCloud only noticed it now that the COPY commands were adjusted instead of doing separate chown operations. I wonder if file ownership for the annif user is really necessary within the image? |
|
I tried using The subdirectories cannot be accessed (as annif_user) and Annif cannot start: Previously the chmod command was I think that was good: everyone could read the files, but only root could write. To achieve that with uv without doubling the image size, maybe a multistage build should be utilized. 🤔 |
…setting that got lost
…; set up bash completion globally
|
@juhoinkinen It turned out that the chown/chmod options were mostly useless. Apparently most of these were introduced by the AI tools used to suggest changes to the Dockerfile. I adjusted the Dockerfile so it's now much closer to the original (before this PR). Image size is still ~2.37GB. There are still a couple of open questions:
|
…Annif are readable/traversable regardless of their original permissions
|
|
I added the chmod command back because it is useful after all: if a developer has strict file permissions (non world readable/traversable), then they will be copied to the container with those permissions and cannot be accessed by annif_user. I had to adjust the command a little to avoid matching |
|
Posted a heads up about the change on annif-users: https://groups.google.com/g/annif-users/c/J1tikQAQQAE |
|
Based on what I learned here in this PR, I suggested a feature for uv to support a shorter syntax for uv sync extras: |



This PR switches to uv for dependency management instead of Poetry.
Included changes:
pyproject.tomlto work withuv; for example, declare the dev dependencies using standard[dependency-groups]sectionuvcommands for development installsuvinstead of Poetryuvinstead of Poetryflake8to skip e.g..venvdirectory (uvwill create the virtual environment there by default)Some notes:
uvdoesn't have a command for permanently activating the venv like the oldpoetry shellor the newer equivalenteval $(poetry env activate). It is recommended to useuv runevery time, but I think that's cumbersome. However, the venv can simply be activated usingsource .venv/bin/activateso I recommended that in the README. (There is an open issue about this, but it seems that implementing this properly to handle all edge cases is a bit difficult, so the developers hesitate to do it.)ghcr.io/astral-sh/uv:python3.12-bookworm-slim. An alternative would have been to keep the vanilla base imagepython:3.12-slim-bookwormand just installuvwithin that.astral-sh/setup-uvis handling all caching of dependencies, but I haven't verified that it works in a sane way...Overall,
uvseems a bit faster than Poetry. For example, the GitHub Actions run completes in less than 3 minutes, when it used to take a bit more than 3 minutes (though with a lot of variation).In the future, using
uvshould enable better management of PyTorch variants when we add it as a dependency (for example for the EBM backend - see #914 ).Closes #919