Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-docstring-to-markdown for openSUSE:Factory checked in at 2022-12-08 16:51:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-docstring-to-markdown (Old) and /work/SRC/openSUSE:Factory/.python-docstring-to-markdown.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-docstring-to-markdown" Thu Dec 8 16:51:00 2022 rev:2 rq:1041205 version:0.11 Changes: -------- --- /work/SRC/openSUSE:Factory/python-docstring-to-markdown/python-docstring-to-markdown.changes 2022-11-07 13:52:10.831966508 +0100 +++ /work/SRC/openSUSE:Factory/.python-docstring-to-markdown.new.1835/python-docstring-to-markdown.changes 2022-12-08 16:51:22.779542588 +0100 @@ -1,0 +2,14 @@ +Wed Dec 7 17:56:49 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 0.11 + * Enhancements + Parse syntax within tables #19 + Complete support for RST admonitions #20 + * Maintenance + Move away from deprecated SPDX identifier, update links #18 + Add Python 3.10 to test matrix #21 + Enable GitHub dependency tracking #22 + Add Python 3.11 to testing matrix #23 + Prepare 0.11 release #24 + +------------------------------------------------------------------- Old: ---- docstring-to-markdown-0.10-gh.tar.gz New: ---- docstring-to-markdown-0.11-gh.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-docstring-to-markdown.spec ++++++ --- /var/tmp/diff_new_pack.IAcdsx/_old 2022-12-08 16:51:23.615546865 +0100 +++ /var/tmp/diff_new_pack.IAcdsx/_new 2022-12-08 16:51:23.619546885 +0100 @@ -17,7 +17,7 @@ Name: python-docstring-to-markdown -Version: 0.10 +Version: 0.11 Release: 0 Summary: On the fly conversion of Python docstrings to markdown License: LGPL-2.1-only ++++++ docstring-to-markdown-0.10-gh.tar.gz -> docstring-to-markdown-0.11-gh.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docstring-to-markdown-0.10/.github/workflows/tests.yml new/docstring-to-markdown-0.11/.github/workflows/tests.yml --- old/docstring-to-markdown-0.10/.github/workflows/tests.yml 2021-11-17 21:10:25.000000000 +0100 +++ new/docstring-to-markdown-0.11/.github/workflows/tests.yml 2022-12-02 00:54:11.000000000 +0100 @@ -12,7 +12,7 @@ runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11'] steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docstring-to-markdown-0.10/README.md new/docstring-to-markdown-0.11/README.md --- old/docstring-to-markdown-0.10/README.md 2021-11-17 21:10:25.000000000 +0100 +++ new/docstring-to-markdown-0.11/README.md 2022-12-02 00:54:11.000000000 +0100 @@ -1,7 +1,7 @@ # docstring-to-markdown -[](https://github.com/krassowski/docstring-to-markdown/actions?query=workflow%3A%22tests%22) - +[](https://github.com/python-lsp/docstring-to-markdown/actions?query=workflow%3A%22tests%22) + [](https://python.org/pypi/docstring-to-markdown) On the fly conversion of Python docstrings to markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docstring-to-markdown-0.10/docstring_to_markdown/__init__.py new/docstring-to-markdown-0.11/docstring_to_markdown/__init__.py --- old/docstring-to-markdown-0.10/docstring_to_markdown/__init__.py 2021-11-17 21:10:25.000000000 +0100 +++ new/docstring-to-markdown-0.11/docstring_to_markdown/__init__.py 2022-12-02 00:54:11.000000000 +0100 @@ -1,6 +1,6 @@ from .rst import looks_like_rst, rst_to_markdown -__version__ = "0.10" +__version__ = "0.11" class UnknownFormatError(Exception): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docstring-to-markdown-0.10/docstring_to_markdown/rst.py new/docstring-to-markdown-0.11/docstring_to_markdown/rst.py --- old/docstring-to-markdown-0.10/docstring_to_markdown/rst.py 2021-11-17 21:10:25.000000000 +0100 +++ new/docstring-to-markdown-0.11/docstring_to_markdown/rst.py 2022-12-02 00:54:11.000000000 +0100 @@ -156,6 +156,75 @@ ] +class Admonition: + def __init__(self, name: str, label: str, icon: str = ''): + self.name = name + self.label = label + self.icon = icon + + @property + def block_markdown(self): + return f'{self.icon} **{self.label}**' + + @property + def inline_markdown(self): + return self.block_markdown + ':' + + +ADMONITIONS = [ + Admonition( + name='caution', + label='Caution', + icon='â ï¸ ' + ), + Admonition( + name='attention', + label='Attention', + icon='â ï¸ ' + ), + Admonition( + name='danger', + label='Danger', + icon='â ï¸ ' + ), + Admonition( + name='hint', + label='Hint', + icon='ð' + ), + Admonition( + name='important', + label='Important', + icon='â ï¸ ' + ), + Admonition( + name='note', + label='Note', + icon='ð' + ), + Admonition( + name='tip', + label='Tip', + icon='ð' + ), + Admonition( + name='warning', + label='Warning', + icon='â ï¸ ' + ) +] + + +ADMONITION_DIRECTIVES: List[Directive] = [ + # https://docutils.sourceforge.io/docs/ref/rst/directives.html#admonitions + Directive( + pattern=rf'\.\. {admonition.name}::', + replacement=admonition.inline_markdown + ) + for admonition in ADMONITIONS +] + + RST_DIRECTIVES: List[Directive] = [ Directive( pattern=r'\.\. versionchanged:: (?P<version>\S+)(?P<end>$|\n)', @@ -169,10 +238,7 @@ pattern=r'\.\. deprecated:: (?P<version>\S+)(?P<end>$|\n)', replacement=r'*Deprecated since \g<version>*\g<end>' ), - Directive( - pattern=r'\.\. warning::', - replacement=r'**Warning**:' - ), + *ADMONITION_DIRECTIVES, Directive( pattern=r'\.\. seealso::(?P<short_form>.*)(?P<end>$|\n)', replacement=r'*See also*\g<short_form>\g<end>' @@ -402,6 +468,7 @@ self._columns_end ) fragment = line[start:end].strip() + fragment = rst_to_markdown(fragment, extract_signature=False) self._max_sizes[i] = max(self._max_sizes[i], len(fragment)) fragments.append(fragment) return fragments @@ -604,13 +671,17 @@ class NoteBlockParser(IndentedBlockParser): enclosure = '\n---' - directives = {'.. note::', '.. warning::'} + directives = { + f'.. {admonition.name}::': admonition + for admonition in ADMONITIONS + } def can_parse(self, line: str): return line.strip() in self.directives def initiate_parsing(self, line: str, current_language: str): - self._start_block('\n**Note**\n' if 'note' in line else '\n**Warning**\n') + admonition = self.directives[line.strip()] + self._start_block(f'\n{admonition.block_markdown}\n') return IBlockBeginning(remainder='') @@ -647,7 +718,7 @@ ] -def rst_to_markdown(text: str) -> str: +def rst_to_markdown(text: str, extract_signature: bool = True) -> str: """ Try to parse docstrings in following formats to markdown: - https://www.python.org/dev/peps/pep-0287/ @@ -693,10 +764,12 @@ for line in text.split('\n'): if is_first_line: - signature_match = re.match(r'^(?P<name>\S+)\((?P<params>.*)\)$', line) - if signature_match and signature_match.group('name').isidentifier(): - markdown += '```python\n' + line + '\n```\n' - continue + if extract_signature: + signature_match = re.match(r'^(?P<name>\S+)\((?P<params>.*)\)$', line) + if signature_match and signature_match.group('name').isidentifier(): + markdown += '```python\n' + line + '\n```\n' + continue + is_first_line = False trimmed_line = line.lstrip() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docstring-to-markdown-0.10/requirements-dev.txt new/docstring-to-markdown-0.11/requirements-dev.txt --- old/docstring-to-markdown-0.10/requirements-dev.txt 2021-11-17 21:10:25.000000000 +0100 +++ new/docstring-to-markdown-0.11/requirements-dev.txt 2022-12-02 00:54:11.000000000 +0100 @@ -1,4 +1,5 @@ pytest pytest-cov pytest-flake8 +flake8<5 mypy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docstring-to-markdown-0.10/setup.cfg new/docstring-to-markdown-0.11/setup.cfg --- old/docstring-to-markdown-0.10/setup.cfg 2021-11-17 21:10:25.000000000 +0100 +++ new/docstring-to-markdown-0.11/setup.cfg 2022-12-02 00:54:11.000000000 +0100 @@ -5,7 +5,7 @@ long_description_content_type = text/markdown author = MichaÅ Krassowski author_email = krassowski.michal+p...@gmail.com -license = LGPL-2.1 +license = LGPL-2.1-or-later keywords = Docstring conversion @@ -15,9 +15,11 @@ Intended Audience :: Developers License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) Programming Language :: Python + Topic :: Text Processing :: Markup + Topic :: Documentation :: Sphinx project_urls = - Bug Tracker = https://github.com/krassowski/docstring-to-markdown/issues - Source Code = https://github.com/krassowski/docstring-to-markdown + Bug Tracker = https://github.com/python-lsp/docstring-to-markdown/issues + Source Code = https://github.com/python-lsp/docstring-to-markdown version = attr: docstring_to_markdown.__version__ [mypy] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docstring-to-markdown-0.10/setup.py new/docstring-to-markdown-0.11/setup.py --- old/docstring-to-markdown-0.10/setup.py 2021-11-17 21:10:25.000000000 +0100 +++ new/docstring-to-markdown-0.11/setup.py 2022-12-02 00:54:11.000000000 +0100 @@ -1,3 +1,5 @@ import setuptools -setuptools.setup() +setuptools.setup( + name="docstring-to-markdown", # to allow GitHub dependency tracking +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docstring-to-markdown-0.10/tests/test_rst.py new/docstring-to-markdown-0.11/tests/test_rst.py --- old/docstring-to-markdown-0.10/tests/test_rst.py 2021-11-17 21:10:25.000000000 +0100 +++ new/docstring-to-markdown-0.11/tests/test_rst.py 2022-12-02 00:54:11.000000000 +0100 @@ -243,7 +243,7 @@ --- -**Note** +ð **Note** The `chararray` class exists for backwards compatibility with Numarray, it is not recommended for new development. @@ -399,7 +399,7 @@ --- -**Warning** +â ï¸ **Warning** Loading pickled data received from untrusted sources can be unsafe. @@ -421,7 +421,7 @@ LINE_WARNING_MARKDOWN = """ Create a view into the array with the given shape and strides. -**Warning**: This function has to be used with extreme care, see notes. +â ï¸ **Warning**: This function has to be used with extreme care, see notes. Parameters """ @@ -462,7 +462,7 @@ """ SIMPLE_TABLE_MARKDOWN = """ -**Warning**: This is not a standard simple table +â ï¸ **Warning**: This is not a standard simple table | Character | Meaning | | --------- | --------------------------------------------------------------- | @@ -471,6 +471,24 @@ """ +SIMPLE_TABLE_WITH_MARKUP = """ +============================== ======================================= +Scalar Type Array Type +============================== ======================================= +:class:`pandas.Interval` :class:`pandas.arrays.IntervalArray` +:class:`bool` :class:`pandas.arrays.BooleanArray` +============================== ======================================= +""" + + +SIMPLE_TABLE_WITH_MARKUP_MARKDOWN = """ +| Scalar Type | Array Type | +| ----------------- | ----------------------------- | +| `pandas.Interval` | `pandas.arrays.IntervalArray` | +| `bool` | `pandas.arrays.BooleanArray` | +""" + + SIMPLE_TABLE_2 = """ .. warning:: This is a standard simple table @@ -483,7 +501,7 @@ """ SIMPLE_TABLE_2_MARKDOWN = """ -**Warning**: This is a standard simple table +â ï¸ **Warning**: This is a standard simple table | A | B | A and B | | ----- | ----- | ------- | @@ -782,6 +800,10 @@ 'rst': SIMPLE_TABLE, 'md': SIMPLE_TABLE_MARKDOWN }, + 'converts syntax within table': { + 'rst': SIMPLE_TABLE_WITH_MARKUP, + 'md': SIMPLE_TABLE_WITH_MARKUP_MARKDOWN + }, 'converts standard simple table': { 'rst': SIMPLE_TABLE_2, 'md': SIMPLE_TABLE_2_MARKDOWN