-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
87 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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 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 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,25 @@ | ||
pydantic_root=$(python -c "import pydantic;from pathlib import Path;print(Path(pydantic.__file__).parent)") | ||
main=$pydantic_root'/main.py' | ||
original="$(dirname "$0")/original.py" | ||
patched="$(dirname "$0")/patched.py" | ||
|
||
if [ -e $original ] | ||
then | ||
echo "found existing $original" | ||
else | ||
cp --verbose $main $original | ||
fi | ||
|
||
if [ -e $patched ] | ||
then | ||
echo "found existing $patched" | ||
else | ||
cp --verbose $main $patched | ||
echo "Please update $patched, then press enter to continue" | ||
read | ||
fi | ||
|
||
patch_file="$(dirname "$0")/mark_pydantic_attrs_private.patch" | ||
diff -au $original $patched > $patch_file | ||
echo "content of $patch_file:" | ||
cat $patch_file |
This file contains 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,28 @@ | ||
--- ./original.py 2024-11-08 15:18:37.493768700 +0100 | ||
+++ ./patched.py 2024-11-08 15:13:54.288887700 +0100 | ||
@@ -121,14 +121,14 @@ | ||
# `GenerateSchema.model_schema` to work for a plain `BaseModel` annotation. | ||
|
||
model_config: ClassVar[ConfigDict] = ConfigDict() | ||
- """ | ||
+ """@private | ||
Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. | ||
""" | ||
|
||
# Because `dict` is in the local namespace of the `BaseModel` class, we use `Dict` for annotations. | ||
# TODO v3 fallback to `dict` when the deprecated `dict` method gets removed. | ||
model_fields: ClassVar[Dict[str, FieldInfo]] = {} # noqa: UP006 | ||
- """ | ||
+ """@private | ||
Metadata about the fields defined on the model, | ||
mapping of field names to [`FieldInfo`][pydantic.fields.FieldInfo] objects. | ||
|
||
@@ -136,7 +136,7 @@ | ||
""" | ||
|
||
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {} # noqa: UP006 | ||
- """A dictionary of computed field names and their corresponding `ComputedFieldInfo` objects.""" | ||
+ """@private A dictionary of computed field names and their corresponding `ComputedFieldInfo` objects.""" | ||
|
||
__class_vars__: ClassVar[set[str]] | ||
"""The names of the class variables defined on the model.""" |
This file contains 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,16 @@ | ||
cd "$(dirname "$0")" # cd to folder this script is in | ||
|
||
# patch pydantic to hide pydantic attributes that somehow show up in the docs | ||
# (not even as inherited, but as if the documented class itself would define them) | ||
pydantic_main=$(python -c "import pydantic;from pathlib import Path;print(Path(pydantic.__file__).parent / 'main.py')") | ||
|
||
patch --verbose --forward -p1 $pydantic_main < mark_pydantic_attrs_private.patch | ||
|
||
cd ../.. # cd to repo root | ||
pdoc \ | ||
--docformat google \ | ||
--logo "https://bioimage.io/static/img/bioimage-io-logo.svg" \ | ||
--logo-link "https://bioimage.io/" \ | ||
--favicon "https://bioimage.io/static/img/bioimage-io-icon-small.svg" \ | ||
--footer-text "bioimageio.core $(python -c 'import bioimageio.core;print(bioimageio.core.__version__)')" \ | ||
-o ./dist bioimageio.core bioimageio.spec # generate bioimageio.spec as well for references |