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

242 improve documentation #256

Merged
merged 3 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,12 @@ summary_id = job.summary_details["summary_id"]
# Retrieve the summary
summary = retrieve_summary(summary_id=summary_id)

# Get all information from the retrieved summary
for k, v in summary.__dict__.items():
print(f"{k}: {v}")

# Get the summary as one block of text
for k, v in summary.summary.items():
print(f"Summary Length: {k}")
print(f"Summary: {v['structured_summary'][0].summary}")
# Get the summary as a human-readable string
print(summary.get_formatted_summary())

# Save the json object to a file
with open("wordcab_summary.json", "w") as f:
f.write(summary)
```

# Documentation
Expand Down
21 changes: 20 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
"""Sphinx configuration."""

import toml # type: ignore


with open("../pyproject.toml") as f:
pyproject = toml.load(f)

project = "Wordcab Python"
author = "Wordcab"
copyright = "2022, The Wordcab Team"
copyright = "2022-2023, The Wordcab Team"

version = pyproject["tool"]["poetry"]["version"]
release = version

html_title = f"{project} v{version}"
html_last_updated_fmt = "%Y-%m-%d"

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_click",
"sphinx_copybutton",
"myst_parser",
]

autodoc_typehints = "description"

exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

html_theme = "furo"
16 changes: 15 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,26 @@ end-before: <!-- github-only -->
---
hidden:
maxdepth: 2
caption: Getting Started
name: getting-started
---

usage
reference
contributing
Code of Conduct <codeofconduct>
License <license>
Changelog <https://github.com/Wordcab/wordcab-python/releases>
```

```{toctree}
---
hidden:
maxdepth: 2
caption: API Reference
name: api-reference
---

reference/simple_functions
reference/client
reference/core_objects
```
207 changes: 0 additions & 207 deletions docs/reference.md

This file was deleted.

23 changes: 23 additions & 0 deletions docs/reference/client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Client

The client object is the main interface to the API. You can use it to access all API endpoints.

```python
from wordcab import Client

client = Client()
stats = client.get_stats()

# Run with a context manager
with Client() as client:
stats = client.get_stats()

# Run with a context manager and a custom API key
with Client(api_key="my_api_key") as client:
stats = client.get_stats()
```

```{eval-rst}
.. autoclass:: wordcab.Client
:members:
```
Loading