%global _empty_manifest_terminate_build 0 Name: python-annotypes Version: 0.21 Release: 1 Summary: Annotating type hints and comments with extra metatdata License: APACHE URL: https://github.com/dls-controls/annotypes Source0: https://mirrors.aliyun.com/pypi/web/packages/16/c5/1113740fa4c1279d34b756002ca0ec8e138f4a360a8fcf78abff88cc19e5/annotypes-0.21.tar.gz BuildArch: noarch %description |build_status| |coverage| |pypi_version| Adding annotations to Python types while still being compatible with mypy_ and PyCharm_ You can write things like: from annotypes import Anno, WithCallTypes with Anno("The exposure time for the camera"): AExposure = float with Anno("The full path to the text file to write"): APath = str class Simple(WithCallTypes): def __init__(self, exposure, path="/tmp/file.txt"): # type: (AExposure, APath) -> None self.exposure = exposure self.path = path or the Python3 alternative: from annotypes import Anno, WithCallTypes with Anno("The exposure time for the camera"): AExposure = float with Anno("The full path to the text file to write"): APath = str class Simple(WithCallTypes): def __init__(self, exposure: AExposure, path: APath = "/tmp/file.txt"): self.exposure = exposure self.path = path And at runtime see what you should pass to call it and what it will return: >>> from annotypes.py2_examples.simple import Simple >>> list(Simple.call_types) ['exposure', 'path'] >>> Simple.call_types['exposure'] Anno(name='AExposure', typ=, description='The exposure time for the camera') >>> Simple.return_type Anno(name='Instance', typ=, description='Class instance') For more examples see the `Python 2 examples`_ or `Python 3 examples`_. %package -n python3-annotypes Summary: Annotating type hints and comments with extra metatdata Provides: python-annotypes BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-annotypes |build_status| |coverage| |pypi_version| Adding annotations to Python types while still being compatible with mypy_ and PyCharm_ You can write things like: from annotypes import Anno, WithCallTypes with Anno("The exposure time for the camera"): AExposure = float with Anno("The full path to the text file to write"): APath = str class Simple(WithCallTypes): def __init__(self, exposure, path="/tmp/file.txt"): # type: (AExposure, APath) -> None self.exposure = exposure self.path = path or the Python3 alternative: from annotypes import Anno, WithCallTypes with Anno("The exposure time for the camera"): AExposure = float with Anno("The full path to the text file to write"): APath = str class Simple(WithCallTypes): def __init__(self, exposure: AExposure, path: APath = "/tmp/file.txt"): self.exposure = exposure self.path = path And at runtime see what you should pass to call it and what it will return: >>> from annotypes.py2_examples.simple import Simple >>> list(Simple.call_types) ['exposure', 'path'] >>> Simple.call_types['exposure'] Anno(name='AExposure', typ=, description='The exposure time for the camera') >>> Simple.return_type Anno(name='Instance', typ=, description='Class instance') For more examples see the `Python 2 examples`_ or `Python 3 examples`_. %package help Summary: Development documents and examples for annotypes Provides: python3-annotypes-doc %description help |build_status| |coverage| |pypi_version| Adding annotations to Python types while still being compatible with mypy_ and PyCharm_ You can write things like: from annotypes import Anno, WithCallTypes with Anno("The exposure time for the camera"): AExposure = float with Anno("The full path to the text file to write"): APath = str class Simple(WithCallTypes): def __init__(self, exposure, path="/tmp/file.txt"): # type: (AExposure, APath) -> None self.exposure = exposure self.path = path or the Python3 alternative: from annotypes import Anno, WithCallTypes with Anno("The exposure time for the camera"): AExposure = float with Anno("The full path to the text file to write"): APath = str class Simple(WithCallTypes): def __init__(self, exposure: AExposure, path: APath = "/tmp/file.txt"): self.exposure = exposure self.path = path And at runtime see what you should pass to call it and what it will return: >>> from annotypes.py2_examples.simple import Simple >>> list(Simple.call_types) ['exposure', 'path'] >>> Simple.call_types['exposure'] Anno(name='AExposure', typ=, description='The exposure time for the camera') >>> Simple.return_type Anno(name='Instance', typ=, description='Class instance') For more examples see the `Python 2 examples`_ or `Python 3 examples`_. %prep %autosetup -n annotypes-0.21 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-annotypes -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Jun 20 2023 Python_Bot - 0.21-1 - Package Spec generated