Skip to content

Better Reporting of the GUI Tool Version Numbers#136

Open
joshanne wants to merge 4 commits into
dronecan:masterfrom
joshanne:pr/python-build-managed-version-control
Open

Better Reporting of the GUI Tool Version Numbers#136
joshanne wants to merge 4 commits into
dronecan:masterfrom
joshanne:pr/python-build-managed-version-control

Conversation

@joshanne

@joshanne joshanne commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

This is hopefully a change for the better.

I have team members running various versions of the main branch since the last release. I cannot tell exactly which version they are running because the application only tells me what version.py contains, which is typically updated just before the next tag and release is about to occur.

This PR makes use of setuptools_scm to improve the reporting of the version number.

The current build/release process entails:

  1. Change the software version in version.py
  2. Tag the release
  3. Build and generate the release artifacts

This means, for all users installing from master after the last release, their build "looks" like the most recent release, but does not indicate that it is development patches on top of the last release.

This PR aims to improve some of that reporting.

All of this assumes the user has installed dronecan_gui_tool with one of the following methods:

pipx install .
python -m pip install .
uv pip install .
pipx install git+https://github.com/dronecan/gui_tool.git
python -m pip install git+https://github.com/dronecan/gui_tool.git
uv pip install git+https://github.com/dronecan/gui_tool.git

After which, one of the following outcomes occur...

# Release Version installed, check the version...

$> dronecan_gui_tool --version
DroneCAN GUI Tool is an application for DroneCAN bus management and diagnostics
DroneCAN GUI Tool Version: 4.3.2

# Clean Working Tree Version Installed, but not a tagged commit...
$> dronecan_gui_tool --version
DroneCAN GUI Tool is an application for DroneCAN bus management and diagnostics
DroneCAN GUI Tool Version: 1.2.28
Development Build: post43.g9f9737e40

# Dirty Working Tree Version installed, not tagged commit
$> dronecan_gui_tool --version
DroneCAN GUI Tool is an application for DroneCAN bus management and diagnostics
DroneCAN GUI Tool Version: 1.2.28
Development Build: post44.g4fba222d7.d20260724
Warning: Built from a dirty working tree!

Similarly, the version can be seen in the application.

Release Build:
image

Clean Work Tree, Development Build
image

Dirty Work Tree, Development Build
Dirty Work Tree

When locally running the build, you will now get the following:

$> ./bin/dronecan_gui_tool --version
Running from the source directory
DroneCAN GUI Tool is an application for DroneCAN bus management and diagnostics
DroneCAN GUI Tool Version: 1.2.28
Development Build: source-post45.g69793c2
image

I'm in the process of updating README.md - If this is accepted, the new Release Workflow should be updated to something like:

  1. Create the Tag for the new version.
  2. Push tag to repo
  3. Build and release artifacts

@joshanne
joshanne requested a review from tridge July 24, 2026 07:45
@joshanne

Copy link
Copy Markdown
Collaborator Author

@tridge @Huibean do either of you have any objections to using this approach?

@joshanne
joshanne requested a review from Huibean July 24, 2026 07:46
@joshanne joshanne added the enhancement New feature or request label Jul 24, 2026
@Huibean

Huibean commented Jul 24, 2026

Copy link
Copy Markdown
Member

Hi @joshanne can you solve the version v0.0.0 issue when launching the tool directly from source? others looks OK to me

@joshanne
joshanne force-pushed the pr/python-build-managed-version-control branch from 4fba222 to db95d75 Compare July 25, 2026 00:54
joshanne added 2 commits July 25, 2026 11:03
Because the version is only incremented prior to a release, we have a number of commits between releases that all identify as the last release.

This means, all of our most recent changes that have improved gui_tool look like it's an old version, and managing users installs is hard. 'But it works on v1.2.28' - when it's actually a dev build the user is running...
@joshanne
joshanne force-pushed the pr/python-build-managed-version-control branch from 6c36e55 to 183123a Compare July 25, 2026 01:04
@joshanne
joshanne force-pushed the pr/python-build-managed-version-control branch 2 times, most recently from 4d5e709 to bbacee0 Compare July 25, 2026 05:07
@joshanne

joshanne commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator Author

@Huibean if possible, would you like to give it another look over? I've updated the above images to show the developer build working the same way.

it simplifies the release process atm, no manual editing of files... there is still one edge case, but its very unlikely to hit now. It allows developers to run the tool from their directory and get the current commit information at runtime.

If @tridge or the release maintainer is okay to slightly modify the release process, the release process then becomes...

  • Tag the commit
  • Build and Release the artifacts

In effect, the steps for loading the version here are then:

  • attempt to extract the information from git describe
    • if present, use the git describe generated version
    • if not present, attempt to use the generated version file from setuptools_scm
      • If present, parse the autogenerated version info
      • If not present, fall back to git_archival.txt file, assuming downloaded from zip file on github
        • if that file isn't present... THEN we default to v0.0.0.

Precedence for version information:
* git describe
* setuptools_scm generated file
* .git_archival.txt
* default value
@joshanne
joshanne force-pushed the pr/python-build-managed-version-control branch from bbacee0 to 69793c2 Compare July 25, 2026 06:04
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.

2 participants