Skip to content

Enable setuptools-scm - #319

Open
mweinelt wants to merge 12 commits into
OHF-Voice:mainfrom
mweinelt:setuptool-scm-enable
Open

mweinelt wants to merge 12 commits into
OHF-Voice:mainfrom
mweinelt:setuptool-scm-enable

Conversation

@mweinelt

@mweinelt mweinelt commented May 9, 2026

Copy link
Copy Markdown
Contributor

This fixes the package version, since setuptools-scm needs to be enabled through the existence of its config section.

From

Successfully built linux_voice_assistant-0.0.0.tar.gz and linux_voice_assistant-0.0.0-py3-none-any.whl

To

Successfully built linux_voice_assistant-1.1.11.dev0+g73b494275.d19800101.tar.gz and linux_voice_assistant-1.1.11.dev0+g73b494275.d19800101-py3-none-any.whl

This requires further changes to the container builds, since they don't have a .git tree to pull the version info from. Instead, we use git describe at build time to come up with a version.

With that change applied the package version can be looked up from package metadata and version.txt is not required any longer.

@mweinelt
mweinelt force-pushed the setuptool-scm-enable branch from b383615 to 56c3548 Compare May 9, 2026 23:12
@mweinelt
mweinelt force-pushed the setuptool-scm-enable branch from 56c3548 to 5d6da09 Compare May 9, 2026 23:52
@mweinelt
mweinelt force-pushed the setuptool-scm-enable branch from 5d6da09 to 157bc3c Compare May 9, 2026 23:58
@mweinelt
mweinelt force-pushed the setuptool-scm-enable branch from 157bc3c to a44f73e Compare May 10, 2026 00:01
@florian-asche florian-asche self-assigned this May 10, 2026
@florian-asche florian-asche added the enhancement New feature or request label Jul 15, 2026
@florian-asche

Copy link
Copy Markdown
Collaborator

Really would love to merge this MR. But need more understandable background on what was changed since its to high level for me to understand. Also the new unit tests are failing here. Can you have a look at them ?

Comment thread pyproject.toml
Comment thread Dockerfile
Comment thread script/setup
Comment thread linux_voice_assistant/util.py
Comment thread .github/workflows/docker-build-nightly.yml
@mweinelt

mweinelt commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

In sum this means versions are derived relative to tags on Git. If you are on the exact commit then your version matches the tag, if you are ahead a tag a version relative to the last tag gets constructed.

The new tests expect the version.txt file to be read and for it to be patchable. WIth this change tests require the installed package to run tests against, otherwise there is no .dist-info metadata and the version function in this PR returns unknown.

Do the tests run from the source repo without a proper package installation? I would expect it to simply require python3 -m pip install . before running the tests to make it work.

@florian-asche

Copy link
Copy Markdown
Collaborator

I tested it locally via docker-compose.dev.yml. When running it on

### Specify another docker image (optional):
LVA_IMAGE="ghcr.io/ohf-voice/linux-voice-assistant-pr"
LVA_IMAGE_TAG="319"

in the .env settings i only get version 0.0.0.

@mweinelt

mweinelt commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Can you somehow call scripts/version and pass that as the VERSION argument to docker?

@florian-asche

Copy link
Copy Markdown
Collaborator

Can you somehow call scripts/version and pass that as the VERSION argument to docker?

➜  linux-voice-assistant git:(setuptool-scm-enable) ./script/version 
3c355bc

that is working. But when running the dev container which mounts the linux-voice-assistant directory it is not able to detect the version.

@mweinelt

Copy link
Copy Markdown
Contributor Author

The dev container would require access to .git to find the correct version.

@florian-asche

Copy link
Copy Markdown
Collaborator

Hm, ok i did try to mount the .git directory into the container by adding:
- ./.git:/app/.git

But in the container the version script does not give any version. I noticed that there is no git installed in the container, think we it needs to at least be added right ?

mweinelt added 11 commits August 7, 2026 17:36
This fixes the package version, since setuptools-scm needs to be enabled
through the existence of its config section.

The Docker container is now passed a VERSION attribute at build time that
for CI jobs is derived from the Git tree. This is necessary because the
Git tree is not copied into the Docker container.
With --tag we get a version relative to the last tag, while with --always
we sometimes just get a short hash.
Not every test makes sense any more, when we are consuming dist-info
metadata.

- We are not testing file operations any more
- Testing always requires an installed package
- Permission errors can't happen unless someone mangled the venv
- Checking for strip() happens on the wrong layer now
@mweinelt

mweinelt commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Would you mind adding the relevant changes for the development container? Or giving me some hints what the relevant files are?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants