Opened 2 years ago
Last modified 2 months ago
#27578 new defect
Use sphinx.util.inspect.Signature not sphinx.ext.autodoc.inspector.formatargspec
Reported by: | jhpalmieri | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | sage-9.5 |
Component: | documentation | Keywords: | sphinx, formatargspec, Signature |
Cc: | fbissey, jdemeyer, slelievre, strogdon | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
After upgrading to Sphinx 1.8.5 in #26451, Sphinx's function formatargspec
is deprecated, so we should not use anymore it in src/sage_setup/docbuild/ext/sage_autodoc.py
.
The deprecation warning advises to replace the use of sphinx.ext.autodoc.inspector.formatargspec
by that of sphinx.util.inspect.Signature
.
For ordinary Python functions, we may be able to change formatargspec(my_func, *argspec)
to Signature(my_func).format_args()
. I don't think this works with Cython functions, though.
Change History (14)
comment:1 Changed 2 years ago by
comment:2 Changed 2 years ago by
Sphinx has its own Signature
class (in sphinx.util.inspect
), and that's what I was thinking about using.
comment:3 Changed 2 years ago by
- Cc fbissey added
comment:4 Changed 2 years ago by
- Cc strogdon added
comment:5 Changed 2 years ago by
- Cc slelievre added
- Keywords sphinx formatargspec Signature added
- Summary changed from Don't use sphinx.ext.autodoc.inspector.formatargspec anymore to Use sphinx.util.inspect.Signature not sphinx.ext.autodoc.inspector.formatargspec
comment:6 Changed 2 years ago by
- Cc jdemeyer added
- Description modified (diff)
comment:7 Changed 2 years ago by
The proposed changes at #27971 get rid of the deprecation warnings. We can leave this open in case it is worthwhile to use Sphinx's Signature
or Python 3's Signature
. (And maybe we should use those in sageinspect.py
, too?)
comment:8 Changed 2 years ago by
- Milestone changed from sage-8.8 to sage-8.9
Moving open critical and blocker issues to the next release milestone (optimistically).
comment:9 Changed 21 months ago by
- Milestone changed from sage-8.9 to sage-9.1
Ticket retargeted after milestone closed
comment:10 Changed 17 months ago by
- Milestone changed from sage-9.1 to sage-9.2
comment:11 Changed 13 months ago by
- Milestone changed from sage-9.2 to sage-9.3
comment:12 Changed 7 months ago by
See also: #31309 sage_getargspec
mishandles keyword-only arguments
comment:13 Changed 6 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.
comment:14 Changed 2 months ago by
- Milestone changed from sage-9.4 to sage-9.5
The
Signature
class is new in Python 3, though there exists a backport of it for Python 2 so we'd have to add the backport as a depency so long as we still support Python 2. Obviously adding the backport is no big deal. I've used it before and it works fine. It's not a bad idea, since theSignature
interface is much nicer in general thaninspect.getargspec
.