Skip to content

Commit

Permalink
Merge pull request #13 from bybatkhuu:dev
Browse files Browse the repository at this point in the history
Enhance documentation headers with emoji for improved readability
  • Loading branch information
bybatkhuu authored Nov 13, 2024
2 parents 87ebb74 + 01d4ccd commit 9b31614
Show file tree
Hide file tree
Showing 57 changed files with 270 additions and 260 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exclude scripts/**
exclude templates/**
exclude tests/**
exclude __init__.py
exclude .coverage
exclude .editorconfig
exclude .env
exclude .env.example
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help clean get-version test bump-version build docs changelog example all
.PHONY: help clean get-version test bump-version build docs changelog diagrams example all

help:
@echo "make help -- show this help"
Expand All @@ -9,6 +9,7 @@ help:
@echo "make build -- build python package"
@echo "make docs -- build documentation"
@echo "make changelog -- update changelog"
@echo "make diagrams -- generate diagrams"
@echo "make example -- run example script"
@echo "make all -- clean, get-version, test, build"

Expand All @@ -33,6 +34,9 @@ docs:
changelog:
./scripts/changelog.sh $(MAKEFLAGS)

diagrams:
./scripts/diagrams.sh $(MAKEFLAGS)

example:
python ./examples/simple/main.py

Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

This is a template repo for AI/ML model module.

## Features
## Features

- AI/ML model
- Python module/package
Expand All @@ -18,9 +18,9 @@ This is a template repo for AI/ML model module.

---

## Installation
## 🛠 Installation

### 1. Prerequisites
### 1. 🚧 Prerequisites

- Install **Python (>= v3.9)** and **pip (>= 23)**:
- **[RECOMMENDED] [Miniconda (v3)](https://docs.anaconda.com/miniconda)**
Expand All @@ -30,12 +30,12 @@ This is a template repo for AI/ML model module.
- **NVIDIA GPU driver (>= v452.39)**
- **NVIDIA CUDA (>= v11)** and **cuDNN (>= v8)**

For **DEVELOPMENT** environment:
💻 For **DEVELOPMENT** environment:

- Install [**git**](https://git-scm.com/downloads)
- Setup an [**SSH key**](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh) ([video tutorial](https://www.youtube.com/watch?v=snCP3c7wXw0))

### 2. Download or clone the repository
### 2. 📥 Download or clone the repository

**2.1.** Prepare projects directory (if not exists):

Expand All @@ -49,31 +49,31 @@ cd ~/workspaces/projects

**2.2.** Follow one of the below options **[A]** or **[B]**:

**A.** Clone the repository:
**OPTION A.** Clone the repository:

```sh
git clone git@github.com:bybatkhuu/model.python-template.git simple_model && \
cd simple_model
```

**B.** Download source code:
**OPTION B.** Download source code:

1. Download archived **zip** file from [**releases**](/~https://github.com/bybatkhuu/model.python-template/releases).
2. Extract it into the project directory.
3. Rename the extracted directory from **`model.python-template`** to **`simple_model`**.

### 3. Install the module
### 3. 📦 Install the module

> [!NOTE]
> Choose one of the following methods to install the module **[A ~ E]**:
**A.** Install directly from **git** repository:
**OPTION A.** Install directly from **git** repository:

```sh
pip install git+/~https://github.com/bybatkhuu/model.python-template.git
```

**B.** Install from the downloaded **source code**:
**OPTION B.** Install from the downloaded **source code**:

```sh
# Install directly from the source code:
Expand All @@ -82,13 +82,13 @@ pip install .
pip install -e .
```

**C.** Install for **DEVELOPMENT** environment:
**OPTION C.** Install for **DEVELOPMENT** environment:

```sh
pip install -r ./requirements/requirements.dev.txt
```

**D.** Install from **pre-built package** files (for **PRODUCTION**):
**OPTION D.** Install from **pre-built package** files (for **PRODUCTION**):

1. Download **`.whl`** or **`.tar.gz`** file from [**releases**](/~https://github.com/bybatkhuu/model.python-template/releases).
2. Install with pip:
Expand All @@ -100,7 +100,7 @@ pip install ./simple_model-[VERSION]-py3-none-any.whl
pip install ./simple_model-[VERSION].tar.gz
```

**E.** Copy the **module** into the project directory (for **testing**):
**OPTION E.** Copy the **module** into the project directory (for **testing**):

```sh
# Install python dependencies:
Expand All @@ -112,7 +112,7 @@ cp -r ./src/simple_model [PROJECT_DIR]
cp -r ./src/simple_model /some/path/project/
```

## Usage/Examples
## 🚸 Usage/Examples

### Simple

Expand Down Expand Up @@ -176,11 +176,11 @@ if __name__ == "__main__":
logger.info("Done!")
```

:thumbsup: :sparkles:
👍

---

## Configuration
## ⚙️ Configuration

[**`templates/configs/config.yml`**](/~https://github.com/bybatkhuu/model.python-template/blob/main/templates/configs/config.yml):

Expand All @@ -191,7 +191,7 @@ simple_model: # Just an example to group t
threshold: 0.5 # Threshold for similarity check
```
### Environment Variables
### 🌎 Environment Variables
[**`.env.example`**](/~https://github.com/bybatkhuu/model.python-template/blob/main/.env.example):

Expand All @@ -200,7 +200,7 @@ simple_model: # Just an example to group t
# DEBUG=true
```

## Running Tests
## 🧪 Running Tests

To run tests, run the following command:

Expand All @@ -214,7 +214,7 @@ python -m pytest -sv -o log_cli=true
./scripts/test.sh -l -v -c
```

## Build Package
## 🏗️ Build Package

To build the python package, run the following command:

Expand All @@ -228,7 +228,7 @@ python -m build
./scripts/build.sh
```

## Generate Docs
## 📝 Generate Docs

To build the documentation, run the following command:

Expand All @@ -247,7 +247,7 @@ mkdocs build
./scripts/docs.sh -b
```

## Documentation
## 📚 Documentation

- [Docs](/~https://github.com/bybatkhuu/model.python-template/blob/main/docs)
- [Home](/~https://github.com/bybatkhuu/model.python-template/blob/main/docs/README.md)
Expand Down Expand Up @@ -293,7 +293,7 @@ mkdocs build

---

## References
## 📑 References

- <https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html>
- <https://packaging.python.org/en/latest/tutorials/packaging-projects>
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ hide:
# - toc
---

# Introduction
# 🎉 Introduction

This is a template repo for AI/ML model module.

## Features
## Features

- AI/ML model
- Python module/package
Expand Down
65 changes: 65 additions & 0 deletions docs/diagrams/call-graphs/cgraph_simple_model.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
digraph G {
concentrate=true;
splines="ortho";
rankdir="LR";
subgraph legend{
rank = min;
label = "legend";
Legend [shape=none, margin=0, label = <
<table cellspacing="0" cellpadding="0" border="1"><tr><td>Code2flow Legend</td></tr><tr><td>
<table cellspacing="0">
<tr><td>Regular function</td><td width="50px" bgcolor='#cccccc'></td></tr>
<tr><td>Trunk function (nothing calls this)</td><td bgcolor='#966F33'></td></tr>
<tr><td>Leaf function (this calls nothing else)</td><td bgcolor='#6db33f'></td></tr>
<tr><td>Function call</td><td><font color='black'>&#8594;</font></td></tr>
</table></td></tr></table>
>];
}node_4c48eeae [label="57: __init__()" name="_base::SimpleModel.__init__" shape="rect" style="rounded,filled" fillcolor="#966F33" ];
node_a643ce86 [label="343: __repr__()" name="_base::SimpleModel.__repr__" shape="rect" style="rounded,filled" fillcolor="#966F33" ];
node_bbfff2aa [label="338: __str__()" name="_base::SimpleModel.__str__" shape="rect" style="rounded,filled" fillcolor="#966F33" ];
node_136196fd [label="95: is_model_files_exist()" name="_base::SimpleModel.is_model_files_exist" shape="rect" style="rounded,filled" fillcolor="#6db33f" ];
node_b21b7ca3 [label="187: is_similar()" name="_base::SimpleModel.is_similar" shape="rect" style="rounded,filled" fillcolor="#966F33" ];
node_57ea54ee [label="211: is_trained()" name="_base::SimpleModel.is_trained" shape="rect" style="rounded,filled" fillcolor="#6db33f" ];
node_41f55827 [label="255: load()" name="_base::SimpleModel.load" shape="rect" style="rounded,filled" fillcolor="#cccccc" ];
node_8883f426 [label="152: predict()" name="_base::SimpleModel.predict" shape="rect" style="rounded,filled" fillcolor="#cccccc" ];
node_1ab8140c [label="121: run()" name="_base::SimpleModel.run" shape="rect" style="rounded,filled" fillcolor="#966F33" ];
node_e2279113 [label="223: save()" name="_base::SimpleModel.save" shape="rect" style="rounded,filled" fillcolor="#966F33" ];
node_611349ab [label="169: score()" name="_base::SimpleModel.score" shape="rect" style="rounded,filled" fillcolor="#6db33f" ];
node_8379b8c2 [label="139: train()" name="_base::SimpleModel.train" shape="rect" style="rounded,filled" fillcolor="#6db33f" ];
node_18ac5e6d [label="61: clean_obj_dict()" name="_utils::clean_obj_dict" shape="rect" style="rounded,filled" fillcolor="#6db33f" ];
node_07e2bfd3 [label="21: create_dir()" name="_utils::create_dir" shape="rect" style="rounded,filled" fillcolor="#6db33f" ];
node_9c65894c [label="93: obj_to_repr()" name="_utils::obj_to_repr" shape="rect" style="rounded,filled" fillcolor="#6db33f" ];
node_4c48eeae -> node_136196fd [color="#D55E00" penwidth="2"];
node_4c48eeae -> node_41f55827 [color="#D55E00" penwidth="2"];
node_a643ce86 -> node_9c65894c [color="#D55E00" penwidth="2"];
node_bbfff2aa -> node_18ac5e6d [color="#56B4E9" penwidth="2"];
node_b21b7ca3 -> node_8883f426 [color="#009E73" penwidth="2"];
node_b21b7ca3 -> node_611349ab [color="#009E73" penwidth="2"];
node_41f55827 -> node_136196fd [color="#CC79A7" penwidth="2"];
node_8883f426 -> node_8883f426 [color="#D55E00" penwidth="2"];
node_1ab8140c -> node_57ea54ee [color="#F0E442" penwidth="2"];
node_1ab8140c -> node_8883f426 [color="#F0E442" penwidth="2"];
node_1ab8140c -> node_8379b8c2 [color="#F0E442" penwidth="2"];
node_e2279113 -> node_57ea54ee [color="#009E73" penwidth="2"];
node_e2279113 -> node_07e2bfd3 [color="#009E73" penwidth="2"];
subgraph cluster_82217841 {
label="File: _base";
name="_base";
style="filled";
graph[style=dotted];
subgraph cluster_9e6360c0 {
node_4c48eeae node_136196fd node_1ab8140c node_8379b8c2 node_8883f426 node_611349ab node_b21b7ca3 node_57ea54ee node_e2279113 node_41f55827 node_bbfff2aa node_a643ce86;
label="Class: SimpleModel";
name="SimpleModel";
style="filled";
graph[style=dotted];
};
};
subgraph cluster_05a0bfdc {
node_07e2bfd3 node_18ac5e6d node_9c65894c;
label="File: _utils";
name="_utils";
style="filled";
graph[style=dotted];
};
}
Binary file added docs/diagrams/call-graphs/cgraph_simple_model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9b31614

Please sign in to comment.