lcmd-epfl / Q-stack

Stack of codes for dedicated pre- and post-processing tasks for Quantum Machine Learning (QML)
MIT License
13 stars 5 forks source link

more things to do with packaging #64

Closed liam-o-marsh closed 2 weeks ago

liam-o-marsh commented 3 weeks ago
briling commented 2 weeks ago

is there a way to auto sync requirements.txt, environment.yml, and pyproject.toml?

liam-o-marsh commented 2 weeks ago

not to my knowledge? environment.yml and requirements.txt should be somewhat feasible because the idea is fundamentally the same, but syncing this with pyproject.toml sounds more difficult. At the very least, there should be a way to check that the package list is the same across all three, and that the bounds of the dependencies listed in pyproject.toml are compatible with the rest.

briling commented 2 weeks ago

is it possible to import qstack_qml in the main __init__.py to use it as qstack.qml if it's installed?

briling commented 2 weeks ago

I also can't use qstack_qml if it isn't installed but is just in the path (which is probably how one should not use it but...)

liam-o-marsh commented 2 weeks ago

yeah I can fix both of those

briling commented 2 weeks ago

Thanks! I'm probably dumb but can't make it work (I can import qstack.qml but nothing further)

liam-o-marsh commented 2 weeks ago

I admittedly didn't test it. I can't even import qstack.qml, only from qstack import qml or import qstack; print(qstack.qml) (fixing this on my side for now) I have no idea how to use b2r2 (read: I didn't want to spend the time learning how to make ase.rxn objects quite yet), but I managed to run qstack.qml.slatm.get_slatm_for_dataset()

briling commented 2 weeks ago

thanks a lot! one still can't do from qstack_qml.slatm import get_slatm_rxn etc but I guess it's fine

liam-o-marsh commented 2 weeks ago

yeah, for this you need to have pip actually install qstack_qml (as one of qstack[all]'s dependencies) the reason why qstack.qml works even when you didn't is because qstack/qml.py has a trick to modify PYTHONPATH, import, restore PYTHONPATH.

briling commented 2 weeks ago

oh sorry I can't spell. what I meant is this:

>>> import qstack
>>> qstack.__path__
['/home/xe/SOFT/miniconda3/envs/qstack-yuri/lib/python3.10/site-packages/qstack']
>>> from qstack_qml.slatm import get_slatm_rxn
>>> from qstack.qml.slatm import get_slatm_rxn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'qstack.qml.slatm'; 'qstack.qml' is not a package
>>> 
briling commented 2 weeks ago

While the following works and is pretty convenient so all good

>>> from qstack.qml import slatm 
>>> slatm.get_slatm_rxn
<function get_slatm_rxn at 0x7f2fefd591b0>
>>> 
liam-o-marsh commented 2 weeks ago

(also unrelated but I finished the local kernel wrapper thing. Do you want me to put it on another branch?)

briling commented 2 weeks ago

Do you want me to put it on another branch?

Thanks! yes please

Do you think we can merge (squash and merge?) this one?

liam-o-marsh commented 2 weeks ago

Yes, I think so. (unless you absolutely want some sort of mechanism to ensure some coherence between environment.yml, requirements.txt and pyproject.toml, but I would have to find or implement this first)

briling commented 2 weeks ago

It's fine! It's not something that changes every day and we can do it manually

Do we need to look at/enable these alerts? https://github.com/lcmd-epfl/Q-stack/network/dependencies

liam-o-marsh commented 2 weeks ago

don't think so, unless there's like a security issue somehow