question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docs: standardize how we refer to methods in docstrings

See original GitHub issue

Current behavior: Currently we use several different ways to refer to methods, objects and arguments in the Metadata API and ngclient docstrings. Examples:

:func:`~tuf.ngclient.updater.Updater.refresh()`    # creates a clickable link in RTD, is ugly in source
Updater.refresh()    # does not stand out from text in either RTD or source code
`Updater.refresh()`    # does not stand out from text in RTD
``Updater.refresh()``    # is rendered as "inline code" in RTD

This has been partially on purpose to see what these all look like (both in published docs and in code).

Expected behavior:

Ideally we should be consistent and follow the coding style guidelines (which somewhat reasonably argue against the sphinx links). The chosen method should be useful in the published docs and not ruin the docstring readability in source code. We’d want to apply the style in docstrings in tuf/api/ and tuf/ngclient/ (as those are used to produce the ReadTheDocs api docs).

After seeing all options I think I lean on using ``refresh()``: it creates a distinct rendering on ReadTheDocs and does not ruin the docstring readability in source code like the sphinx link format does. It does not create a clickable link but usually docstring text does not need that.

https://github.com/theupdateframework/python-tuf/pull/1590 has many examples of using this format.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jkucommented, Oct 21, 2021

oops, so I did 😃 carry on then

0reactions
lukpuehcommented, Mar 16, 2022

@ivanayov made an effort to consolidate how we refer to methods etc. in this project (see #1856 and #1815 - thanks!). I’d say the this is now captured by the implicit code style “be consistent” and does not require an explicit recommendation in the style guide. Closing…

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 257 – Docstring Conventions
The aim of this PEP is to standardize the high-level structure of docstrings: what they should contain, and how to say it (without...
Read more >
Standardization of Code Format and Documentation
We use black-formatter, flake8-docstrings and isort to format our code. ... formatted documentation will be more helpful, and that's what we ...
Read more >
What is the standard Sphinx documentation format for a ...
I am trying to document my method using a standard format, but in my search I found many "standard" ways of documenting methods....
Read more >
Python Docstrings Tutorial : Examples & Format for Pydoc ...
Docstrings are string literals that occur as the first statement in a module, function, class, or method definition. They are used to provide...
Read more >
Documenting Python code · The COOP Blog - Cerfacs
It also intends to standardize the documentation writing within COOP, so we can ensure our projects follow high quality standards.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found