Skip to content

Commit

Permalink
Document everything
Browse files Browse the repository at this point in the history
  • Loading branch information
gingershaped committed Oct 22, 2024
1 parent 01ae6ac commit e5342ce
Show file tree
Hide file tree
Showing 23 changed files with 1,132 additions and 666 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replit.nix
.config/
venv/
*.sh
docs/build
site/
dist/
.vscode/
/*.py
16 changes: 16 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "2"

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

python:
install:
- method: pip
path: .
extra_requirements:
- docs

mkdocs:
configuration: mkdocs.yml
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

11 changes: 11 additions & 0 deletions docs/api/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Event reference

::: sechat.events.EventType
options:
show_root_heading: true
show_root_toc_entry: true

::: sechat.events
options:
filters:
- "!EventType"
7 changes: 7 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# API reference

::: sechat

## Errors

::: sechat.errors
2 changes: 0 additions & 2 deletions docs/build-requirements.txt

This file was deleted.

27 changes: 27 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# About

**sechat** (usually referred to in monospace to distinguish it from the platform it's designed for, e.g. `sechat`) is an asynchronous Python client for the [Stack Exchange](https://stackexchange.net) Q&A website network's [custom-built chat service](https://chat.stackexchange.com), variously referred to as "Stack Exchange chat", "SEchat", and "Bonfire". It is designed for creating automated chatbots to assist with moderation and other rote tasks.

!!! warning
**`sechat` is by nature unstable**, as Stack Exchange chat has no public API and no guarantee of consistency, and the library may need to be updated at any time to accomodate for changes to chat's internals. No part of its API should be assumed to be stable between any two commits.

## Installation
!!! warning
The copy of `sechat` on PyPI is no longer updated due to `sechat`'s always-unstable nature. Do not use it; instead, install directly from GitHub.


To install `sechat`, use your module manager's system for installing from Git repositories. `sechat` is available on GitHub at [https://github.com/gingershaped/sechat], and the `v3` branch should be used.

## Example
```py
import asyncio

from sechat import Credentials, Room

async def main():
credentials = await Credentials.load_or_authenticate("credentials.dat", "<your email address>", "<your password>")
async with Room.join(credentials, 1) as room:
await room.send("Hello World!")

asyncio.run(main())
```
32 changes: 32 additions & 0 deletions docs/javascript/readthedocs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
document.addEventListener("DOMContentLoaded", function (event) {
// Trigger Read the Docs' search addon instead of Material MkDocs default
document.querySelector(".md-search__input").addEventListener("focus", (e) => {
const event = new CustomEvent("readthedocs-search-show");
document.dispatchEvent(event);
});
});

// Use CustomEvent to generate the version selector
document.addEventListener(
"readthedocs-addons-data-ready",
function (event) {
const config = event.detail.data();
const versioning = `
<div class="md-version">
<button class="md-version__current" aria-label="Select version">
${config.versions.current.slug}
</button>
<ul class="md-version__list">
${ config.versions.active.map(
(version) => `
<li class="md-version__item">
<a href="${ version.urls.documentation }" class="md-version__link">
${ version.slug }
</a>
</li>`).join("\n")}
</ul>
</div>`;

document.querySelector(".md-header__topic").insertAdjacentHTML("beforeend", versioning);
});
35 changes: 0 additions & 35 deletions docs/make.bat

This file was deleted.

6 changes: 6 additions & 0 deletions docs/overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "base.html" %}

{% block site_meta %}
{{ super() }}
<meta name="readthedocs-addons-api-version" content="1" />
{% endblock %}
12 changes: 0 additions & 12 deletions docs/source/api.rst

This file was deleted.

62 changes: 0 additions & 62 deletions docs/source/conf.py

This file was deleted.

26 changes: 0 additions & 26 deletions docs/source/example.rst

This file was deleted.

34 changes: 0 additions & 34 deletions docs/source/index.rst

This file was deleted.

11 changes: 11 additions & 0 deletions docs/stylesheets/readthedocs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:root {
/* Reduce Read the Docs' flyout font a little bit */
--readthedocs-flyout-font-size: 0.7rem;

/* Reduce Read the Docs' notification font a little bit */
--readthedocs-notification-font-size: 0.8rem;

/* This customization is not yet perfect because we can't change the `line-height` yet. */
/* See https://github.com/readthedocs/addons/issues/197 */
--readthedocs-search-font-size: 0.7rem;
}
37 changes: 37 additions & 0 deletions mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
site_name: sechat
site_url: !ENV READTHEDOCS_CANONICAL_URL
repo_url: https://github.com/gingershaped/sechat

theme:
name: material
palette:
scheme: slate

plugins:
- search
- mkdocstrings:
handlers:
python:
import:
- https://docs.python.org/3/objects.inv
- https://typing.readthedocs.io/en/latest/objects.inv
- https://docs.aiohttp.org/en/stable/objects.inv
options:
show_source: false
separate_signature: true
show_signature_annotations: true
signature_crossrefs: true
show_symbol_type_heading: true
show_symbol_type_toc: true
show_root_toc_entry: false
show_root_members_full_path: true
heading_level: 3

markdown_extensions:
- admonition
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.superfences

extra_javascript:
- javascript/readthedocs.js
Loading

0 comments on commit e5342ce

Please sign in to comment.