From 66a6ca619d85383353289c601a9c221badd45a152f758a298d38a5427699abc9 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 8 Sep 2024 13:21:35 +0000 Subject: [PATCH] - update to 2.4.0: * Drop 3.9 support * Add 3.13 support - update to 2.3.0: * Add module name rewrite configuration option - update to 2.2.3: * Fix mypy errors due to unneeded type ignores * Fix rendering when docstring starst with a directive OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sphinx-autodoc-typehints?expand=0&rev=49 --- .gitattributes | 23 ++ .gitignore | 1 + _multibuild | 3 + ...-autodoc-typehints-system-object.inv.patch | 27 ++ python-sphinx-autodoc-typehints.changes | 245 ++++++++++++++++++ python-sphinx-autodoc-typehints.spec | 93 +++++++ sphinx_autodoc_typehints-2.2.2.tar.gz | 3 + sphinx_autodoc_typehints-2.4.0.tar.gz | 3 + 8 files changed, 398 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _multibuild create mode 100644 python-sphinx-autodoc-typehints-system-object.inv.patch create mode 100644 python-sphinx-autodoc-typehints.changes create mode 100644 python-sphinx-autodoc-typehints.spec create mode 100644 sphinx_autodoc_typehints-2.2.2.tar.gz create mode 100644 sphinx_autodoc_typehints-2.4.0.tar.gz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..fcc7b97 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + diff --git a/python-sphinx-autodoc-typehints-system-object.inv.patch b/python-sphinx-autodoc-typehints-system-object.inv.patch new file mode 100644 index 0000000..d762cc8 --- /dev/null +++ b/python-sphinx-autodoc-typehints-system-object.inv.patch @@ -0,0 +1,27 @@ +--- + tests/conftest.py | 13 ++----------- + 1 file changed, 2 insertions(+), 11 deletions(-) + +Index: sphinx_autodoc_typehints-1.25.2/tests/conftest.py +=================================================================== +--- sphinx_autodoc_typehints-1.25.2.orig/tests/conftest.py ++++ sphinx_autodoc_typehints-1.25.2/tests/conftest.py +@@ -19,16 +19,8 @@ collect_ignore = ["roots"] + + @pytest.fixture(scope="session") + def inv(pytestconfig: Config) -> Inventory: +- cache_path = f"python{sys.version_info.major}.{sys.version_info.minor}/objects.inv" +- assert pytestconfig.cache is not None +- inv_dict = pytestconfig.cache.get(cache_path, None) +- if inv_dict is not None: +- return Inventory(inv_dict) +- +- url = f"https://docs.python.org/{sys.version_info.major}.{sys.version_info.minor}/objects.inv" +- inv = Inventory(url=url) +- pytestconfig.cache.set(cache_path, inv.json_dict()) +- return inv ++ inv_dict = '/usr/share/doc/packages/python@PYTHON_VERSION@/html/objects.inv' ++ return Inventory(inv_dict) + + + @pytest.fixture(autouse=True) diff --git a/python-sphinx-autodoc-typehints.changes b/python-sphinx-autodoc-typehints.changes new file mode 100644 index 0000000..89fd4ab --- /dev/null +++ b/python-sphinx-autodoc-typehints.changes @@ -0,0 +1,245 @@ +------------------------------------------------------------------- +Sun Sep 8 13:20:42 UTC 2024 - Dirk Müller + +- update to 2.4.0: + * Drop 3.9 support + * Add 3.13 support +- update to 2.3.0: + * Add module name rewrite configuration option +- update to 2.2.3: + * Fix mypy errors due to unneeded type ignores + * Fix rendering when docstring starst with a directive + +------------------------------------------------------------------- +Sat Jun 29 05:37:49 UTC 2024 - Dirk Müller + +- update to 2.2.2: + * Fix for Issue #384: typehints_defaults = "braces-after" fails + for a multiline `:param:` entry + * Support autodoc_type_aliases configuration + * Support Sphinx 7.3 and drop 3.8 support + * Return injection fix + * Add option to force unions (and options) to be rendered with + bars + +------------------------------------------------------------------- +Thu Feb 1 20:55:37 UTC 2024 - Dirk Müller + +- update to 1.25.3: + * dependency bumps + +------------------------------------------------------------------- +Sun Jan 14 10:21:24 UTC 2024 - Dirk Müller + +- update to 1.25.2: + * Allow Sphinx explicitly to write in parallel. + * Fixed crash when documenting ParamSpecArgs + * Fixed a bug where if a class has an attribute and a constructor + argument with the same name, the constructor argument + type would be rendered incorrectly (issue 308) + * Fixed napoleon handling of numpy docstrings with no specified + return type. + * Fix a `Field list ends without a blank line` warning (issue 305). + * More robust determination of rtype location / fix issue 302 + * Improvements to the location of the return type + * Use format_annotation to render class attribute type annotations + * Fix overloads support + * Fix spacing between `:rtype:` and directives + * Handle types from types module + * If module is \_io, use io instead + * Put rtype before examples or usage section + * Remove redundant return type for attributes + * Handle collections.abc.Callable as well as typing.Callable + * Put Literal args in code blocks + * Fix Optional role to be data. + * Fixed default options not displaying for parameters without + type hints. + * Use hatchling instead of setuptools + * Add support for typing.ParamSpec + * Allow star prefixes for parameter names in docstring + +------------------------------------------------------------------- +Fri Jul 21 12:06:28 UTC 2023 - Johannes Kastl + +- add sle15_python_module_pythons, remove skip_python2 + +------------------------------------------------------------------- +Fri Oct 7 16:20:26 UTC 2022 - Yogalakshmi Arunachalam + +- Update to version 1.19.2 + * Fix incorrect domain used for collections.abc.Callable. + * Support for CPython 3.11, no longer adds Optional when the argument is default + +------------------------------------------------------------------- +Thu Jul 14 16:34:24 UTC 2022 - Ben Greiner + +- Update to 1.18.3 + * Fix for new nptyping by @gaborbernat in #235 +- Remove requirement on old extra package pathlib + +------------------------------------------------------------------- +Mon Jun 6 23:01:55 UTC 2022 - Matej Cepl + +- Update to 1.18.2: + - [pre-commit.ci] pre-commit autoupdate + - Support and require nptyping 2.1.1 + +------------------------------------------------------------------- +Wed May 11 10:08:38 UTC 2022 - Matej Cepl + +- Switch to multibuild to break build cycles. + +------------------------------------------------------------------- +Thu May 5 05:35:05 UTC 2022 - Matej Cepl + +- Upgrade to 1.18.1: + - Fix mocked module import not working when used as guarded + import + - Support and require nptyping>=2 + - Handle UnionType + - Mark it as requiring nptyping<2 + - Add typehints_use_rtype option + - Handles TypeError when getting source code via inspect + - Add support for type subscriptions with multiple elements, + where one or more elements are tuples; e.g., + nptyping.NDArray[(Any, ...), nptyping.Float] + - Fix bug for arbitrary types accepting singleton + subscriptions; e.g., nptyping.Float[64] + - Resolve forward references + - Expand and better handle TypeVar + - Add intershpinx reference link for ... to Ellipsis (as is + just an alias) + - Prevents reaching inner blocks that contains if TYPE_CHECKING + - Log a warning instead of crashing when a type guard import + fails to resolve + - When resolving type guard imports if the target module does + not have source code (such is the case for C-extension + modules) do nothing instead of crashing + - Fix fully_qualified should be typehints_fully_qualified + - Resolve type guard imports before evaluating annotations for + objects + - Remove set_type_checking_flag flag as this is now done by + default + - Fix crash when the inspect module returns an invalid python + syntax source + - Made formatting function configurable using the option + typehints_formatter + - Fixed normalize_source_lines() messing with the indentation + of methods with decorators that have parameters starting with + def. + - Handle ValueError or TypeError being raised when signature of + an object cannot be determined + - Fix KeyError being thrown when argument is not documented + (e.g. cls argument for class methods, and self for methods) + - Added typehints_defaults config option allowing to + automatically annotate parameter defaults. + - Fixed NewType inserts a reference as first argument instead + of a string + - Dropped Python 3.6 support + - Python 3.10 support + - Normalize async functions properly + - Allow py310 style annotations (PEP-563) + +------------------------------------------------------------------- +Mon Dec 27 17:20:01 UTC 2021 - Ben Greiner + +- Skip python310: Not ready yet. Factory needs only the primary + python3 flavor + +------------------------------------------------------------------- +Tue Aug 3 09:42:00 UTC 2021 - Matej Cepl + +- Update to 1.12.0: + - Dropped Python 3.5 support + - Added the simplify_optional_unions config option + - Fixed indentation of multiline strings + - Changed formatting of None to point to the Python stdlib docs + - Updated special dataclass handling + +------------------------------------------------------------------- +Sat Apr 24 14:11:17 UTC 2021 - Matej Cepl + +- Remove no-net-tests.patch as adding the fixed + python-sphinx-autodoc-typehints-system-object.inv.patch + makes tests requiring network working + (gh#agronholm/sphinx-autodoc-typehints#174). + +------------------------------------------------------------------- +Fri Apr 23 14:24:23 UTC 2021 - Matej Cepl + +- Add no-net-tests.patch which marks tests requiring network + (gh#agronholm/sphinx-autodoc-typehints#174). + +------------------------------------------------------------------- +Wed Sep 23 13:29:55 UTC 2020 - Dirk Mueller + +- update to 1.11.0: + * Dropped support for Sphinx < 3.0 + * Added support for alternative parameter names (``arg``, ``argument``, ``parameter``) + * Fixed import path for Signature (PR by Matthew Treinish) + * Fixed ``TypeError`` when formatting a parametrized ``typing.IO`` annotation + * Fixed data class displaying a return type in its ``__init__()`` method +- remove python-sphinx-autodoc-typehints-system-object.inv.patch (breaks the build) + +------------------------------------------------------------------- +Fri Mar 6 14:50:12 UTC 2020 - pgajdos@suse.com + +- version update to 1.10.3 + * Fixed ``TypeError`` (or wrong rendered class name) when an annotation is a generic class that has + a ``name`` property + * Fixed inner classes missing their parent class name(s) when rendered + * Fixed ``KeyError`` when encountering mocked annotations (``autodoc_mock_imports``) + * Rewrote the annotation formatting logic (fixes Python 3.5.2 compatibility regressions and an + ``AttributeError`` regression introduced in v1.9.0) + * Fixed decorator classes not being processed as classes + * Added support for typing_extensions_ + * Added the ``typehints_document_rtype`` option (PR by Simon-Martin Schröder) + * Fixed metaclasses as annotations causing ``TypeError`` + * Fixed rendering of ``typing.Literal`` + * Fixed OSError when generating docs for SQLAlchemy mapped classes + * Fixed unparametrized generic classes being rendered with their type parameters + (e.g. ``Dict[~KT, ~VT]``) +- added patches + fix use object.inv which comes with python-doc + + python-sphinx-autodoc-typehints-system-object.inv.patch + +------------------------------------------------------------------- +Mon Sep 16 13:38:42 UTC 2019 - Tomáš Chvátal + +- Update to 1.8.0: + * Fixed regression which caused TypeError or OSError when trying to set annotations due to PR #87 + * Fixed unintentional mangling of annotation type names + * Added proper :py:data targets for NoReturn, ClassVar and Tuple + * Added support for inline type comments (like (int, str) -> None) (PR by Bernát Gábor) + * Use the native AST parser for type comment support on Python 3.8+ + +------------------------------------------------------------------- +Tue Sep 10 10:03:02 UTC 2019 - Tomáš Chvátal + +- Update to 1.7.0: + * Fixed unwrapped local functions causing errors (PR by Kimiyuki Onaka) + * Fixed AttributeError when documenting the __init__() method of a data class + * Added support for type hint comments (PR by Markus Unterwaditzer) + * Added flag for rendering classes with their fully qualified names (PR by Holly Becker) +- Remove merged patch sphinx21.patch + +------------------------------------------------------------------- +Wed Jul 3 09:13:37 UTC 2019 - Tomáš Chvátal + +- Add patch to fix build with new sphinx: + * sphinx21.patch + +------------------------------------------------------------------- +Thu Jun 6 13:41:01 UTC 2019 - Tomáš Chvátal + +- Drop not really needed devel dependency + +------------------------------------------------------------------- +Sat Mar 23 14:37:28 UTC 2019 - Sebastian Wagner + +- Remove patch setup-tests.patch, we are using pytest now. + +------------------------------------------------------------------- +Wed Mar 20 21:12:28 UTC 2019 - Sebastian Wagner + +- initial package for version 1.6.0 diff --git a/python-sphinx-autodoc-typehints.spec b/python-sphinx-autodoc-typehints.spec new file mode 100644 index 0000000..beecd92 --- /dev/null +++ b/python-sphinx-autodoc-typehints.spec @@ -0,0 +1,93 @@ +# +# spec file for package python-sphinx-autodoc-typehints +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define modname sphinx_autodoc_typehints +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%define psuffix -test +%bcond_without test +%else +%define psuffix %{nil} +%bcond_with test +%endif + +%{?sle15_python_module_pythons} +Name: python-sphinx-autodoc-typehints%{psuffix} +Version: 2.4.0 +Release: 0 +Summary: Type hints (PEP 484) support for the Sphinx autodoc extension +License: MIT +Group: Development/Languages/Python +URL: https://github.com/tox-dev/sphinx-autodoc-typehints +Source: https://files.pythonhosted.org/packages/source/s/sphinx_autodoc_typehints/sphinx_autodoc_typehints-%{version}.tar.gz +# PATCH-FIX-OPENSUSE python-sphinx-autodoc-typehints-system-object.inv.patch gh#agronholm/sphinx-autodoc-typehints#174 mcepl@suse.com +# Don't download inventory from the Internet, but use the local one. +Patch0: python-sphinx-autodoc-typehints-system-object.inv.patch +BuildRequires: %{python_module hatch_vcs} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-Sphinx >= 1.7 +BuildArch: noarch +%if %{with test} +# SECTION tests +BuildRequires: %{python_module Sphinx >= 7.3.5} +BuildRequires: %{python_module doc} +BuildRequires: %{python_module nptyping >= 2.5} +BuildRequires: %{python_module pytest >= 8.1.1} +BuildRequires: %{python_module sphobjinv >= 2.3.1} +BuildRequires: %{python_module typing_extensions >= 4.11} +%endif +# /SECTION +%python_subpackages + +%description +This is a Sphinx extension which allows to use Python 3 annotations for documenting acceptable argument types +and return value types of functions. + +%prep +%autosetup -p1 -n sphinx_autodoc_typehints-%{version} + +%build +%pyproject_wheel +%python_expand sed -i -e 's/@PYTHON_VERSION@/%{$python_version}/' tests/conftest.py + +%install +%if %{without test} +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%endif + +%check +export PYTHONPATH=./src +%if %{with test} +# test_sphinx_output -- too depenedent on sphinx version available +# gh#tox-dev/sphinx-autodoc-typehints#229 +%pytest -k 'not (test_sphinx_output or test_format_annotation)' +%endif + +%if %{without test} +%files %{python_files} +%license LICENSE +%doc README.md CHANGELOG.md +%{python_sitelib}/%{modname}-%{version}*-info +%{python_sitelib}/%{modname} +%endif + +%changelog diff --git a/sphinx_autodoc_typehints-2.2.2.tar.gz b/sphinx_autodoc_typehints-2.2.2.tar.gz new file mode 100644 index 0000000..05f3c65 --- /dev/null +++ b/sphinx_autodoc_typehints-2.2.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:128e600eeef63b722f3d8dac6403594592c8cade3ba66fd11dcb997465ee259d +size 40324 diff --git a/sphinx_autodoc_typehints-2.4.0.tar.gz b/sphinx_autodoc_typehints-2.4.0.tar.gz new file mode 100644 index 0000000..d06f8e9 --- /dev/null +++ b/sphinx_autodoc_typehints-2.4.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f8281654ddf5709875429b7120d367f4edee39a131e13d5806e4f779a81bf0f +size 40568