Skip to content

Commit

Permalink
Add docs (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Oct 17, 2024
1 parent 992af44 commit dc47e23
Show file tree
Hide file tree
Showing 19 changed files with 283 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish Python docs

# Only run on new tags starting with `py-v`
on:
push:
tags:
- "py-v*"
workflow_dispatch:

# https://stackoverflow.com/a/77412363
permissions:
contents: write
pages: write

jobs:
build:
name: Deploy Python docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# We need to additionally fetch the gh-pages branch for mike deploy
with:
fetch-depth: 0

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Set up Python 3.11
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
version: "0.4.x"

- name: Install dependencies
run: uv sync

- name: Build python packages
run: |
uv run maturin develop -m object-store-rs/Cargo.toml
- name: Deploy docs
env:
GIT_COMMITTER_NAME: CI
GIT_COMMITTER_EMAIL: [email protected]
run: |
# Get most recent git tag
# https://stackoverflow.com/a/7261049
# https://stackoverflow.com/a/3867811
# We don't use {{github.ref_name}} because if triggered manually, it
# will be a branch name instead of a tag version.
# Then remove `py-` from the tag
VERSION=$(git describe --tags --match="py-*" --abbrev=0 | cut -c 4-)
# Only push docs if no letters in git tag after the first character
# (usually the git tag will have v as the first character)
if echo $VERSION | cut -c 1- | grep -q "[A-Za-z]"; then
uv run mike deploy $VERSION latest --update-aliases --push
fi
4 changes: 4 additions & 0 deletions docs/api/copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copy

::: object_store_rs.copy
::: object_store_rs.copy_async
2 changes: 2 additions & 0 deletions docs/api/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: object_store_rs.delete
::: object_store_rs.delete_async
10 changes: 10 additions & 0 deletions docs/api/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Get

::: object_store_rs.get
::: object_store_rs.get_async
::: object_store_rs.get_range
::: object_store_rs.get_range_async
::: object_store_rs.get_ranges
::: object_store_rs.get_ranges_async
::: object_store_rs.GetOptions
::: object_store_rs.GetResult
4 changes: 4 additions & 0 deletions docs/api/head.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Head

::: object_store_rs.head
::: object_store_rs.head_async
8 changes: 8 additions & 0 deletions docs/api/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List

::: object_store_rs.list
::: object_store_rs.list_async
::: object_store_rs.list_with_delimiter
::: object_store_rs.list_with_delimiter_async
::: object_store_rs.ObjectMeta
::: object_store_rs.ListResult
4 changes: 4 additions & 0 deletions docs/api/put.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Put

::: object_store_rs.put_file
::: object_store_rs.put_file_async
4 changes: 4 additions & 0 deletions docs/api/rename.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Rename

::: object_store_rs.rename
::: object_store_rs.rename_async
6 changes: 6 additions & 0 deletions docs/api/sign.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Sign

::: object_store_rs.sign_url
::: object_store_rs.sign_url_async
::: object_store_rs.SignCapableStore
::: object_store_rs.HTTP_METHOD
4 changes: 4 additions & 0 deletions docs/api/store/aws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# AWS S3

::: object_store_rs.store.S3Store
::: object_store_rs.store.S3ConfigKey
4 changes: 4 additions & 0 deletions docs/api/store/azure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Microsoft Azure

::: object_store_rs.store.AzureStore
::: object_store_rs.store.AzureConfigKey
5 changes: 5 additions & 0 deletions docs/api/store/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Configuration

::: object_store_rs.store.ClientConfigKey
::: object_store_rs.store.BackoffConfig
::: object_store_rs.store.RetryConfig
4 changes: 4 additions & 0 deletions docs/api/store/gcs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Google Cloud Storage

::: object_store_rs.store.GCSStore
::: object_store_rs.store.GCSConfigKey
3 changes: 3 additions & 0 deletions docs/api/store/http.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# HTTP

::: object_store_rs.store.HTTPStore
3 changes: 3 additions & 0 deletions docs/api/store/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ObjectStore

::: object_store_rs.store.ObjectStore
3 changes: 3 additions & 0 deletions docs/api/store/local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Local

::: object_store_rs.store.LocalStore
3 changes: 3 additions & 0 deletions docs/api/store/memory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Memory

::: object_store_rs.store.MemoryStore
1 change: 1 addition & 0 deletions docs/index.md
145 changes: 145 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
site_name: object-store-rs
repo_name: developmentseed/object-store-rs
repo_url: https://github.com/developmentseed/object-store-rs
site_description: A Python interface and pyo3 integration to the Rust object-store crate.
site_author: Development Seed
# Note: trailing slash recommended with mike:
# https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/#publishing-a-new-version
site_url: https://developmentseed.org/object-store-rs/
docs_dir: docs

extra:
social:
- icon: "fontawesome/brands/github"
link: "https://github.com/developmentseed"
- icon: "fontawesome/brands/twitter"
link: "https://twitter.com/developmentseed"
- icon: "fontawesome/brands/medium"
link: "https://medium.com/devseed"
version:
provider: mike

nav:
- "index.md"
- API Reference:
- store:
- api/store/index.md
- api/store/aws.md
- api/store/azure.md
- api/store/gcs.md
- api/store/http.md
- api/store/local.md
- api/store/memory.md
- api/store/config.md
- api/copy.md
- api/delete.md
- api/get.md
- api/head.md
- api/list.md
- api/put.md
- api/rename.md
- api/sign.md

watch:
- object-store-rs/python
- docs

theme:
name: material
palette:
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode

# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
primary: indigo
accent: indigo
toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: indigo
accent: indigo
toggle:
icon: material/brightness-4
name: Switch to system preference

font:
text: Roboto
code: Roboto Mono

features:
- content.code.annotate
- content.code.copy
- navigation.indexes
- navigation.instant
- navigation.tracking
- search.suggest
- search.share

plugins:
- search
- social
- mike:
alias_type: "copy"
canonical_version: "latest"
- mkdocstrings:
enable_inventory: true
handlers:
python:
paths: [object-store-rs/python]
options:
# We set allow_inspection: false to ensure that all docstrings come
# from the pyi files, not the Rust-facing doc comments.
allow_inspection: false
docstring_section_style: list
docstring_style: google
line_length: 80
separate_signature: true
show_root_heading: true
show_signature_annotations: true
show_source: false
show_symbol_type_toc: true
signature_crossrefs: true
extensions:
- griffe_inherited_docstrings

import:
- https://docs.python.org/3/objects.inv

# https://github.com/developmentseed/titiler/blob/50934c929cca2fa8d3c408d239015f8da429c6a8/docs/mkdocs.yml#L115-L140
markdown_extensions:
- admonition
- attr_list
- codehilite:
guess_lang: false
- def_list
- footnotes
- md_in_html
- pymdownx.arithmatex
- pymdownx.betterem
- pymdownx.caret:
insert: false
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.escapeall:
hardbreak: true
nbsp: true
- pymdownx.magiclink:
hide_protocol: true
repo_url_shortener: true
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde
- toc:
permalink: true

0 comments on commit dc47e23

Please sign in to comment.