Skip to content
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

Python API docs not available #530

Open
bittner opened this issue Nov 18, 2022 · 3 comments
Open

Python API docs not available #530

bittner opened this issue Nov 18, 2022 · 3 comments

Comments

@bittner
Copy link
Contributor

bittner commented Nov 18, 2022

  • YubiKey Manager (ykman) version: 5.0.0
  • How was it installed?: pip install yubikey-manager (latest from PyPI)
  • Operating system and version: Ubuntu Linux 18.04.6 LTS Bionic (and higher)
  • YubiKey model and version: YubiKey 5 NFC (5.4.3)
  • Bug description summary: Python API docs not available

Steps to reproduce

  1. Go to Developer.yubico.com
  2. Find the yubikey-manager documentation
  3. There are not Python API docs, only a chapter with examples

Expected result

For a good developer experience it would be helpful to have a complete API documentation.

Actual results and logs

As a developer, I have to consult the source code, as an alternative, to understand how the Python package can be used.

Other info

Potential role model: Click documentation

@dmarinuswoodwing
Copy link

dmarinuswoodwing commented Nov 23, 2022

For me the examples don't even work:

>>> from ykman.device import connect_to_device
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'connect_to_device' from 'ykman.device' (/home/dmarinus/.cache/pypoetry/virtualenvs/aws-credential-process-XniAX0gx-py3.10/lib/python3.10/site-packages/ykman/device.py)

In the meantime I'm using this:

def ykman_main(*args):
    """
    Helper function for ykman (yubikey manager)
    """
    stdout = io.StringIO()
    stderr = io.StringIO()
    with contextlib.redirect_stderr(stderr):
        with contextlib.redirect_stdout(stdout):
            try:
                ykman._cli.__main__.cli.main(args=args)
            except SystemExit:
                pass
    return stdout.getvalue().splitlines(), stderr.getvalue().splitlines()

Because the end-user documentation is at least clear to me.

Please include this as an API and I think you'd help a lot of people.

See also: #425

@bittner
Copy link
Contributor Author

bittner commented Nov 28, 2022

@dmarinuswoodwing I opened #532 as a dedicated issue for the non-working examples.

@dainnilsson
Copy link
Member

API documentation is available at https://developers.yubico.com/yubikey-manager/API_Documentation/

There is certainly still room for improvement, but it's a lot better than it used to be!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants