Closed DaddyWesker closed 7 months ago
I am sorry I didn't mentioned another important use-case when package is installed using PyPi repo or from distribution package file. In this case user doesn't even have git
installed and code in PR doesn't work in this case. Something similar in fact should happen when using cibuildwheel because it copies source code (excluding git root) and releases package from the copy.
Calling git
each time when package is loaded has two other issues:
PYTHONPATH
modification but: (a) we can call git as a last resort measure when version is not found (localbuild branch in current code) (b) it may not that important as it is a rare case.Importing __version__
from hyperon
in pyproject.toml
also has problems. Importing hyperon
on a build stage may require dependency libraries which can be unavailable at the moment of the package building (see item 6 at the link https://packaging.python.org/en/latest/guides/single-sourcing-package-version/#single-sourcing-the-version). It is more theoretical issue for our project though.
I would propose closing this PR or converting it into a "Draft PR" before new change is ready for review.
I've converted PR to draft.
Currently I'm testing latest changes. So probably something can be changed still.
@vsbogd everything should be fine now. Please check if you agree with those changes.
Check issue https://github.com/trueagi-io/hyperon-experimental/issues/662
Code should be simple, but I wasn't been able to test it properly. In my environment this variant works:
user installs Python package pip install -e hyperon[dev] and gets the version
Also in a new environment I was able to make this variant work:
user clones repo, builds code and adds ./python dir into PYTHONPATH, after that gets version using import hyperon; print(hyperon.__version__)
Variant with cibuildwheel worked for me only once and then I wasn't been able to reproduce it. Maybe it is lack of experience of using this cibuildwheel. Anyway, if someone could check cibuildwheel path and get version of hyperon properly - it will be really great.