Generating documentation with Sphinx
I have two questions, please (this is after reading https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html#automatically-label-sections ). This is my project structure: my_project api stuff1.py stuff2.py lib stuff3.py stuff4.py main_application.py In my_project/main_application.py I have two functions: def construct_response(exit_code: int, message: str) -> Response: """ Construct a Flask-suitable response :param exit_code: 0 or something else :param message: something useful :return: a Flask-suitable response """ @app.route(f"/{version}/", methods=[GET, POST]) def serve(page) -> Response: """ Do some stuff and return 200 or 500 :param page: this is a REST endpoint we are advertising to callers :return: a Flask Response generated by construct_response """ Question 1: how do I embed in the serve function docstring a link to the construct_response function? Question 2: how do I embed in, for example, lib/stuff3.py, a link to the construct_response function? I tried: :ref:`my_project/api/stuff1:construct_response` but that gives an undefined label warning. -- https://mail.python.org/mailman/listinfo/python-list
Co-op Group: Django web framework
Are you interested in learning Django? Would like to improve your Django knowledge and skills? Have you been picking-up Django piecemeal, and need to consolidate and clarify? Do you know some Django and would like to acquire mentoring and coaching skills? If so, please join us to form a Learning Django Co-op. RSVP at https://www.meetup.com/nzpug-auckland/events/295727130/ -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: Generating documentation with Sphinx
> > def construct_response(exit_code: int, message: str) -> Response: > """ > Construct a Flask-suitable response > > :param exit_code: 0 or something else > :param message: something useful > :return: a Flask-suitable response > """ > > > @app.route(f"/{version}/", methods=[GET, POST]) > def serve(page) -> Response: > """ > Do some stuff and return 200 or 500 > > :param page: this is a REST endpoint we are advertising to callers > :return: a Flask Response generated by construct_response > """ > > > Question 1: how do I embed in the serve function docstring a link to the > construct_response function? > > > Question 2: how do I embed in, for example, lib/stuff3.py, a link to the > construct_response function? > > > I tried: > :ref:`my_project/api/stuff1:construct_response` > > but that gives an undefined label warning. > I can answer my own Question 1: :func:`construct_response` -- https://mail.python.org/mailman/listinfo/python-list
Re: Generating documentation with Sphinx
And I can answer my own Question 2: :func:`my_project.main_application.construct_response` On Mon, Aug 28, 2023 at 1:39 PM Jason Friedman wrote: > def construct_response(exit_code: int, message: str) -> Response: >> """ >> Construct a Flask-suitable response >> >> :param exit_code: 0 or something else >> :param message: something useful >> :return: a Flask-suitable response >> """ >> >> >> @app.route(f"/{version}/", methods=[GET, POST]) >> def serve(page) -> Response: >> """ >> Do some stuff and return 200 or 500 >> >> :param page: this is a REST endpoint we are advertising to callers >> :return: a Flask Response generated by construct_response >> """ >> >> >> Question 1: how do I embed in the serve function docstring a link to the >> construct_response function? >> >> >> Question 2: how do I embed in, for example, lib/stuff3.py, a link to the >> construct_response function? >> >> >> I tried: >> :ref:`my_project/api/stuff1:construct_response` >> >> but that gives an undefined label warning. >> > > I can answer my own Question 1: > :func:`construct_response` > -- https://mail.python.org/mailman/listinfo/python-list
Re: Generating documentation with Sphinx
def construct_response(exit_code: int, message: str) -> Response: >> """ >> Construct a Flask-suitable response >> >> :param exit_code: 0 or something else >> :param message: something useful >> :return: a Flask-suitable response >> """ >> >> >> @app.route(f"/{version}/", methods=[GET, POST]) >> def serve(page) -> Response: >> """ >> Do some stuff and return 200 or 500 >> >> :param page: this is a REST endpoint we are advertising to callers >> :return: a Flask Response generated by construct_response >> """ >> >> >> Question 1: how do I embed in the serve function docstring a link to the >> construct_response function? >> >> >> Question 2: how do I embed in, for example, lib/stuff3.py, a link to the >> construct_response function? >> >> >> I tried: >> :ref:`my_project/api/stuff1:construct_response` >> >> but that gives an undefined label warning. >> > > I can answer my own Question 1: > :func:`construct_response` > And I can answer my own Question 2: :func:`my_project.main_application.construct_response` -- https://mail.python.org/mailman/listinfo/python-list