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

Update empack and docs #116

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: extension-artifacts

Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: extension-artifacts

Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: extension-artifacts

Expand All @@ -182,7 +182,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: extension-artifacts

Expand Down
11 changes: 4 additions & 7 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,21 @@ This section is mostly for reference and should not be needed for regular use of
### Provide a custom `empack_config.yaml`

Packages sometimes ship more data than needed for the package to work (tests, documentation, data files etc). This is fine on a regular installation of the package, but in the emscripten case when running in the browser this means that starting the kernel would download more files.
For this reason, `empack` filters out anything that is not required for the Python code to run. It does it by following a set of filtering rules available in this file: https://github.com/emscripten-forge/empack/blob/main/config/empack_config.yaml.

But this default filtering could break some packages. In that case you would probably want to either contribute to the default empack config, or provide your own set of filtering rules.
For this reason, `empack` allows filtering files that is are not required for the Python code to run. It does it by following a set of filtering rules available in this file: https://github.com/emscripten-forge/empack/blob/main/config/empack_config.yaml.

The xeus-python kernel supports passing a custom `empack_config.yaml`. This file can be used to override the default filter rules set by the underlying `empack` tool used for packing the environment.

If you would like to provide additional rules for including or excluding files in the packed environment, create a `empack_config.yaml` with the following content as an example:
If you would like to provide additional rules for excluding files in the packed environment, create a `empack_config.yaml` with the following content as an example:

```yaml
packages:
xarray:
include_patterns:
- pattern: '**/*.py'
exclude_patterns:
- pattern: '**/static/css/*.css'
- pattern: '**/static/html/*.html'
```

This example defines a set of custom rules for the `xarray` package to make sure it includes some static files that should be available from the kernel.
This example defines a set of custom rules for the `xarray` package to make sure it excludes some static files that are not required for the code to run.

You can use this file when building JupyterLite:

Expand Down
2 changes: 1 addition & 1 deletion docs/build-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
- myst-parser
- pydata-sphinx-theme
- jupyterlab >=4.0.5,<5
- jupyterlite-core >=0.2,<0.4
- jupyterlite-core >=0.2,<0.5
- jupyterlite-sphinx >=0.13.1
- empack >=3.1.0
- pip:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
dependencies = [
"empack>=3.1,<5",
"empack>=4.0.2,<5",
"traitlets",
"jupyterlite-core>=0.1,<0.5",
"pyyaml",
Expand Down
Loading