-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmake_readme.py
90 lines (63 loc) · 2.55 KB
/
make_readme.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python3
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
import sys
from path import Path
from readmemaker import ReadmeMaker
PROJECT_NAME = "SimpleSQLite"
OUTPUT_DIR = ".."
def write_examples(maker):
maker.set_indent_level(0)
maker.write_chapter("Examples")
examples_root = Path("pages").joinpath("examples")
maker.inc_indent_level()
maker.write_chapter("Create a table")
with maker.indent():
maker.write_chapter("Create a table from a data matrix")
maker.write_file(examples_root.joinpath("create_table/create_table_from_data_matrix.txt"))
maker.write_chapter("Create a table from CSV")
maker.write_file(examples_root.joinpath("create_table/create_table_from_csv.txt"))
maker.write_chapter("Create a table from pandas.DataFrame")
maker.write_file(examples_root.joinpath("create_table/create_table_from_df.txt"))
maker.write_chapter("Insert records into a table")
maker.write_file(examples_root.joinpath("insert_record_example.txt"))
maker.write_chapter("Fetch data from a table as pandas DataFrame")
maker.write_file(examples_root.joinpath("select_as/select_as_dataframe.txt"))
maker.write_chapter("ORM functionality")
maker.write_file(examples_root.joinpath("orm/orm_model.txt"))
maker.write_chapter("For more information")
maker.write_lines(
[
"More examples are available at ",
f"https://{PROJECT_NAME.lower():s}.rtfd.io/en/latest/pages/examples/index.html",
]
)
def main() -> None:
maker = ReadmeMaker(
PROJECT_NAME,
OUTPUT_DIR,
is_make_toc=True,
project_url=f"https://github.com/thombashi/{PROJECT_NAME}",
)
maker.write_chapter("Summary")
maker.write_introduction_file("summary.txt")
maker.write_introduction_file("badges.txt")
maker.write_introduction_file("feature.txt")
write_examples(maker)
maker.write_introduction_file("installation.rst")
maker.set_indent_level(0)
maker.write_chapter("Documentation")
maker.write_lines([f"https://{PROJECT_NAME.lower():s}.rtfd.io/"])
maker.write_chapter("Related Project")
maker.write_lines(
[
"- `sqlitebiter <https://github.com/thombashi/sqlitebiter>`__: "
"CLI tool to convert CSV/Excel/HTML/JSON/LTSV/Markdown/TSV/Google-Sheets "
"SQLite database by using SimpleSQLite"
]
)
maker.write_file(maker.doc_page_root_dir_path.joinpath("sponsors.rst"))
return 0
if __name__ == "__main__":
sys.exit(main())