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

Add back settings/options #62

Merged
merged 11 commits into from
Jun 30, 2024
Merged

Add back settings/options #62

merged 11 commits into from
Jun 30, 2024

Conversation

disberd
Copy link
Owner

@disberd disberd commented Jun 29, 2024

This PR adds back the possibility of customizing the behavior of @frompackage/@fromparent using settings/options

The supported options are now defined inside the FromPackageOptions type and are:

  • rootmodule::Bool: Specifies whether the target module shall be registered as root module at the beginning of the loading procedure. This is relying on Base internals but can be useful in some cases, for example when the package internals rely on Base.pkgdir or similar which depend on the module being registered as root module.
    • This defaults to false and shall be enabled only when necessary.
  • manifest::Symbol: This controls whether the macro will try to instantiate or resolve the target environment before loading the package. The supported options are:
    • :instantiate: which will call Pkg.instantiate on the target environment
    • :resolve: which will call Pkg.resolve on the target environment
    • any other symbol: which will simply throw an error if the provided environment is not instantiated, as it used to do before.
      • This is the default behavior
  • verbose::Bool: This option will just send some logs for debugging while loading the contents of the package.

These options must be passed to the end of the @fromparent or @frompackage macro call as a seris of option = value as in the following image from the test/TestInception/inception_notebook.jl notebook:
image

Copy link

codecov bot commented Jun 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (21108dc) to head (c19873c).

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #62   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11        12    +1     
  Lines          653       727   +74     
=========================================
+ Hits           653       727   +74     

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

@disberd disberd merged commit 00a6138 into master Jun 30, 2024
12 checks passed
@disberd disberd deleted the rootmodule branch June 30, 2024 17:29
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