Skip to content

Commit f4b75ee

Browse files
committed
[SAM-260013]: refactor: update Makefile commands and enhance FAQ with installation and usage instructions
1 parent 20a9493 commit f4b75ee

File tree

3 files changed

+45
-64
lines changed

3 files changed

+45
-64
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@ lint:
77
poetry run ruff check .
88
poetry run black --check .
99
poetry run mypy .
10-
10+
1111
hooks:
1212
poetry run scripts/setup-hooks.sh
13+
1314
format:
1415
poetry run black .
1516
poetry run ruff check --fix .
1617

1718
type:
1819
poetry run mypy .
1920

20-
test:
21-
poetry run pytest
2221

23-
run:
22+
dev:
2423
poetry run sample dev
2524

2625
api:

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,20 @@ setup `.env.development` and `.env.production` in project root
6464
## Run Streamlit App
6565

6666
```bash
67+
make dev
68+
#or
6769
poetry run sample dev
70+
6871
```
6972

7073
Access: <http://localhost:8501>
7174

7275
## Run FastAPI Server
7376

7477
```bash
78+
make api
79+
#OR
7580
poetry run sample api
76-
# OR
77-
python src/api/fast_api.py
7881
```
7982

8083
Access: <http://127.0.0.1:5000>
@@ -101,6 +104,7 @@ poetry run ruff check .
101104
## Build Package
102105

103106
```bash
107+
104108
poetry clean
105109
poetry build
106110
```

templates/faq.html

Lines changed: 36 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -32,105 +32,92 @@ <h1>Frequently Asked Questions</h1>
3232
</details>
3333
</div>
3434
<div id="technical-faq" class="faq-container">
35+
<h1>Technical FAQ</h1>
36+
3537
<details>
3638
<summary>Which Python version is supported?</summary>
3739
<p>
38-
Python ≥ 3.11 is required. Using lower versions may cause dependency resolution or typing issues.
39-
Verify using <code>python --version</code>.
40+
Python ≥ 3.11 is required. Verify using:
4041
</p>
42+
<pre><code>python --version</code></pre>
4143
</details>
4244

4345
<details>
44-
<summary>Where is the virtual environment created?</summary>
46+
<summary>How do I install dependencies?</summary>
4547
<p>
46-
Poetry manages the virtual environment automatically.
47-
Run <code>poetry env info</code> to check the active environment.
48-
If virtualenvs.path is configured, it will be created in that directory.
48+
Use the Makefile command:
49+
</p>
50+
<pre><code>make install</code></pre>
51+
<p>
52+
This runs <code>poetry install</code> internally.
4953
</p>
5054
</details>
5155

5256
<details>
53-
<summary>How do I add a new dependency?</summary>
54-
<p>
55-
Use Poetry only.
56-
</p>
57-
<pre><code>poetry add package-name</code></pre>
58-
<p>
59-
For dev dependencies:
60-
</p>
61-
<pre><code>poetry add --group dev package-name</code></pre>
57+
<summary>How do I run the Streamlit app?</summary>
58+
<pre><code>make dev</code></pre>
6259
<p>
63-
Do not manually edit <code>pyproject.toml</code>.
60+
This executes <code>poetry run sample dev</code>.
6461
</p>
6562
</details>
6663

6764
<details>
68-
<summary>When should I regenerate poetry.lock?</summary>
69-
<p>
70-
Only when adding or upgrading dependencies.
71-
Use:
72-
</p>
73-
<pre><code>poetry lock --no-cache --regenerate</code></pre>
65+
<summary>How do I run the FastAPI server?</summary>
66+
<pre><code>make api</code></pre>
7467
<p>
75-
Avoid unnecessary lock file changes in pull requests.
68+
This executes <code>poetry run sample api</code>.
7669
</p>
7770
</details>
7871

7972
<details>
80-
<summary>Why are environment variables not loading?</summary>
81-
<p>
82-
Ensure the <code>ENV</code> variable is set correctly:
83-
</p>
84-
<pre><code>export ENV=development</code></pre>
85-
<p>
86-
or
87-
</p>
88-
<pre><code>export ENV=production</code></pre>
73+
<summary>How do I run linting and type checks?</summary>
74+
<pre><code>make lint</code></pre>
8975
<p>
90-
Also confirm that corresponding <code>.env.*</code> file exists in the project root.
76+
This runs ruff, black (check mode), and mypy.
9177
</p>
9278
</details>
9379

9480
<details>
95-
<summary>Why is Streamlit not reflecting changes?</summary>
81+
<summary>How do I auto-format the code?</summary>
82+
<pre><code>make format</code></pre>
9683
<p>
97-
Restart the Streamlit process. If caching issues occur, clear local cache or restart the shell.
84+
This runs black and ruff with auto-fix enabled.
9885
</p>
9986
</details>
10087

88+
10189
<details>
102-
<summary>Why is my commit failing?</summary>
90+
<summary>How do I clean cache and build artifacts?</summary>
91+
<pre><code>make clean</code></pre>
10392
<p>
104-
Pre-commit hooks enforce linting, formatting, and type checks.
105-
Fix issues by running:
93+
This removes __pycache__, mypy cache, pytest cache, and build artifacts.
10694
</p>
107-
<pre><code>poetry run lint</code></pre>
10895
</details>
10996

11097
<details>
111-
<summary>How do I fix a corrupted virtual environment?</summary>
98+
<summary>Where is the virtual environment created?</summary>
11299
<p>
113-
Remove and recreate the environment:
100+
Poetry manages the virtual environment automatically.
101+
To inspect:
114102
</p>
115-
<pre><code>poetry env info
116-
poetry env remove &lt;env-name&gt;
117-
poetry install</code></pre>
103+
<pre><code>poetry env info</code></pre>
118104
</details>
119105

120106
<details>
121-
<summary>How do I test the built package locally?</summary>
107+
<summary>When should I regenerate poetry.lock?</summary>
122108
<p>
123-
Build the package:
109+
Only when adding or upgrading dependencies.
124110
</p>
125-
<pre><code>poetry build</code></pre>
111+
<pre><code>poetry lock --no-cache --regenerate</code></pre>
126112
<p>
127-
Create a clean virtual environment and install the wheel file from <code>dist/</code>.
113+
Avoid unnecessary lock file changes in pull requests.
128114
</p>
129115
</details>
116+
130117
<details>
131118
<summary>What if pymongo is not found?</summary>
132119
<p>
133-
MongoDB support is installed as an optional extra dependency.
120+
MongoDB support is an optional extra dependency.
134121
Install using:
135122
</p>
136123
<pre><code>pip install sample[mongo]</code></pre>
@@ -140,15 +127,6 @@ <h1>Frequently Asked Questions</h1>
140127
<pre><code>poetry install --extras "mongo"</code></pre>
141128
</details>
142129

143-
<details>
144-
<summary>What is the expected folder structure?</summary>
145-
<p>
146-
All source code must reside inside the <code>src/</code> directory.
147-
Business logic should not be written directly in UI or API entry files.
148-
Maintain separation between API, UI, services, and utilities.
149-
</p>
150-
</details>
151-
152130
<details>
153131
<summary>Are secrets allowed inside the repository?</summary>
154132
<p>

0 commit comments

Comments
 (0)