From a8e0e788c48e1a8054bec228bda3deb308c5cf6b Mon Sep 17 00:00:00 2001 From: Andreas Poehlmann Date: Mon, 28 Aug 2023 20:52:10 +0200 Subject: [PATCH] update readme --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 503efdb7..160588e0 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,39 @@ with fs.open(p.path) as f: data = f.read() ``` +### Register custom UPath implementations + +In case you develop a custom UPath implementation, feel free to open an issue to discuss integrating it +in `universal_pathlib`. You can dynamically register your implementation too! Here are your options: + +#### Dynamic registration from Python + +```python +# for example: mymodule/submodule.py +from upath import UPath +from upath.registry import register_implementation + +my_protocol = "myproto" +class MyPath(UPath): + ... # your custom implementation + +register_implementation(my_protocol, MyPath) +``` + +#### Registration via entry points + +```toml +# pyproject.toml +[project.entry-points."unversal_pathlib.implementations"] +myproto = "my_module.submodule:MyPath" +``` + +```ini +# setup.cfg +[options.entry_points] +universal_pathlib.implementations = + myproto = my_module.submodule:MyPath +``` ## Contributing