introduce an entry points interface for loading modules #140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
to me, this is a significant change to
importnb
because it feels like the new api surface for importing alternative documents. the new interface looks like:the context manager resolves the
[project.entry-points.importnb]
definitions and appends the loader associated with them to thesys.path_hooks
. within the context, any of the aliased loaders are free game for python to import.this approach allows other packages to make their loaders available to a single API.
midgy
, a package for using markdown files as python scripts, defines themd
entry point. so withmidgy
installed:entry_points
sourceimports
code is not special
we're in the midst of adopting computational literacy as mass literacy. code is everywhere and people are eager to learn it. they are finding coding embedded in common file formats like markdown, docx, pptx, pdf, zip, ... it is in every nook and cranny of daily life. being restrictive about what is code will exhaust the enforcer.
importnb
started as a way to avoid copy/pasting code from jupyter notebooks to python to test it efficacy;the redundancy in work seemed counterintuitive. as a tool,
importnb
allow us to hide a lot of complex logic that might hinder the literary quality of a notebook. it allowed us to use notebooks to talk about notebooks, and, as always, we had fun doing it.ultimately,
importnb
became a powerful tool for tuning the literary qualities of notebooks for docs, demos, and blogs.it allowed us to tell more complex stories by encapsulating logic in different notebook documents.
ultimately,
importnb
and these inclusive importing features exist for the sake of the story; they exist as literary devices.the concept of importing non-python documents seems consistent with the message in computer programming for everybody. i feel like part of that mission requires a more inclusive perspective on what is code. one way to express this belief is to permit imports of othered code.
problems
md
orcsv
orparquet
loaders