Closed vsbogd closed 7 months ago
Root cause is that dynamic version logic defined in pyproject.toml
: https://github.com/trueagi-io/hyperon-experimental/blob/07021cb73d1fbaba19a41c98599a981a644177ab/python/pyproject.toml#L22 uses tags to find out what was the latest release of the package. If in a fork repo no tags are present then current version is determined as 0.1
which causes incorrect behavior of the REPL.
We already have the fallback version in hyperon/__init__.py
:
https://github.com/trueagi-io/hyperon-experimental/blob/07021cb73d1fbaba19a41c98599a981a644177ab/python/hyperon/__init__.py#L15
Because some users doesn't use pip install
at all and we still need to return a proper version. See discussions in #434 and #440.
Thus I would suggest adding the single place where current "base" version of the Python package would be defined. And then derive any "specific" version using local git commit or anything else.
Three use-cases need to be supported:
./python
dir into PYTHONPATH
, after that gets version using import hyperon; print(hyperon.__version__)
pip install -e hyperon[dev]
and gets the versioncibuildwheel
, installs released package and gets the versionIn all three cases version should be based on a current package version (0.1.8
for instance). For debug purposes it would be nice to include the latest git commit
into a version (0.1.8+<git commit>
for instance).
Another important use-case:
Fixed by #667
Describe the bug
cargo run metta
fails to start claiming Python hyperon package version is incorrect when being started from a local repo created from a fork of the main repository.To Reproduce Steps to reproduce the behavior:
trueagi-io/hyperon-experimental
on GitHubgit clone <your-fork-uri>
cd <you-fork-local-dir>
git tag
should show empty list of tags (if the fork has no tags)python3 -m pip install ./python[dev]
python -c "import hyperon; print(hyperon.__version__)"
cargo run
Expected behavior
import hyperon; print(hyperon.__version__)
prints last version of the Python package for example0.1.8.dev50+g1d41ab11.d20240412
.cargo run
starts REPL.Actual behavior
import hyperon; print(hyperon.__version__)
prints v0.1 version like0.1.dev2411+g65e26e9
.cargo run
fails with a message "Fatal Error: MeTTa repl requires HyperonPy version matching '>=0.1.0, <0.2.0'. Found version: '0.1.dev2411+g65e26e9'"