cgarciae / treex

A Pytree Module system for Deep Learning in JAX
https://cgarciae.github.io/treex/
MIT License
215 stars 17 forks source link

Latest treex is incompatible with the latest treeo #68

Closed samuela closed 2 years ago

samuela commented 2 years ago

At the time of writing the latest treex version is 0.6.10 and it depends on treeo which is at version 0.0.11. However, it is not possible to install treex with the latest treeo version due to the version constraint here: https://github.com/cgarciae/treex/blob/b89c65ccad06beea2492d3a6594cd83432c6ec3b/pyproject.toml#L23

Doing so produces an error:

ERROR: Could not find a version that satisfies the requirement treeo<0.0.11,>=0.0.10 (from treex) (from versions: none)
ERROR: No matching distribution found for treeo<0.0.11,>=0.0.10
samuela commented 2 years ago

It appears that this version constraint is worthwhile however since if I override it I get a slew of test failures: https://gist.github.com/samuela/2cbb09f8f635bde4dab63cfc6ee105ed. They all look something like

    def apply(self: A, f: tp.Callable[..., None], *rest: A, inplace: bool = False) -> A:
        """
        `apply` is a wrapper over `treeo.apply` that passes `self` as the second argument.

        Arguments:
            f: The function to apply.
            *rest: additional pytrees.
            inplace: If `True`, the input `obj` is mutated.

        Returns:
            A new pytree with the updated Trees or the same input `obj` if `inplace` is `True`.
        """
>       return api.apply(f, self, *rest, inplace=inplace)
E       AttributeError: module 'treeo.api' has no attribute 'apply'
cgarciae commented 2 years ago

Hey @samuela!

Ah this should have been a version bump on treeo then, I wonder if I should do the version bump to 0.1.0 and remove 0.0.11 from pypi and github?

cgarciae commented 2 years ago

I think Treex is not at fault here.

samuela commented 2 years ago

Hey @samuela!

Ah this should have been a version bump on treeo then, I wonder if I should do the version bump to 0.1.0 and remove 0.0.11 from pypi and github?

Up to you! Just wanted to let you know of the situation, since I figured that you probably intended for the latest versions of treeo/treex to be compatible.

cgarciae commented 2 years ago

@samuela thanks a lot for reporting this! For some reason I initially thought it was a breaking change on the API but it was just bug. Fix found here: cgarciae/treeo#14

samuela commented 2 years ago

Awesome, thanks @cgarciae! https://github.com/cgarciae/treeo/pull/14 indeed does the trick for me. The version constraints in https://github.com/cgarciae/treex/blob/b89c65ccad06beea2492d3a6594cd83432c6ec3b/pyproject.toml#L23 still cap the treeo version allowed, but that's easy enough to patch around. Thanks!

cgarciae commented 2 years ago

@samuela I initially thought ^0.0.10 was equivalent to >=0.0.10,<0.1.0 but it seems to actually be >=0.0.10,<0.0.11 which is rather restrictive. I don't think its a problem right now, latest updates are not relevant to the current version of Treex, however Treeo's version will be bumped to the newest in #70 (might take a while).

samuela commented 2 years ago

Yeah I've fallen for this exact same thing! It's super confusing... It's not as issue for me here. Everything seems to be working as is now