-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
enable interactive exploration of examples using jupyterlite-sphinx
#10299
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
base: main
Are you sure you want to change the base?
Changes from all commits
c28aab1
774d613
a63ace9
bac77ee
4c0a096
438b597
3dc3abe
807fd69
31a6db6
28afda4
5d2ca4e
a4d1285
f798349
d963012
c5146e4
d5b8be4
f87e460
1be41f4
ff16169
69bee86
c9ed2b4
b9ccc3d
092d570
8e176dd
4063847
395ed4f
cc352d9
74f5759
115a95a
17b06a3
5468ea9
bcd69bb
ccf60cc
7a2ffc3
7654f0a
5c1e2a1
ea4a483
35895ca
e999e05
587cbda
5aa53ad
d5f75bd
9bb47c6
d8504a3
53f8eed
e5aa1cb
37788c4
327b99d
335e33b
c261bff
7bef894
9dae51d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| import pathlib | ||
| import textwrap | ||
|
|
||
| import vcs_versioning | ||
|
|
||
|
|
||
| def find_pyproject(dir): | ||
| while dir != dir.root: | ||
| path = dir / "pyproject.toml" | ||
| if path.is_file(): | ||
| return path | ||
|
|
||
| dir = dir.parent | ||
|
|
||
| raise RuntimeError("pyproject.toml can't be found") | ||
|
|
||
|
|
||
| def main(): | ||
| cwd = pathlib.Path(__file__).parent | ||
| pyproject_path = find_pyproject(cwd) | ||
| root = pyproject_path.parent | ||
|
|
||
| pyproject = vcs_versioning.PyProjectData.from_file(pyproject_path) | ||
| version = vcs_versioning.infer_version_string("xarray", pyproject) | ||
|
|
||
| recipe_root = root / "ci/recipe" | ||
|
|
||
| template_path = recipe_root / "recipe_template.yaml" | ||
| template = template_path.read_text() | ||
|
|
||
| context = textwrap.dedent( | ||
| f"""\ | ||
| context: | ||
| name: xarray | ||
| version: {version} | ||
| """.rstrip() | ||
| ) | ||
| recipe = "\n".join([context, "", template]) # noqa: FLY002 | ||
| recipe_path = recipe_root / "recipe.yaml" | ||
| recipe_path.write_text(recipe) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package: | ||
| name: ${{ name }} | ||
| version: ${{ version }} | ||
|
|
||
| source: | ||
| path: ../.. | ||
|
|
||
| build: | ||
| number: 0 | ||
| noarch: python | ||
| script: SETUPTOOLS_SCM_PRETEND_VERSION=${{ version }} ${{ PYTHON }} -m pip install -vvv . --no-deps --no-build-isolation | ||
|
|
||
| files: | ||
| exclude: | ||
| - "**/__pycache__/**" | ||
| - "**/*.pyc" | ||
| - "**/test_*.py" | ||
| python: | ||
| skip_pyc_compilation: | ||
| - "**/*.py" | ||
|
|
||
| requirements: | ||
| build: | ||
| - python | ||
| host: | ||
| - python | ||
| - pip | ||
| - setuptools | ||
| - setuptools-scm | ||
| run: | ||
| - python | ||
| - numpy | ||
| - pandas | ||
| - packaging | ||
|
|
||
| about: | ||
| summary: N-D labeled arrays and datasets in Python | ||
| license: Apache-2.0 | ||
| license_file: LICENSE | ||
| homepage: https://github.com/pydata/xarray | ||
| repository: https://github.com/pydata/xarray |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| import pathlib | ||
|
|
||
|
|
||
| def main(): | ||
| root = pathlib.Path(__file__).parent | ||
|
|
||
| local_channel = root.parent / "local_channel" | ||
| package_paths = list(local_channel.joinpath("noarch").glob("xarray*.conda")) | ||
| if len(package_paths) != 1: | ||
| raise RuntimeError(f"zero or more than one package found: {package_paths}") | ||
|
|
||
| package_path = package_paths[0] | ||
|
|
||
| template_path = root / "environment_template.yml" | ||
| env_path = root / "environment.yml" | ||
|
|
||
| template = template_path.read_text() | ||
| environment = template.replace('"{{ local-package }}"', str(package_path)) | ||
|
|
||
| env_path.write_text(environment) | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: xeus-python-kernel | ||
| channels: | ||
| - https://prefix.dev/emscripten-forge-dev | ||
| - https://prefix.dev/conda-forge | ||
| dependencies: | ||
| - xeus-python | ||
| - "{{ local-package }}" | ||
|
Contributor
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. AFAIK Rattler already has quite good templating ability, and can even read from environment variables. Perhaps we can have a pre-build step here that just sets these environment variables before being picked up by rattler (then we don't have to work outside of Rattler's conceptual framework here)
Collaborator
Author
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. there's two templates right now: the version in the recipe, and the local path of the built conda package in the
Contributor
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. Ah, didn't realise that this was an environment.yml and not a rattler recipe. Then we need the templating anyway.
Collaborator
Author
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. we can probably remove the templating step for the recipe (which would be nice, the additional step just makes this a bit trickier), but I will defer that to a separate PR |
||
| - numpy | ||
| - pandas | ||
| - packaging | ||
| - boto3 | ||
| - cartopy | ||
| - cftime | ||
| - h5netcdf | ||
| - h5py | ||
| - hdf5 | ||
| - lxml # Optional dep of pydap | ||
| - matplotlib | ||
| - nc-time-axis | ||
| - netcdf4 | ||
| - pint>=0.22 | ||
| - pooch | ||
| - pydap | ||
| - rasterio | ||
| - scipy | ||
| - seaborn | ||
| - setuptools | ||
| - toolz | ||
| - zarr | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "global_min_height": "400px" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,6 +295,8 @@ Bug Fixes | |
|
|
||
| Documentation | ||
| ~~~~~~~~~~~~~ | ||
| - Use ``jupyterlite-sphinx`` to provide interactive examples (:pull:`10299`). | ||
| By `Justus Magin <https://github.com/keewis>`_. | ||
|
Collaborator
Author
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 will need to be moved to the most recent release section |
||
|
|
||
| - Add AI policy (:pull:`11257`). | ||
| By `Nick Hodgskin <https://github.com/VeckoTheGecko>`_. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [workspace] | ||
| preview = ["pixi-build"] | ||
| channels = ["conda-forge", "nodefaults"] | ||
| channels = ["conda-forge", "nodefaults", "https://prefix.dev/keewis-oss"] | ||
| platforms = ["win-64", "linux-64", "osx-arm64"] | ||
| requires-pixi = ">=0.63.2,!=0.68.0" | ||
|
|
||
|
|
@@ -233,19 +233,29 @@ sphinx-copybutton = "*" | |
| sphinx-design = "*" | ||
| sphinx-inline-tabs = "*" | ||
| sphinx-llm = ">=0.2.1" | ||
| sphinx = ">=6,<8" | ||
| sphinx = ">=8,<9" | ||
| sphinxcontrib-mermaid = "*" | ||
| sphinxcontrib-srclinks = "*" | ||
| sphinx-remove-toctrees = "*" | ||
| sphinxext-opengraph = "*" | ||
| sphinxext-rediraffe = "*" | ||
| cfgrib = "*" | ||
| myst-parser = "*" | ||
| # use the official version once https://github.com/jupyterlite/jupyterlite-sphinx/pull/346 has been resolved | ||
| jupyterlite-sphinx = { version = "*", channel = "https://prefix.dev/keewis-oss" } | ||
|
Collaborator
Author
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 is making use of a conda package I created using |
||
| jupyterlite-xeus = ">=4.4.1" | ||
| make = "*" | ||
|
|
||
| [feature.doc.tasks] | ||
| doc = { cmd = "make html", cwd = "doc", description = "Build the HTML documentation." } | ||
| doc-clean = { cmd = "make clean && make html", cwd = "doc", description = "Clean build artifacts and rebuild the HTML documentation from scratch." } | ||
| _prepare-environment = { cmd = "python create_environment.py", cwd = "doc" } | ||
| doc = { cmd = "make html", cwd = "doc", description = "Build the HTML documentation.", depends-on = [ | ||
| "_prepare-environment", | ||
| ] } | ||
| doc-clean = { cmd = "make clean && make html", cwd = "doc", description = "Clean build artifacts and rebuild the HTML documentation from scratch.", depends-on = [ | ||
| "build", | ||
| "_prepare-environment", | ||
| ] } | ||
| host-static-doc = { cmd = "python -m http.server -b 127.0.0.1 -d _build/html 5455", cwd = "doc", description = "serve the static documentation" } | ||
| linkcheck = { cmd = "make linkcheck", cwd = "doc", description = "Check URLs in documentation." } | ||
|
|
||
|
|
||
|
|
@@ -370,6 +380,36 @@ rst-to-myst = { version = "*", extras = ["sphinx"] } | |
| [feature.tools.tasks] | ||
| rst2myst = { cmd = "rst2myst", description = "Convert rst to myst markdown" } | ||
|
|
||
| [feature.build-package.dependencies] | ||
| vcs_versioning = "*" | ||
| cytoolz = "*" | ||
| rattler-build = "*" | ||
|
|
||
| [feature.build-package.tasks.prepare-recipe] | ||
| cmd = "python ci/recipe/prepare_recipe.py" | ||
| cwd = "." | ||
|
|
||
| [feature.build-package.tasks.build] | ||
| cmd = [ | ||
| "rattler-build", | ||
| "build", | ||
| "-c", | ||
| "conda-forge", | ||
| "--recipe", | ||
| "ci/recipe/recipe.yaml", | ||
| "--output-dir", | ||
| "local_channel", | ||
| ] | ||
|
Comment on lines
+393
to
+402
Collaborator
Author
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. we can probably replace this with a call to |
||
| cwd = "." | ||
| depends-on = ["prepare-recipe"] | ||
|
|
||
| [tasks] | ||
| build-and-host-doc = [ | ||
| { task = "build" }, | ||
| { task = "doc" }, | ||
| { task = "host-static-doc" }, | ||
| ] | ||
|
|
||
| [feature.numpydoc-lint.dependencies] | ||
| numpydoc = "*" | ||
|
|
||
|
|
@@ -504,6 +544,7 @@ doc = { features = [ | |
| "accel", | ||
| "viz", | ||
| "extras", | ||
| "numba", | ||
| ] } | ||
| pre-commit = { features = ["pre-commit"], no-default-feature = true } | ||
| release = { features = ["release"], no-default-feature = true } | ||
|
|
@@ -521,3 +562,7 @@ default = { features = [ | |
| policy = { features = ["policy"], no-default-feature = true } | ||
| numpydoc-lint = { features = ["numpydoc-lint"] } | ||
| tools = { features = ["tools"], no-default-feature = true } | ||
| build-package = { features = [ | ||
| "build-package", | ||
| "release", | ||
| ], no-default-feature = true } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
re. naming, perhaps
ci/rattler/recipe.yamlandci/rattler/prepare_recipe.pyis clearer ?(EDIT: This is a nit)
Uh oh!
There was an error while loading. Please reload this page.
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 was hoping to at some point get rid of the recipe in favor of using the output of
pixi buildwith the python backend, we'd just need to get the version to work properly (I copied this fromhealpix-geo, where I had to use rattler directly because I need to compile rust code toemscripten-wasm32).Edit: in the meantime the rename sounds fine to me.