TREX-CoE / trexio_tools

Set of tools for trexio files
BSD 3-Clause "New" or "Revised" License
18 stars 8 forks source link

Import reorganisation requires upgrade of the major version #17

Closed q-posev closed 1 year ago

q-posev commented 1 year ago

Recent changes in the structure of the source code directories break old imports, e.g. if the user application installs trexio-tools package and calls some functions (e.g. run-molden) directly without passing by the main function. It's hard for me to say if we actually have users that use the tools like this. The CLI is not affected.

scemama commented 1 year ago

The problem was that converters for example was a visible python module and could conflict with other namespaces of other packages. It is better to have it exposed as trexio_tools.converters.

q-posev commented 1 year ago

When installing with pip install ., the converters are not visible for me (Py 3.10):

>>> from trexio_tools import converters
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'converters' from 'trexio_tools' (/home/q-posev/trexio_tools/src/trexio_tools/__init__.py)
>>> from trexio_tools.converters import convert_from
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'trexio_tools.converters'

I agree though that having Python packages under src is not Python-ic anymore. Modern packages have module_name folder in the root containing all Python sub-packages and modules for a given module_name Python software.

scemama commented 1 year ago

I was pythonic with python 2, but I never really made the transition... If you know how to organize the modules  correctly,  please do it because I don't know the modern way to do it. :-)

17 avr. 2023 11:03:06 Evgeny Posenitskiy @.***>:

When installing with pip install ., the converters are not visible for me (Py 3.10):

from trexio_tools import converters Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'converters' from 'trexio_tools' (/home/q-posev/trexio_tools/src/trexio_tools/init.py) from trexio_tools.converters import convert_from Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'trexio_tools.converters'

I agree though that having Python packages under src is not Python-ic anymore. Modern packages have module_name folder in the root containing all Python sub-packages and modules for a given module_name Python software.

— Reply to this email directly, view it on GitHub[https://github.com/TREX-CoE/trexio_tools/issues/17#issuecomment-1510968462], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ABNRVYV6TI3UNYSSK2HMLTDXBUBL5ANCNFSM6AAAAAAXAFMOMY]. You are receiving this because you commented.[Image de pistage][https://github.com/notifications/beacon/ABNRVYQPK56C2IARD52XXKTXBUBL5A5CNFSM6AAAAAAXAFMOM2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS2B6GI4.gif]

q-posev commented 1 year ago

I can do this when the PySCF converter is merged. However, there are some Git conflicts after recent reorganizations and I do not have time right now to fix them.