sphinx-doc / sphinx-doc/sphinx
Displays wrong Git hash with development versions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
The code to run git-show during initialisation of the package uses the current working directory:
https://github.com/sphinx-doc/sphinx/blob/90804238b07194df497af81fc8722b09bea2be65/sphinx/__init__.py#L47-L59
I.e. it uses the hash from the project itself etc.
With editable installed, it could use cwd=package_path, but that does not work when it gets installed non-editable.
It's also questionable to run git during init all the time.
Therefore it might make sense to write the version into some file (which then gets done during installation once).
Also something like https://github.com/zsimic/setupmeta could be considered, but might not be wanted / really needed.
The best for now might be to run it with changed cwd with editable installs, but write it to a file otherwise. This way you get the current version always as a developer.
Not really sure currently though how trivial it is to detect an installable installation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with sphinx/init.py at the linked git-show logic and trace how the package is installed in editable and non-editable forms. Check how the version or Git hash is determined during initialization and compare the behavior in both installation modes. Done means development versions report the correct project hash without relying on an unrelated current working directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100