Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Either compile all pyc files or automatically remove them #431

Open
wolfv opened this issue Dec 6, 2023 · 2 comments
Open

Either compile all pyc files or automatically remove them #431

wolfv opened this issue Dec 6, 2023 · 2 comments
Labels
needs-decision Undecided if this should be done

Comments

@wolfv
Copy link
Contributor

wolfv commented Dec 6, 2023

I have a situation with pixi where the missing pyc compilation is a problem and finally debugged it.

When updating the lockfile for jupyterlab (with pixi) it installs isoduration. When reinstalling the old lockfile later it removes isoduration but leaves the pyc files as well as the folder structure (since the pyc files are not deleted).

Now, when starting jupyterlab the import isoduration still "works" (doesn't throw an ImportError) but when accessing any object in it it fails with an AttributeError, e.g.:

╭─ pixi ~/Programs/pixi/examples/jupyterlab ‹fix/print_run_arguments●›  
╰─$ cargo r -- run start --help                                                                                                                                                                                                                                                                2 ↵
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s
     Running `/Users/wolfv/Programs/pixi/target/debug/pixi run start --help`
✨ Pixi task: jupyter lab --help
Traceback (most recent call last):
  File "/Users/wolfv/Programs/pixi/examples/jupyterlab/.pixi/env/bin/jupyter-lab", line 6, in <module>
    from jupyterlab.labapp import main
  File "/Users/wolfv/Programs/pixi/examples/jupyterlab/.pixi/env/lib/python3.11/site-packages/jupyterlab/__init__.py", line 8, in <module>
    from .handlers.announcements import (
  File "/Users/wolfv/Programs/pixi/examples/jupyterlab/.pixi/env/lib/python3.11/site-packages/jupyterlab/handlers/announcements.py", line 14, in <module>
    from jupyter_server.base.handlers import APIHandler
  File "/Users/wolfv/Programs/pixi/examples/jupyterlab/.pixi/env/lib/python3.11/site-packages/jupyter_server/base/handlers.py", line 23, in <module>
    from jupyter_events import EventLogger
  File "/Users/wolfv/Programs/pixi/examples/jupyterlab/.pixi/env/lib/python3.11/site-packages/jupyter_events/__init__.py", line 3, in <module>
    from .logger import EVENTS_METADATA_VERSION, EventLogger
  File "/Users/wolfv/Programs/pixi/examples/jupyterlab/.pixi/env/lib/python3.11/site-packages/jupyter_events/logger.py", line 13, in <module>
    from jsonschema import ValidationError
  File "/Users/wolfv/Programs/pixi/examples/jupyterlab/.pixi/env/lib/python3.11/site-packages/jsonschema/__init__.py", line 13, in <module>
    from jsonschema._format import FormatChecker
  File "/Users/wolfv/Programs/pixi/examples/jupyterlab/.pixi/env/lib/python3.11/site-packages/jsonschema/_format.py", line 503, in <module>
    raises=isoduration.DurationParsingException,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'isoduration' has no attribute 'DurationParsingException'

Then I usually do a rm -rf of the .pixi folder but it would be much nicer if we never run into this error.

@baszalmstra
Copy link
Collaborator

With #437 we at least remove them.

@baszalmstra baszalmstra added the needs-decision Undecided if this should be done label Feb 29, 2024
@wolfv
Copy link
Contributor Author

wolfv commented Feb 29, 2024

I do think that it would be better to compile the pyc when installing because I do notice relatively slow startup times on macOS and I think in part it's because it still needs to compile the pyc files.

It is also nice to track the pyc files in the conda-meta folder.

Lastly, we do have the code to do this in rip so I think it should be relatively straightforward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Undecided if this should be done
Projects
None yet
Development

No branches or pull requests

2 participants