Skip to content

Conversation

mkitti
Copy link
Contributor

@mkitti mkitti commented Sep 11, 2025

  • Make packages installable from conda. pypi packages are reduced from 95 to 1 (fileglancer itself)
  • Add fileglancer as an editable pypi install so that it is rebuilt on pixi reinstall
  • Replace task pip-install (pip install -e .) with pixi reinstall
  • Replace task pip-uninstall with pixi clean
  • Add PEP 735 dependency group for release

Current main branch


$ pixi clean
  removed /home/mkitti/src/fileglancer/.pixi/envs                                                                                                                                       

$ pixi install
✔ The default environment has been installed.

$ pixi list | grep pypi | wc -l
95
                                                                                                                                 

This pull request

$ git checkout mkitti-pixi-condify 
Switched to branch 'mkitti-pixi-condify'
Your branch is up to date with 'origin/mkitti-pixi-condify'.

$ pixi clean
  removed /home/mkitti/src/fileglancer/.pixi/envs     

$ pixi install
✔ The default environment has been installed.

$ pixi list | grep pypi | wc -l
1

$ pixi list | grep pypi
fileglancer                    0.6.1                                          pypi    (editable)

Another benefit is that a large part of dev-install, particularly pip install -e . can be replaced by pixi reinstall. If a source file is changed, pixi reinstall will rebuild the package. If nothing is changed, pixi reinstall will use its build cache.

image

Therefore, the pip commands have been replaced with pixi reinstall and pixi clean.

Previously, I thought of removing or replacing the task ext-clean, but I have left it in place. It may be less necessary now though due to pixi reinstall's behavior.

@krokicki
Copy link
Member

@mkitti, I followed your instructions above and it worked as you showed, but afterwards when I tried either pixi run dev-watch or pixi run dev-launch-remote, I got this error:

Traceback (most recent call last):
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/bin/jupyter-labextension", line 6, in <module>
    from jupyterlab.labextensions import main
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyterlab/__init__.py", line 8, in <module>
    from .handlers.announcements import (
    ...<3 lines>...
    )
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyterlab/handlers/announcements.py", line 16, in <module>
    from jupyterlab_server.translation_utils import translator
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyterlab_server/__init__.py", line 6, in <module>
    from .app import LabServerApp
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyterlab_server/app.py", line 10, in <module>
    from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_server/extension/application.py", line 17, in <module>
    from jupyter_server.serverapp import ServerApp
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_server/serverapp.py", line 34, in <module>
    import jupyter_client
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_client/asynchronous/client.py", line 8, in <module>
    import zmq.asyncio
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/zmq/__init__.py", line 52, in <module>
    from zmq import backend
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/zmq/backend/__init__.py", line 30, in <module>
    raise original_error from None
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/zmq/backend/__init__.py", line 25, in <module>
    _ns = select_backend(first)
  File "/groups/scicompsoft/home/rokickik/dev/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/zmq/backend/select.py", line 40, in select_backend
    ns.update({key: getattr(mod, key) for key in public_api})
                    ~~~~~~~^^^^^^^^^^
AttributeError: module 'zmq.backend.cython' has no attribute 'PYZMQ_DRAFT_API'

@mkitti
Copy link
Contributor Author

mkitti commented Sep 14, 2025

You might need a pixi clean if you are transitioning from an install where you used pip. pixi is unaware of libraries installed by pip.

@allison-truhlar
Copy link
Collaborator

@krokicki Running these two commands worked for me to then be able to use pixi run dev-watch:

pixi clean
pixi run dev-install

@mkitti
Copy link
Contributor Author

mkitti commented Sep 15, 2025

To reproduce Konrad's issue:

