Skip to content

Allow running from source (when not installed) by using version number from local metadata - #879

Merged
deltragon merged 4 commits into
slgobinath:masterfrom
archisman-panigrahi:run-from-source-fix
Apr 20, 2026
Merged

deltragon merged 4 commits into
slgobinath:masterfrom
archisman-panigrahi:run-from-source-fix

Conversation

@archisman-panigrahi

Copy link
Copy Markdown
Collaborator

Fixes #876


When not installed, safeeyes was failing to load as it could not find the version number. But now it loads the version number from python metadata.

<property name="valign">center</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="label">Safe Eyes 3.4.0</property>

@archisman-panigrahi archisman-panigrahi Apr 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed because this is already injected with this code https://github.com/slgobinath/safeeyes/blob/master/safeeyes/ui/about_dialog.py#L60

@archisman-panigrahi archisman-panigrahi changed the title Show version from metadata when running from source Allow running from source (when not installed) by using version number from local metadata Apr 18, 2026

@deltragon deltragon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The about dialog change seems good to me.
The part about parsing the version from pyproject.toml can also be merged as-is. I'd prefer a proper parser, I think, but since we need this as a fallback anyways that can also be added later.

Comment thread safeeyes/safeeyes.py Resolved
Suppose it is already installed and we run a different version from source. Then it will show the version number for the source, not the version number of (older) installed version
@archisman-panigrahi

Copy link
Copy Markdown
Collaborator Author

Ready from my side.

In case you think it is ready, and want to merge, please squash and merge so that it creates only one commit.

Comment thread safeeyes/safeeyes.py
Comment on lines +48 to +51
pyproject_path = Path(__file__).resolve().parent.parent / "pyproject.toml"

# Running from a source checkout: use the local project metadata.
if pyproject_path.is_file():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, if some installation method somehow kept the pyproject.toml file, this would be incorrect... But that isn't the case currently (neither for pip/PyPA, deb or flatpak), and seems unlikely to be the case in the future, so I'm fine with it.

@deltragon
deltragon merged commit 724ae11 into slgobinath:master Apr 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot run safeeyes from source unless already installed on system

2 participants