Skip to content
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
5 changes: 1 addition & 4 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@ runs:
run: curl -LsSf https://astral.sh/uv/install.sh | sh
shell: bash
- name: Install dependencies
run: |
uv venv
uv pip sync requirements.txt
uv add ruff
run: uv sync --extra dev
shell: bash
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ uv run ruff check .
uv run mypy .
```

## Running docs suite
```sh
flask --app docs/app --debug run --host 0.0.0.0
```

## Submitting Pull Requests

1. Commit your changes with a clear and descriptive commit message. Please try to follow the [Conventional Commits](https://www.conventionalcommits.org/) specification if possible.
Expand Down
211 changes: 107 additions & 104 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -1,106 +1,109 @@
{
"version": "0.2",
"language": "en,sv",
"allowCompoundWords": true,
"ignorePaths": [
"requirements.txt",
"ba.code-workspace",
"**/*.nix",
"pyproject.toml",
],
"words": [
"adformat",
"adid",
"adout",
"adsize",
"adtitle",
"adtype",
"blocket",
"companyad",
"direnv",
"httpx",
"incarousel",
"lagenheter",
"monokai",
"mypy",
"notinapp",
"opblock",
"ppid",
"pydantic",
"pymdownx",
"pyproject",
"pytest",
"qasa",
"recommerce",
"respx",
"schenvhash",
"stjacka",
"venv",
"ekey",
"pmce",
"oweb",
"uptodate",
"noti",
"dedup",
"uptodate",
"noti",
"MESG",
"AIWAYS",
"SIDDELEY",
"HEALEY",
"AUTOBIANCHI",
"CUPRA",
"TOMASO",
"DESOTO",
"DFSK",
"FISKER",
"HEINKEL",
"HONGQI",
"INFINITI",
"IVECO",
"LEVC",
"LYNK",
"MAXUS",
"SIMCA",
"XPENG",
"ZEEKR",
"ABARTH",
"Tamagotchi",
"AGIRRA",
"AIXAM",
"BAJAJ",
"BAOTIAN",
"BENDA",
"BENGHE",
"BIMOTA",
"HOSS",
"BUELL",
"CAGIVA",
"CFMOTO",
"ENERGICA",
"HYOSUNG",
"JAWA",
"KYMCO",
"LAMBRETTA",
"LIFAN",
"LIGIER",
"GUZZI",
"AGUSTA",
"PIAGGIO",
"QINGQI",
"QUADRO",
"RIEJU",
"ROMET",
"SHERCO",
"SOCO",
"TOMOS",
"VIARELLI",
"VOGE",
"YADEA",
"ADLY",
"elts",
"Avant",
"TFSI",
"quattro",
],
"version": "0.2",
"language": "en,sv",
"allowCompoundWords": true,
"ignorePaths": [
"requirements.txt",
"ba.code-workspace",
"**/*.nix",
"pyproject.toml"
],
"words": [
"adformat",
"adid",
"adout",
"adsize",
"adtitle",
"adtype",
"blocket",
"companyad",
"direnv",
"httpx",
"incarousel",
"lagenheter",
"monokai",
"mypy",
"notinapp",
"opblock",
"ppid",
"pydantic",
"pymdownx",
"pyproject",
"pytest",
"qasa",
"recommerce",
"respx",
"schenvhash",
"stjacka",
"venv",
"ekey",
"pmce",
"oweb",
"uptodate",
"noti",
"dedup",
"uptodate",
"noti",
"MESG",
"AIWAYS",
"SIDDELEY",
"HEALEY",
"AUTOBIANCHI",
"CUPRA",
"TOMASO",
"DESOTO",
"DFSK",
"FISKER",
"HEINKEL",
"HONGQI",
"INFINITI",
"IVECO",
"LEVC",
"LYNK",
"MAXUS",
"SIMCA",
"XPENG",
"ZEEKR",
"ABARTH",
"Tamagotchi",
"AGIRRA",
"AIXAM",
"BAJAJ",
"BAOTIAN",
"BENDA",
"BENGHE",
"BIMOTA",
"HOSS",
"BUELL",
"CAGIVA",
"CFMOTO",
"ENERGICA",
"HYOSUNG",
"JAWA",
"KYMCO",
"LAMBRETTA",
"LIFAN",
"LIGIER",
"GUZZI",
"AGUSTA",
"PIAGGIO",
"QINGQI",
"QUADRO",
"RIEJU",
"ROMET",
"SHERCO",
"SOCO",
"TOMOS",
"VIARELLI",
"VOGE",
"YADEA",
"ADLY",
"elts",
"Avant",
"TFSI",
"quattro",
"htmx",
"htpy",
"orgid"
]
}
Empty file added docs/__init__.py
Empty file.
9 changes: 0 additions & 9 deletions docs/api-reference.md

This file was deleted.

33 changes: 0 additions & 33 deletions docs/api.css

This file was deleted.

71 changes: 71 additions & 0 deletions docs/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import httpx
from flask import Flask, Response

from docs.views import changelog, endpoints, index, python, quickstart

app = Flask(__name__, static_folder="static")

app.add_url_rule("/", "index", index.view)
app.add_url_rule("/quickstart", "quickstart", quickstart.view)
app.add_url_rule("/python", "python", python.view)
app.add_url_rule("/endpoints", "endpoints", endpoints.view)
app.add_url_rule("/changelog", "changelog", changelog.view)

app.add_url_rule("/_/index", "index_fragment", index.fragment_view)
app.add_url_rule("/_/quickstart", "quickstart_fragment", quickstart.fragment_view)
app.add_url_rule("/_/python", "python_fragment", python.fragment_view)
app.add_url_rule("/_/endpoints", "endpoints_fragment", endpoints.fragment_view)
app.add_url_rule("/_/changelog", "changelog_fragment", changelog.fragment_view)


def endpoints_body() -> str:
from docs.components import endpoints as ep_c

spec = httpx.get("https://blocket-api.se/swagger/openapi.json", timeout=10).json()
return str(ep_c.render(spec))


app.add_url_rule("/_/endpoints-body", "endpoints_body", endpoints_body)


def robots_txt() -> Response:
body = (
"User-agent: *\n"
"Allow: /\n"
"Disallow: /_/\n"
"\n"
"Sitemap: https://blocket-api.se/sitemap.xml\n"
)
return Response(body, mimetype="text/plain")


app.add_url_rule("/robots.txt", "robots_txt", robots_txt)


def sitemap_xml() -> Response:
from docs.components_base import SITE_ROOT

pages = ["", "/quickstart", "/python", "/endpoints", "/changelog"]
urls = "\n".join(f" <url><loc>{SITE_ROOT}{p}</loc></url>" for p in pages)
body = f'<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n{urls}\n</urlset>\n'
return Response(body, mimetype="application/xml")


app.add_url_rule("/sitemap.xml", "sitemap_xml", sitemap_xml)


def changelog_body() -> str:
from docs.components import changelog as cl_c

prs = httpx.get(
"https://api.github.com/repos/dunderrrrrr/blocket_api/pulls",
params={"state": "closed", "per_page": 100},
timeout=10,
).json()
return str(cl_c.render(prs))


app.add_url_rule("/_/changelog-body", "changelog_body", changelog_body)

if __name__ == "__main__":
app.run(debug=True)
Empty file added docs/components/__init__.py
Empty file.
Loading
Loading