-
-
Notifications
You must be signed in to change notification settings - Fork 364
docs/examples #3502
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
Merged
Merged
docs/examples #3502
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ca4caa7
add documentation for examples
d-v-b 7017adb
update docs deployment
d-v-b 5835756
fix broken link
d-v-b 5da3243
update main examples documentation
d-v-b 3da05ef
Merge branch 'main' of github.com:zarr-developers/zarr-python into do…
d-v-b f78b09f
changelog
d-v-b 093055c
Merge branch 'main' into docs/examples
d-v-b e4054ad
Update mkdocs.yml
d-v-b 6ee16fe
Merge branch 'main' into docs/examples
d-v-b 9c845bf
Merge branch 'main' into docs/examples
maxrjones 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Reorganize the top-level `examples` directory to give each example its own sub-directory. Adds content to the docs for each example. |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--8<-- "examples/custom_dtype/README.md" | ||
|
||
## Source Code | ||
|
||
```python | ||
--8<-- "examples/custom_dtype/custom_dtype.py" | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Zarr Python Examples | ||
|
||
This directory contains complete, runnable examples demonstrating various features and use cases of Zarr Python. | ||
|
||
## Directory Structure | ||
|
||
Each example is organized in its own subdirectory with the following structure: | ||
|
||
``` | ||
examples/ | ||
├── example_name/ | ||
│ ├── README.md # Documentation for the example | ||
│ └── example_name.py # Python source code | ||
└── ... | ||
``` | ||
|
||
## Adding New Examples | ||
|
||
To add a new example: | ||
|
||
1. Create a new subdirectory: `examples/my_example/` | ||
2. Add your Python code: `examples/my_example/my_example.py` | ||
3. Create documentation: `examples/my_example/README.md` | ||
4. Create a documentation page at `docs/user-guide/examples/my_example.md`. The documentation page should simply link to the `README.md` and the source code, e.g.: | ||
|
||
```` | ||
# docs/user-guide/examples/my_example.md | ||
--8<-- "examples/my_example/README.md" | ||
|
||
## Source Code | ||
|
||
```python | ||
--8<-- "examples/my_example/my_example.py" | ||
``` | ||
```` | ||
5. Update `mkdocs.yml` to include the new example in the navigation. | ||
|
||
### Example README.md Format | ||
|
||
Your README.md should include: | ||
|
||
- A title (`# Example Name`) | ||
- Description of what the example demonstrates | ||
- Instructions for running the example |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Custom Data Type Example | ||
|
||
This example demonstrates how to extend Zarr Python by defining a new data type. | ||
|
||
The example shows how to: | ||
|
||
- Define a custom `ZDType` class for the `int2` data type from [`ml_dtypes`](https://pypi.org/project/ml-dtypes/) | ||
- Implement all required methods for serialization and deserialization | ||
- Register the custom data type with Zarr's registry | ||
- Create and use arrays with the custom data type in both Zarr v2 and v3 formats | ||
|
||
## Running the Example | ||
|
||
```bash | ||
python examples/custom_dtype/custom_dtype.py | ||
``` | ||
|
||
Or run with uv: | ||
|
||
```bash | ||
uv run examples/custom_dtype/custom_dtype.py | ||
``` |
File renamed without changes.
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
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.
Uh oh!
There was an error while loading. Please reload this page.