Skip to content

Commit

Permalink
📚 DOCS: Fixed doc and added docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Thaza-Kun committed Apr 16, 2023
1 parent 8321f87 commit 2422e4d
Show file tree
Hide file tree
Showing 27 changed files with 844 additions and 366 deletions.
1 change: 0 additions & 1 deletion docs/API/auth.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/API/golongan_kata.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/API/lemma.md

This file was deleted.

2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ perkembangannya dari segi penggunaan, penyelidikan serta pembelajarannya.
!!! note ""

Nama 'samudra' diambil sempena perkataan 'samudera' yang bererti lautan bagi menggambarkan kosa kata seluas lautan.

![](img/model-samudra.png)
3 changes: 1 addition & 2 deletions docs/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ pakej [peewee](http://docs.peewee-orm.com/en/latest/index.html) dan berperanan m
sesama data.

Setiap model tersimpan dalam direktori `samudra/models` dan mewarisi `BaseModel` yang mempunyai dua medan asasi: `id`
dan `tarikh_masuk`. Pengembangan dan perkemasan model sedang dijalankan di
cabang [`expand-model`](https://github.com/Thaza-Kun/samudra/tree/expand-model/samudra).
dan `tarikh_masuk`.

## Data Kamus

Expand Down
68 changes: 0 additions & 68 deletions docs/pemasangan.md

This file was deleted.

21 changes: 8 additions & 13 deletions docs/teras.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,30 @@
Berikut merupakan teknologi teras yang menggerakkan Samudra dari dalam:

1. [Python ^3.8](https://www.python.org/)
- Samudra bahagian pelayan ditulis dalam bahasa Python.
- Teras Samudra ditulis dalam bahasa Python.
2. [Peewee ^3.15.1](http://docs.peewee-orm.com/en/latest/index.html)
- Peewee merupakan pengurus pangkalan data dalam bentuk objek Python (iaitu sejenis ORM) yang ringan dan mudah
digunakan. Setiap data dibentuk sebagai satu [`model`](model.md).
3. [FastAPI ^0.79.0](https://fastapi.tiangolo.com/)
- Fast API merupakan pengurus API yang membantu menghantar data yang diminta pihak pelanggan.
4. [Pydantic ^1.9.1](https://pydantic-docs.helpmanual.io/)
- Pydantic merupakan pengurus bentuk data yang memastikan data yang berpindah dari fungsi ke fungsi atau dari
pangkalan data ke API mematuhi bentuk yang ditakrifkan. Hal ini memastikan datanya kekal berintegriti.
- Peewee membantu Samudra berinteraksi dengan pangkalan data.
Setiap data yang dipetik dari pangkalan data dibentuk sebagai satu [`model`](model.md).
3. [Pydantic ^1.9.1](https://pydantic-docs.helpmanual.io/)
- Pydantic membantu Samudra membentuk data dalam cara yang difahami oleh aplikasi yang berada di luar teras.

Secara asasnya, beginilah carta alir data dalam sebuah aplikasi Samudra:

```mermaid
flowchart TB
flowchart LR
subgraph APP ["Samudra"]
direction LR
PW[Peewee]
PYD[Pydantic]
FAST[FastAPI]
end
subgraph WEB ["Laman web"]
subgraph WEB ["Aplikasi"]
direction TB
CLIENT[Pelanggan]
end
SQL_DB[(Pangkalan Data)]
PYD <--> PW
FAST <--> PYD
PW <--> SQL_DB
CLIENT <--> FAST
CLIENT <--> PYD
```

12 changes: 10 additions & 2 deletions docs_from_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@

nav = mkdocs_gen_files.Nav()

ignoredfiles = ["__init__", "main", "startup"]

for path in sorted(Path(SRC_PATH).rglob("*.py")):
module_path = path.relative_to(SRC_PATH).with_suffix("")
doc_path = path.relative_to(SRC_PATH).with_suffix(".md")
full_doc_path = Path("reference", doc_path)

parts = tuple(module_path.parts)
if len(parts) == 1:
continue
if parts[0] not in ignoredfiles:
parts = parts[0]
doc_path = doc_path.with_name(f"{parts}.md")
full_doc_path = full_doc_path.with_name(f"{parts}.md")
else:
continue

# print(parts)
# print(len(parts))

Expand All @@ -34,7 +42,7 @@
# FULL_DOC_DIR.mkdir(parents=True, exist_ok=True)

with mkdocs_gen_files.open(full_doc_path, "w") as fd:
ident = ".".join(parts)
ident = ".".join(parts) if type(parts) in [list, tuple] else parts
fd.write(f"::: samudra.{ident}")

mkdocs_gen_files.set_edit_path(full_doc_path, path)
Expand Down
17 changes: 6 additions & 11 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ plugins:
nav_file: SUMMARY.md
- section-index
- mkdocstrings:
# handlers:
# python:
# paths: ["."]
handlers:
python:
paths: ["."]

markdown_extensions:
- admonition
Expand All @@ -50,16 +50,11 @@ nav:
- Penerangan:
- Pengenalan: index.md
- Teras: teras.md
- Aplikasi: pemasangan.md
- Model: model.md
- API:
- lemma: API/lemma.md
- Golongan Kata: API/golongan_kata.md
- Auth: API/auth.md

- Kod Sumber:
- Teras: reference/core/index.md
- Model: reference/models/index.md
- Schema: reference/schemas/index.md
- Server: reference/server/index.md
- Konfig: reference/conf/index.md
- Interfaces: reference/interfaces.md
- Schemas: reference/schemas.md
- Ringkasan: reference/SUMMARY.md
Loading

0 comments on commit 2422e4d

Please sign in to comment.