diff --git a/ci/environment-docs.yml b/ci/environment-docs.yml index 21e7238..bf9d561 100644 --- a/ci/environment-docs.yml +++ b/ci/environment-docs.yml @@ -1,4 +1,4 @@ -name: ecgtools-dev +name: ecgtools-doc channels: - conda-forge - nodefaults @@ -12,14 +12,13 @@ dependencies: - myst-nb - netcdf4 - pip - - pydantic<2.0 # Will remove in upcoming PR + - pydantic>=2.0 - s3fs - sphinx-copybutton - sphinx-inline-tabs - xarray - pip: - sphinxext-opengraph - - autodoc_pydantic - -r ../requirements.txt - git+https://github.com/intake/intake-esm - -e .. diff --git a/ci/environment-upstream-dev.yml b/ci/environment-upstream-dev.yml index fb4cd81..302c462 100644 --- a/ci/environment-upstream-dev.yml +++ b/ci/environment-upstream-dev.yml @@ -14,7 +14,7 @@ dependencies: - numpydoc - pip - pre-commit - - pydantic<2.0 # Will remove in upcoming PR + - pydantic>=2.0 - pytest - pytest-cov - pytest-sugar diff --git a/ci/environment.yml b/ci/environment.yml index da75638..2c1923b 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -11,7 +11,7 @@ dependencies: - netcdf4 - pip - pre-commit - - pydantic<2.0 # Will remove in upcoming PR + - pydantic>=2.0 - pytest - pytest-cov - pytest-sugar diff --git a/docs/source/conf.py b/docs/source/conf.py index 8450dda..b36a3cc 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -16,7 +16,6 @@ 'myst_nb', 'sphinxext.opengraph', 'sphinx_copybutton', - 'sphinxcontrib.autodoc_pydantic', 'sphinx_inline_tabs', ] @@ -31,10 +30,6 @@ copybutton_prompt_text = r'>>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: ' copybutton_prompt_is_regexp = True - -autodoc_pydantic_model_show_json = True -autodoc_pydantic_settings_show_json = False - jupyter_execute_notebooks = 'off' execution_timeout = 600 execution_allow_errors = True diff --git a/ecgtools/builder.py b/ecgtools/builder.py index 19e3594..1cc1205 100644 --- a/ecgtools/builder.py +++ b/ecgtools/builder.py @@ -109,13 +109,13 @@ class Builder: """ paths: typing.List[str] - storage_options: typing.Dict[typing.Any, typing.Any] = None + storage_options: typing.Optional[typing.Dict[typing.Any, typing.Any]] = None depth: int = 0 - exclude_patterns: typing.List[str] = None - include_patterns: typing.List[str] = None - joblib_parallel_kwargs: typing.Dict[str, typing.Any] = None + exclude_patterns: typing.Optional[typing.List[str]] = None + include_patterns: typing.Optional[typing.List[str]] = None + joblib_parallel_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None - def __post_init_post_parse__(self): + def __post_init__(self): self.storage_options = self.storage_options or {} self.joblib_parallel_kwargs = self.joblib_parallel_kwargs or {} self.exclude_patterns = self.exclude_patterns or [] @@ -146,7 +146,9 @@ def get_assets(self): return self @pydantic.validate_arguments - def parse(self, *, parsing_func: typing.Callable, parsing_func_kwargs: dict = None): + def parse( + self, *, parsing_func: typing.Callable, parsing_func_kwargs: typing.Optional[dict] = None + ): if not self.assets: raise ValueError('asset list provided is None. Please run `.get_assets()` first') @@ -177,9 +179,9 @@ def build( self, *, parsing_func: typing.Callable, - parsing_func_kwargs: dict = None, - postprocess_func: typing.Callable = None, - postprocess_func_kwargs: dict = None, + parsing_func_kwargs: typing.Optional[dict] = None, + postprocess_func: typing.Optional[typing.Callable] = None, + postprocess_func_kwargs: typing.Optional[dict] = None, ): """Builds a catalog from a list of netCDF files or zarr stores. @@ -218,14 +220,14 @@ def save( path_column_name: str, variable_column_name: str, data_format: DataFormat, - groupby_attrs: typing.List[str] = None, - aggregations: typing.List[Aggregation] = None, + groupby_attrs: typing.Optional[typing.List[str]] = None, + aggregations: typing.Optional[typing.List[Aggregation]] = None, esmcat_version: str = '0.0.1', - description: str = None, - directory: str = None, + description: typing.Optional[str] = None, + directory: typing.Optional[str] = None, catalog_type: str = 'file', - to_csv_kwargs: dict = None, - json_dump_kwargs: dict = None, + to_csv_kwargs: typing.Optional[dict] = None, + json_dump_kwargs: typing.Optional[dict] = None, ): """Persist catalog contents to files. diff --git a/requirements.txt b/requirements.txt index 7f203b8..3accc80 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ joblib netCDF4 xarray pyyaml -pydantic +pydantic>=2.0 pandas fsspec intake-esm