xpodev / seamless

A Python package for creating and manipulating HTML components. It is working similar to React.js, but in Python.
https://seamless.readthedocs.io
MIT License
11 stars 1 forks source link

`pip install -e .` fails ` AttributeError: seamless has no attribute __version__` #60

Closed elazarcoh closed 1 month ago

elazarcoh commented 1 month ago

when doing pip install -e ., it tries to resolve the version from seamless.__version__. I'm seeing that you have the SEAMLESS_VERSION_ONLY env var to mitigate the issue in the docs. Is there a problem with just using seamless.version.version? it seems to me to be a more natural way of solving it.

Alternatively, you can use a build-system, such that poetry (requires plugin), hatch or pdm which can handle these things for you in a more precise manner (either statically or from vsc tags etc.).

neriyaco commented 1 month ago

The problem is, when you import a module it imports __init__.py as well.

I'm working on organizing the code so there will be no side effects when importing the module. It should be fixed in the next patch.

elazarcoh commented 1 month ago

Yeah I know that, I just don't think the import is even needed when installing (or building a wheel, or building the docs for that matter).

It's not only an issue of side-effects, but also dependencies. You can leave the build environment clean of any dependency, even for required dependencies. To make it happen you just need to not import the __init__.py when resolving the version. This is also true for the docs environment, btw.

What benefit you are trying to achieve from getting the version from seamless.__version__ instead of just seamless.version.version? I guess it "nicer", but does it worth the trouble? Even if you solve the side-effect thing, you still be left with the imports of required 3rdparty, which aren't needed for building wheels or docs.

neriyaco commented 1 month ago

I will look into it, I think I tried to import it directly from seamless.version but the __init__.py file is still being imported.

elazarcoh commented 1 month ago

I've tried it, it worked for me :)

elazarcoh commented 1 month ago

Let me know if I can help

neriyaco commented 1 month ago

This is added in 25759aeefd3f8813120b29d0edb969d9ba00eb58