Skip to content

Commit

Permalink
Merge pull request #291 from Carreau/thread-sig
Browse files Browse the repository at this point in the history
Start threading Structured signature into existing datastructures.
  • Loading branch information
Carreau authored Oct 2, 2023
2 parents 6824f26 + 16fb4b7 commit a077b0b
Show file tree
Hide file tree
Showing 19 changed files with 503 additions and 167 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ jobs:
name: doc-bundles
path: ~/.papyri/data/

- name: Test with pytest
run: |
pip install scipy
pytest --cov=papyri --cov-append
ls -al
- name: Misc cli
run: |
coverage run -m papyri --help
coverage run -a -m papyri --help
ls -al
- name: Ingest
run: |
Expand All @@ -121,11 +126,6 @@ jobs:
coverage run -a -m papyri render --ascii
ls -al
- name: Test with pytest
run: |
pip install scipy
pytest --cov=papyri --cov-append
ls -al
- name: Convert .coverage sql to xml for upload
run: |
coverage report
Expand Down
13 changes: 11 additions & 2 deletions examples/IPython.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ execute_exclude_patterns = [
exclude = []
[global.expected_errors]
IncorrectInternalDocsLen = [
"IPython.core.magics.namespace:NamespaceMagics.xdel",
"IPython.core.magics.namespace:NamespaceMagics.xdel",
]
TextSignatureParsingFailed = [
"IPython.core.guarded_eval:SelectivePolicy",
"IPython.core.oinspect:OInfo",
"IPython.terminal.shortcuts:RuntimeBinding",
"IPython.terminal.shortcuts:BaseBinding",
"IPython.terminal.shortcuts:Binding",
"IPython.utils.timing:clock2",
"IPython.utils.timing:timings",
"IPython.utils.timing:timings_out",
]

[global.implied_imports]
get_ipython = 'IPython:get_ipython'

Expand Down
7 changes: 7 additions & 0 deletions examples/scipy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pypi = 'scipy'
homepage = 'https://scipy.org/'
docspage = 'https://docs.scipy.org/doc/scipy/'
[global.implied_imports]
scipy = 'scipy'
ua = 'scipy._lib.uarray'
array = 'numpy:array'
arange = 'numpy:arange'
Expand Down Expand Up @@ -100,6 +101,10 @@ VisitCitationReferenceNotImplementedError = [
"scipy.optimize._nonlin:Anderson",
"scipy.spatial._spherical_voronoi:calculate_solid_angles",
"scipy.special._orthogonal:_pbcf",
"scipy.special._orthogonal",
"scipy.optimize._lsq.dogbox",
"scipy.optimize._lsq.trf",
"scipy.stats._levy_stable:levy_stable_gen",
]
IncorrectInternalDocsLen = [
"scipy.signal._spline:symiirorder1",
Expand Down Expand Up @@ -146,6 +151,8 @@ NumpydocParseError = [
"scipy.stats._discrete_distns:betabinom_gen",
"scipy.stats._discrete_distns:geom_gen",
"scipy.stats._discrete_distns:planck_gen",
"scipy.special:btdtr",
"scipy.special:btdtri",
]
ExampleError1 = [
"scipy.stats._qmc:PoissonDisk",
Expand Down
4 changes: 2 additions & 2 deletions papyri/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
points via aliases; in the intro one link as a ``name <value>`` syntax which
is also not yet recognized.
`scipy.signal.filter_design.zpk2sos`:
`scipy.signal.zpk2sos`:
multi blocks in enumerated list
`scipy.signal.filter_design.zpk2sos`:
Expand All @@ -141,7 +141,7 @@
`numpy.einsum`:
one of the longest numpy docstring/document, or at least one of the longest to render, with
`scipy.signal.windows.windows.dpss` , `scipy.optimize._minimize.minimize` and
`scipy.signal.windows.dpss` , `scipy.optimize._minimize.minimize` and
`scipy.optimize._basinhopping.basinhopping`
Expand Down
2 changes: 1 addition & 1 deletion papyri/ascii.tpl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
{{-green("green")}} refer to items within the same document, {{blue("blue")}} external {{underline("known")}} entities, {{red("red")}} entities we were not able to find and {{yellow("yellow")}} for code, and other "raw" items, typically between double backticks.

{% if doc.signature %}
|{{ bold(underline(doc.signature.value))}}
|{{bold(underline(name))}}{{bold(underline(doc.signature.to_signature()))}}
{% endif %}

{% for section in doc.content if doc.content[section] %}
Expand Down
4 changes: 2 additions & 2 deletions papyri/crosslink.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
from .config import ingest_dir
from .gen import DocBlob, normalise_ref
from .graphstore import GraphStore, Key
from .signature import SignatureNode
from .take2 import (
Param,
RefInfo,
Fig,
Section,
SeeAlsoItem,
Signature,
encoder,
TocTree,
)
Expand Down Expand Up @@ -87,7 +87,7 @@ class IngestedBlobs(Node):
aliases: List[str]
example_section_data: Section
see_also: List[SeeAlsoItem] # see also data
signature: Signature
signature: Optional[SignatureNode]
references: Optional[List[str]]
qa: str
arbitrary: List[Section]
Expand Down
4 changes: 4 additions & 0 deletions papyri/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ class IncorrectInternalDocsLen(AssertionError):
pass


class TextSignatureParsingFailed(ValueError):
pass


class NumpydocParseError(ValueError):
pass

Expand Down
7 changes: 6 additions & 1 deletion papyri/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@
"""

from typing import Optional, Union

def example1(pos, only, /, var, args, *, kwargs, also=None):

def example1(
pos: int, only: None, /, var: Union[float, bool], args=1, *, kwargs, also=None
) -> Optional[str]:
"""
first example.
Expand All @@ -56,6 +60,7 @@ def example1(pos, only, /, var, args, *, kwargs, also=None):
... plt.show()
"""
return "ok"


def example2():
Expand Down
Loading

0 comments on commit a077b0b

Please sign in to comment.