Skip to content

Stop tracking generated _version.py - #3483

Merged
vineetbansal merged 1 commit into
IMAP-Science-Operations-Center:devfrom
vineetbansal:vb/issue3476
Sep 22, 2026
Merged

vineetbansal merged 1 commit into
IMAP-Science-Operations-Center:devfrom
vineetbansal:vb/issue3476

Conversation

@vineetbansal

@vineetbansal vineetbansal commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Closes #3476.

Some background on this is that backends that support auto-versioning (by looking at the state of the working tree against the current git branch+tag+commit), auto-generate a _version.py (or a similarly named file) when doing a poetry install or uv install etc, and don't need a _version.py file in the git repo (a file they're going to overwrite anyway).

Having this file in the git index causes developers to keep accidentally committing/pushing it. Its entry was added in .gitignore, but perhaps too late (after it had already been committed to the git index).

If some code relies on this file being present, it should guard against its absence with an ImportError. There are other ways to do this "default" version instead of hardcoding it, but it gets very specific to the backend, for example, this page says:

- persistent-substitution (boolean, optional): If true, then do not revert any substitutions applied to this file. This is primarily useful for editable installs, if you need the version to remain in a file ignored by your VCS.
- initial-content (string, optional): Set the file content before the substitution phase. The file will be created or overwritten as necessary. Common leading whitespace will be stripped from each line.

IMO it's easier to do the right thing and just have a default version specified on an ImportError, which is more explicit, as we're doing here.

Remove _version.py from the index, fall back to
0.0.0 in imap_processing/__init__.py when it is missing.

@leowerneck leowerneck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@lacoak21 lacoak21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM too!

@vineetbansal
vineetbansal merged commit d0a7fce into IMAP-Science-Operations-Center:dev Sep 22, 2026
22 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.

Remove _version.py from git history

3 participants