./clean.sh
git checkout main
pixi run dev-install
git checkout mkitti-pixi-condify
pixi reinstall
pixi run dev-launch
AttributeError: module 'zmq.backend.cython' has no attribute 'PYZMQ_DRAFT_API' ``` (fileglancer) (base) kittisopikulm@kittisopikulm-wm1 fileglancer % pixi run dev-launch ✨ Pixi task (dev-launch in default): NODE_ENV=development jupyter lab --autoreload Traceback (most recent call last): File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/bin/jupyter-lab", line 6, in from jupyterlab.labapp import main File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyterlab/__init__.py", line 8, in from .handlers.announcements import ( ...<3 lines>... ) File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyterlab/handlers/announcements.py", line 16, in from jupyterlab_server.translation_utils import translator File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyterlab_server/__init__.py", line 6, in from .app import LabServerApp File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyterlab_server/app.py", line 10, in from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_server/extension/application.py", line 17, in from jupyter_server.serverapp import ServerApp File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_server/serverapp.py", line 34, in import jupyter_client File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_client/__init__.py", line 3, in from .asynchronous import AsyncKernelClient File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in from .client import AsyncKernelClient # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/jupyter_client/asynchronous/client.py", line 8, in import zmq.asyncio File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/zmq/__init__.py", line 52, in from zmq import backend File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/zmq/backend/__init__.py", line 30, in raise original_error from None File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/zmq/backend/__init__.py", line 25, in _ns = select_backend(first) File "/Users/kittisopikulm/Documents/src/fileglancer/.pixi/envs/default/lib/python3.13/site-packages/zmq/backend/select.py", line 40, in select_backend ns.update({key: getattr(mod, key) for key in public_api}) ~~~~~~~^^^^^^^^^^ AttributeError: module 'zmq.backend.cython' has no attribute 'PYZMQ_DRAFT_API' ```

Running pixi clean or ./clean.sh seems to resolve the issue.

@mkitti mkitti force-pushed the mkitti-pixi-condify branch from 0f8888a to 716b02a Compare September 16, 2025 14:12
@mkitti
Copy link
Contributor Author

mkitti commented Sep 16, 2025

Konrad needed to run ./clean.sh before resolving his issue of AttributeError: module 'zmq.backend.cython' has no attribute 'PYZMQ_DRAFT_API'

@krokicki
Copy link
Member

Thanks, it worked after I ran ./clean.sh.

I noticed that the new build is 50% slower for some reason. I tried each build twice, with a ./clean in between:

New:

real    3m7.535s
user    0m44.079s
sys     0m18.886s

Old:

real    2m13.242s
user    0m43.321s
sys     0m11.631s

New:

real	3m1.164s
user	0m44.733s
sys	0m18.280s

Old:

real	2m14.044s
user	0m43.231s
sys	0m11.170s

@mkitti
Copy link
Contributor Author

mkitti commented Sep 16, 2025

What are you timing specifically?

I suspect that at the end of the day we may need less cleaning and that pixi reinstall may be sufficient in many cases.

@krokicki
Copy link
Member

I'm timing the initial pixi run dev-install after a ./clean.sh.

@mkitti
Copy link
Contributor Author

mkitti commented Sep 27, 2025

I merged #182 into here for now because I could not push otherwise.

@mkitti
Copy link
Contributor Author

mkitti commented Sep 27, 2025

I changed pixi reinstall to pixi reinstall fileglancer for the pip-install task.

  • Instead of reinstalling all of the packages it will only reinstall fileglancer which is more analogous to what pip-install previously did with pip install -e ..
  • Earlier in this PR, running pixi run dev-install after ./clean.sh would install all the packages twice including fileglancer.
  • On the main branch, pixi install followed by pip install -e . would install the dependencies twice but only install fileglancer once.

Also, I should note that dev-install is unnecessary after a ./clean.sh. That is you can run the following directly.

./clean.sh
pixi run dev-launch

This is because pixi install will install fileglancer itself as well as enable the extension.

time ./clean.sh && time pixi run jupyter labextension list
Cleaned up dev environment.

real	0m0.230s
user	0m0.001s
sys	0m0.007s
JupyterLab v4.4.7
/groups/scicompsoft/home/kittisopikulm/src/fileglancer/.pixi/envs/default/share/jupyter/labextensions
        fileglancer v0.8.0 enabled OK (python, fileglancer)
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)


real	1m37.220s
user	0m5.633s
sys	0m6.429s

Note that this is faster than @krokicki 's timings above.

The one thing you might need pixi run dev-install to do after a clean is pixi run node-install to run npm install. This is necessary for pixi run dev-watch to install run-p.

@mkitti
Copy link
Contributor Author

mkitti commented Sep 27, 2025

On my Mac Studio the time is less than 20 seconds from clean to launch due to caching:

clean_to_launch.mov

@mkitti
Copy link
Contributor Author

mkitti commented Sep 27, 2025

With an edit, it is just a few more seconds:

edit_reinstall.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants