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

docs: add quartodoc website for documentation #197

Merged
merged 10 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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: 14 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,17 @@ jobs:
cache: 'pip'
- run: make deps
- run: make build

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
check-latest: true
cache: 'pip'
- uses: quarto-dev/quarto-actions/setup@v2
- run: make deps
- run: make dev
- run: make docs
21 changes: 6 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,7 @@ else
PIP := pip3
endif

.PHONY:
build
clean
cov
default
deps
dev
fmt
fix
install
lint
test
uninstall
version
.PHONY: build clean cov default deps dev docs fmt fix install lint test uninstall version

# Default target that runs the necessary steps to build the project
all: deps dev test lint build
Expand Down Expand Up @@ -64,6 +51,10 @@ deps:
dev:
$(PIP) install -e .

# Build documentation.
docs:
$(MAKE) -C ./docs

# Target for fixing linting issues.
fix:
$(PYTHON) -m ruff check --fix
Expand All @@ -87,7 +78,7 @@ test:

# Target for uninstalling the project
uninstall:
$(PIP) uninstall -y $(NAME)
$(PIP) uninstall $(NAME)

# Target for displaying the project version
version:
Expand Down
8 changes: 8 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_extensions/
_inv/
_site/
.quarto/
objects.json
reference/

/.quarto/
27 changes: 27 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.DEFAULT_GOAL := all

# Command aliases
QUARTO=quarto
QUARTODOC=quartodoc

# Targets
.PHONY: clean build deps preview

all: deps build

build:
$(QUARTODOC) build
$(QUARTODOC) interlinks
$(QUARTO) render

clean:
rm -rf _extensions _inv _site .quarto reference objects.json
find . -type d -empty -delete

deps:
$(QUARTO) add --no-prompt machow/quartodoc

preview:
$(QUARTODOC) build
$(QUARTODOC) interlinks
$(QUARTO) preview
68 changes: 68 additions & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
project:
type: website
tdstein marked this conversation as resolved.
Show resolved Hide resolved

website:
title: "Posit SDK"
navbar:
left:
- text: Installation
file: installation.qmd
- text: Quick Start
file: quickstart.qmd
- text: API
file: reference/index.qmd

filters:
- interlinks

format:
html:
theme: cosmo
tdstein marked this conversation as resolved.
Show resolved Hide resolved
toc: true
page-layout: full

interlinks:
sources:
python:
url: https://docs.python.org/3/
requests:
url: https://requests.readthedocs.io/en/latest/

quartodoc:
title: API Reference
style: pkgdown
dir: reference
package: posit
render_interlinks: true
options:
include_classes: true
include_functions: true
include_empty: true
sections:
- title: Clients
package: posit
desc: >
The `Client` is the entrypoint for each Posit product. Initialize a `Client` to get started.
contents:
- name: connect.Client
members:
# methods
- request
- get
- post
- put
- patch
- delete
- title: Posit Connect Resources
package: posit
contents:
- connect.bundles
- connect.content
- connect.permissions
- connect.tasks
- connect.users
- title: Posit Connect Metrics
package: posit
contents:
- connect.metrics
- connect.metrics.usage
7 changes: 7 additions & 0 deletions docs/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "Posit SDK for Python"
tdstein marked this conversation as resolved.
Show resolved Hide resolved
---

> A Pythonic interface for developers to work with Posit's professional products. It's lightweight and expressive.
tdstein marked this conversation as resolved.
Show resolved Hide resolved

Welcome to Posit's SDK for Python documentation! Get started with [Installation](./installation.qmd) and then check out [Quickstart](./quickstart.qmd). A full API reference is available in the [API](./reference/index.qmd) section.
tdstein marked this conversation as resolved.
Show resolved Hide resolved
27 changes: 27 additions & 0 deletions docs/installation.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "Installation"
format: html
toc: true
toc-title: "Contents"
toc-depth: 2
---

# Python Version
tdstein marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Python Version
# Python version


We recommend using the latest version of Python avaiable to you. The Posit SDK supports Python 3.8 and newer.
tdstein marked this conversation as resolved.
Show resolved Hide resolved

# Dependencies

These dependencies are installed automatically during installation.

- [Requests](https://requests.readthedocs.io/en/latest/) provides the HTTP layer.

# Install Posit's SDK
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Install Posit's SDK
# Install the Posit SDK


Use the following command to install Posit's SDK
tdstein marked this conversation as resolved.
Show resolved Hide resolved

```bash
$ pip install posit-SDK
```

The SDK is now installed. Check out the [Quickstart](./quickstart.qmd).
tdstein marked this conversation as resolved.
Show resolved Hide resolved
56 changes: 56 additions & 0 deletions docs/quickstart.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: "Quickstart"
format: html
toc: true
toc-title: "Contents"
toc-depth: 2
---

# Setup

After [installing](./installation.qmd) the SDK, you need to import it. Here's a simple example of to get you started.
tdstein marked this conversation as resolved.
Show resolved Hide resolved

```python
>>> import posit
```

# Basic Usage
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Basic Usage
# Basic usage


## Initialize a Client
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Initialize a Client
## Initialize a client


To get started, initialize a Client to work with your Posit products. For this example, we will work with Posit Connect.
tdstein marked this conversation as resolved.
Show resolved Hide resolved

::: {.callout-warning}
Keeping your API key secret is essential to protect your application's security, prevent unauthorized access and usage, and ensure data privacy and regulatory compliance. By default, the API key is read from the `CONNECT_API_KEY` environment variable when it isn't provided in the Client initialization.
:::


```python
>>> from posit import connect
>>> client = connect.Client(api_key="btOVKLXjt8CoGP2gXvSuTqu025MJV4da", url="https://connect.example.com")
```

## Who am I?

Your API key is your secret identity. Now that we're connected, let's double check our username.

```python
>>> client.me.username
'gandalf'
```

## How much content do I have access to?

One of the best features of Connect is the ability to share incredible content with your peers. Let's see just how much content we have access to!
tdstein marked this conversation as resolved.
Show resolved Hide resolved

```python
>>> client.content.count()
5754
```

Voilà! I have a whopping 5,754 pieces of content to browse.


# Next Steps
tdstein marked this conversation as resolved.
Show resolved Hide resolved

Check out the [API](./reference/index.qmd) for a full API reference.
tdstein marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pandas
pre-commit
pyjson5
pytest
quartodoc
responses
ruff
setuptools
Expand Down
4 changes: 4 additions & 0 deletions src/posit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
"""The Posit SDK."""

from . import connect # noqa

__all__ = "connect"
Loading
Loading