-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial work on Ice for Python API reference documentation #2535
Conversation
cpp/src/slice2py/PythonUtil.cpp
Outdated
_out << nl << tripleQuotes; | ||
_out << nl << "Immediately marshals the result of an invocation of " << name; | ||
_out << nl << "and returns an object that the servant implementation must return"; | ||
_out << nl << "as its result."; | ||
_out << nl; | ||
_out << nl << "Args:"; | ||
_out << nl << " result: The result (or result tuple) of the invocation."; | ||
_out << nl << " current: The Current object passed to the invocation."; | ||
_out << nl; | ||
_out << nl << "Returns"; | ||
_out << nl << " An object containing the marshaled result."; | ||
_out << nl << tripleQuotes; | ||
_out << nl << "return IcePy.MarshaledResult(result, _M_" << getAbsolute(p) << "._op_" << fixedOpName | ||
<< ", current.adapter.getCommunicator().getImpl(), current.encoding)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update this to use numpy style..
@@ -0,0 +1,20 @@ | |||
# Minimal makefile for Sphinx documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the standard make file for Sphinx generated by sphinx-quickstart
python/modules/IcePy/Endpoint.cpp
Outdated
PyVarObject_HEAD_INIT(0, 0) "IcePy.Endpoint", /* tp_name */ | ||
sizeof(EndpointObject), /* tp_basicsize */ | ||
0, /* tp_itemsize */ | ||
PyVarObject_HEAD_INIT(0, 0) "Ice.Endpoint", /* tp_name */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to revert this change. I was testing the direct exposure of this component as part of the Ice module and documenting it in a .pyi file.
Using the autoapi extension (https://sphinx-autoapi.readthedocs.io/en/latest/) seemed to work initially. However, I reverted to the autodoc extension because autoapi does not support our current generated code due to the conditional class definitions.
@@ -1768,7 +1768,7 @@ IcePy::wrapObjectAdapter(const Ice::ObjectAdapterPtr& adapter) | |||
{ | |||
return nullptr; | |||
} | |||
PyObject* wrapperType = lookupType("Ice.ObjectAdapterI.ObjectAdapterI"); | |||
PyObject* wrapperType = lookupType("Ice._ObjectAdapterI.ObjectAdapterI"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _
prefix is used for private modules. I renamed private classes to use this prefix to help exclude them from the generated documentation.
@@ -2249,8 +2249,7 @@ IcePy::createProxy(const Ice::ObjectPrx& proxy, const Ice::CommunicatorPtr& comm | |||
{ | |||
if (!type) | |||
{ | |||
PyTypeObject* proxyType = &ProxyType; // Necessary to prevent GCC's strict-alias warnings. | |||
type = reinterpret_cast<PyObject*>(proxyType); | |||
type = lookupType("Ice.ObjectPrx"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ice.ObjectPrx is the public base proxy type, it delegates to the parent class IcePy.ObjectPrx.
@@ -183,3 +183,5 @@ def _warn(self, msg): | |||
StateRunning = "running" | |||
StateCancelled = "cancelled" | |||
StateDone = "done" | |||
|
|||
__all__ = ["Future", "wrap_future", "FutureBase"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The all variable specifies the public API and controls what is exposed when using the import * syntax. This prevents duplication warnings during documentation generation by avoiding the re-export of imported items, which would otherwise result in warnings indicating they are defined in multiple places.
python/python/Ice/_CurrentI.py
Outdated
@@ -0,0 +1,45 @@ | |||
|
|||
from .Current import Current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The private implementation of Ice.Current.
@@ -0,0 +1,56 @@ | |||
# Copyright (c) ZeroC, Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied it here because of Ice._ArrayUtil is not exported anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
For LoggerI in file _LoggerI.py, is this naming inconsistency on purpose?
|
||
import IcePy | ||
|
||
class ObjectPrx(IcePy.ObjectPrx): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to use delegation to the C++ object, like for example Communicator. Am I missing something?
python/docs/index.rst
Outdated
Add your content using ``reStructuredText`` syntax. See the | ||
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_ | ||
documentation for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we should delete this snippet?
The |
…ference documentation (zeroc-ice/ice#2535)
This PR updates Ice for Python API docs:
The documentation is generated with sphinx, one of the standard tools for documenting Python projects.
The PR is getting quite large, I want to get some feedback before I add more changes.