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

Big Rewrite to simplify and rely less on julia internals #61

Merged
merged 51 commits into from
Jun 29, 2024

Conversation

disberd
Copy link
Owner

@disberd disberd commented Jun 14, 2024

This is a complete rewrite of the internals of the package in an effort to make it easier to extend (e.g. add back support for the simple @plutoinclude and a future @fromenv to allow importing directly from an environment.

In this big rewrite, I am dropping the support for the @skiplines functionality which was cool but not really useful, and it would not really be compatible with the Revise integration that is planned next.

The code went from directly parsing and executing all package code with custom eval calls, to use a combination of a mapexpr functions (similar to include) and cycling through parsed code with ExprSplitter from JuliaInterpreter.

This already more similar to how Revise works and is used to get more accustomed to its internals.

A new type was also added to store all the relevant data for a given loaded package as opposed to a generic Dict that we used to have.
This new type is called FromPackageController.

I dropped all dependencies from most of the Pkg internals (with EnvCache, Context, Project and Manifest) and now only directly add the target Project to the LOAD_PATH.

I also load directly the relevant data from the Project and Manifest by parsing the toml file directly instead of relying on Pkg internals.

For the moment I also removed registering the package as root_module as this also heavily realies on some julia internals which are already changed in 1.11 or current master (1.12). Registering as a root module might still be useful for accessing package specific data like providing functionality via Base.pkgdir. I will re-add this as opt-in via a setting probably.

For the moment I still depend on accessing Base.loaded_modules to extract loaded modules for loading packages from indirect dependencies.

The tests have also been moved to use TestItemRunner.jl rather than SafeTestsets.jl for better integration in VSCode

Still todo items are:

  • Improve tests
  • Create the javascript code to beautify the name of the loaded package
  • Support import X as Y statements
  • Support import X: Y as Z statements

Copy link

codecov bot commented Jun 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d4f1d96) to head (7dc850d).

Additional details and impacted files
@@            Coverage Diff             @@
##            master       #61    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           12        11     -1     
  Lines          841       653   -188     
==========================================
- Hits           841       653   -188     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@disberd disberd merged commit 21108dc into master Jun 29, 2024
12 checks passed
@disberd disberd deleted the internal_rewrite branch June 29, 2024 16:59
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.

1 participant