Skip to content

Commit

Permalink
docs(python-sdk): generate documentation and api reference with `mkdo…
Browse files Browse the repository at this point in the history
…cs` (#49)

Adds basic documentation.
  • Loading branch information
Lasse-numerous authored Oct 28, 2024
1 parent 2162627 commit 17fbca5
Show file tree
Hide file tree
Showing 31 changed files with 99 additions and 308 deletions.
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# .readthedocs.yaml
version: 2

mkdocs:
configuration: mkdocs.yml

build:
os: "ubuntu-22.04"
tools:
python: "3.12"

python:
install:
- method: pip
path: .
extra_requirements:
- dev # Install dev dependencies as well
File renamed without changes.
62 changes: 62 additions & 0 deletions docs/collections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Persistence with Collections

With Numerous Collections, you can persist (or save) data for your application.
Collections acts as a schemaless database, where users can store, retrieve, and search data in a simple and flexible way.

1. Organize data in collections, indexed with user-specified keys.
2. Store documents with JSON data (optionally indexed with user-specified keys).
3. Store files (optionally indexed with user-specified keys).
4. Tag documents and files with key/value tags, and filter documents and files
by these tags.

!!! info
This feature only supports apps that are deployed to Numerous.

!!! info
Remember to add `numerous` as a dependency in your project; most likely to
your `requirements.txt` file.

## Basic usage

Import the [Numerous SDK](http://www.pypi.org/project/numerous) in your Python
code.

Now, you can add code to your app that is similar to the following:

```python
import numerous

# Refer to a collection by its key
collection = numerous.collection("my-collection")

# Refer to a collection nested inside another collection
nested = collection.collection("nested-collection")

# Refer to a document by its key
document = collection.document("my-document")

# Read a document's data
data = document.get()

# Update a document with new data
data["my-value"] = "new value"
document.set(data)

# Loop over documents in a collection
for doc in collection.documents():
print(doc.key)
print(doc.get())

# Delete a document
document.delete()

# Check if a document exists
if document.exists:
print("document exists")
else:
print("document does not exist")
```

::: numerous.collection.collection
::: numerous.collection.numerous_collection.NumerousCollection
::: numerous.collection.numerous_document.NumerousDocument
16 changes: 16 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
site_name: numerous-sdk docs
nav:
- Home: README.md
- GitHub: https://github.com/numerous-com/numerous-sdk
- API Reference:
- Collections: collections.md


theme: readthedocs
plugins:
- search
- mkdocstrings:
default_handler: "python"
rendering:
show_source: false
show_root_heading: true
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ dev = [
"pydantic==2.9",
"types-setuptools>=74.1.0",
"build==1.2.2",
"mkdocs==1.6.0",
"mkdocstrings==0.26.2",
"mkdocstrings-python==1.12.2",
"mkdocs_snippet_plugin==1.0.2"
]

[project.scripts]
Expand Down
20 changes: 0 additions & 20 deletions python/docs/Makefile

This file was deleted.

35 changes: 0 additions & 35 deletions python/docs/make.bat

This file was deleted.

3 changes: 0 additions & 3 deletions python/docs/requirements.txt

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/modules.rst

This file was deleted.

18 changes: 0 additions & 18 deletions python/docs/source/api/numerous.cli.rst

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.cli.run.rst

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.data_model.rst

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.generated.graphql.client.rst

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.generated.graphql.enums.rst

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions python/docs/source/api/numerous.generated.graphql.rst

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.generated.graphql.updates.rst

This file was deleted.

12 changes: 0 additions & 12 deletions python/docs/source/api/numerous.generated.rst

This file was deleted.

22 changes: 0 additions & 22 deletions python/docs/source/api/numerous.rst

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.session.rst

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.tools.rst

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.updates.rst

This file was deleted.

7 changes: 0 additions & 7 deletions python/docs/source/api/numerous.utils.rst

This file was deleted.

Loading

0 comments on commit 17fbca5

Please sign in to comment.