-
Notifications
You must be signed in to change notification settings - Fork 40
Support passing of index URLs to piplite (CLI, runtime configuration, and requirements files) #169
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
Draft
agriyakhetarpal
wants to merge
30
commits into
jupyterlite:main
Choose a base branch
from
agriyakhetarpal:feat/index-url-for-pip-install-magics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 15 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
939dc42
Add an `--index-url` flag for the `piplite` CLI
agriyakhetarpal bed093c
Add `pipliteInstallDefaultOptions` to schema, types
agriyakhetarpal 5d45a40
Fix a typo
agriyakhetarpal 83757c0
Add effective index URLs to pass to piplite
agriyakhetarpal a9b539d
Add `--index-url`, `-i`, to CLI flags
agriyakhetarpal 95b4700
Handle index URLs with requirements files
agriyakhetarpal 32e0f51
Fix JS prettier lint errors
agriyakhetarpal 8014816
Now fix Python linter errors
agriyakhetarpal 48d1970
Fix typo
agriyakhetarpal 7207454
Log what index URL is being used if verbose
agriyakhetarpal ffe3907
Fix, allow adding index URL inside a requirements file
agriyakhetarpal 1c8e574
Mark CLI alias for index_urls in docstring
agriyakhetarpal e7d3818
Hopefully fix Python linter
agriyakhetarpal a5e9565
Handle tuple unpacking better
agriyakhetarpal c04d84f
Try to fix index URLs in requirements file
agriyakhetarpal 23852ca
Rename `indexUrls` to `index_urls`
agriyakhetarpal b3f7808
Single source of truth for installation defaults
agriyakhetarpal d0fd31a
Fix Python formatting
agriyakhetarpal a9a62b3
Revert "Fix Python formatting"
agriyakhetarpal 2d7aed6
Revert "Single source of truth for installation defaults"
agriyakhetarpal a1bcf66
Reapply "Single source of truth for installation defaults"
agriyakhetarpal a8cf844
Reapply "Fix Python formatting"
agriyakhetarpal d2192fe
Fix boolean capitalisation b/w JS/TS and Python
agriyakhetarpal 4a7116c
Add a TS fix
agriyakhetarpal 443c206
Fix index URLs and requirements files again
agriyakhetarpal e4e7a30
Some more fixes for install order precedence
agriyakhetarpal fec4e1b
More fixes
agriyakhetarpal 98576dc
Simplify handling yet again
agriyakhetarpal d694c00
Fix URL handling that can lead to silent failures
agriyakhetarpal 3fc2381
Temporarily remove NumPy, add SPNW index URL
agriyakhetarpal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,13 @@ export class PyodideRemoteKernel { | |
throw new Error('Uninitialized'); | ||
} | ||
|
||
const { pipliteWheelUrl, disablePyPIFallback, pipliteUrls, loadPyodideOptions } = | ||
this._options; | ||
const { | ||
pipliteWheelUrl, | ||
disablePyPIFallback, | ||
pipliteUrls, | ||
loadPyodideOptions, | ||
pipliteInstallDefaultOptions, | ||
} = this._options; | ||
|
||
const preloaded = (loadPyodideOptions || {}).packages || []; | ||
|
||
|
@@ -81,12 +86,20 @@ export class PyodideRemoteKernel { | |
`); | ||
} | ||
|
||
const pythonConfig = [ | ||
'import piplite.piplite', | ||
`piplite.piplite._PIPLITE_DISABLE_PYPI = ${disablePyPIFallback ? 'True' : 'False'}`, | ||
`piplite.piplite._PIPLITE_URLS = ${JSON.stringify(pipliteUrls)}`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would then become |
||
]; | ||
|
||
if (pipliteInstallDefaultOptions?.indexUrls) { | ||
pythonConfig.push( | ||
`piplite.piplite._PIPLITE_DEFAULT_INDEX_URLS = ${JSON.stringify(pipliteInstallDefaultOptions.indexUrls)}`, | ||
); | ||
} | ||
|
||
// get piplite early enough to impact pyodide-kernel dependencies | ||
await this._pyodide.runPythonAsync(` | ||
import piplite.piplite | ||
piplite.piplite._PIPLITE_DISABLE_PYPI = ${disablePyPIFallback ? 'True' : 'False'} | ||
piplite.piplite._PIPLITE_URLS = ${JSON.stringify(pipliteUrls)} | ||
`); | ||
await this._pyodide.runPythonAsync(pythonConfig.join('\n')); | ||
} | ||
|
||
protected async initKernel(options: IPyodideWorkerKernel.IOptions): Promise<void> { | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reckon this should be
index_urls
, and then wherever possible, the parent object handed around as a blob of JSON-compatible kwargs.