Skip to content

Commit 8105562

Browse files
committed
update general and dev setup guide
1 parent 2d4b339 commit 8105562

File tree

1 file changed

+160
-63
lines changed

1 file changed

+160
-63
lines changed

README.md

Lines changed: 160 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -7,80 +7,132 @@ Welcome to **Steam Sales Analysis** – an innovative project designed to harnes
77

88
But we don’t stop there. The culmination of this data journey sees the information elegantly loaded into a MySQL database hosted on Aiven Cloud. From this solid foundation, we take it a step further: the data is analyzed and visualized through dynamic and interactive Tableau dashboards. This transforms raw numbers into actionable insights, offering a clear window into gaming trends and sales performance. Join us as we dive deep into the data and bring the world of gaming to life!
99

10-
# Setup Instructions
11-
12-
## General Use Case
10+
# `steamstore` CLI
1311

12+
## Setup
13+
### Installing the package
1414
For general use, setting up the environment and dependencies is straightforward:
15-
1. **Clone the repository**:
16-
```bash
17-
git clone https://github.com/DataForgeOpenAIHub/Steam-Sales-Analysis.git
18-
cd steam-sales-analysis
19-
```
20-
2. **Install the package**:
21-
```bash
22-
pip install .
23-
```
2415

25-
3. **Configuration**:
26-
- Create an `.env` file in the root directory of the repository.
27-
- Add the following variables to the `.env` file:
28-
```ini
29-
# Database configuration
30-
MYSQL_USERNAME=<your_mysql_username>
31-
MYSQL_PASSWORD=<your_mysql_password>
32-
MYSQL_HOST=<your_mysql_host>
33-
MYSQL_PORT=<your_mysql_port>
34-
MYSQL_DB_NAME=<your_mysql_db_name>
35-
```
16+
```bash
17+
# Install the python distribution from PyPI
18+
pip install steamstore-etl
19+
```
3620

37-
## Development Setup
21+
### Setting up the environment variables
22+
- Create an `.env` file in a directory.
23+
```ini
24+
# Database configuration
25+
MYSQL_USERNAME=<your_mysql_username>
26+
MYSQL_PASSWORD=<your_mysql_password>
27+
MYSQL_HOST=<your_mysql_host>
28+
MYSQL_PORT=<your_mysql_port>
29+
MYSQL_DB_NAME=<your_mysql_db_name>
30+
```
31+
- Open a terminal at the specified location
3832

39-
For development purposes, you might need to have additional dependencies and tools:
33+
#### For Ubuntu (or other Unix-like systems)
4034

41-
1. **Clone the repository**:
42-
```bash
43-
git clone https://github.com/DataForgeOpenAIHub/Steam-Sales-Analysis.git
44-
cd steam-sales-analysis
45-
```
35+
1. **Load `.env` Variables into the Terminal**
4636

47-
2. **Create a virtual environment**:
48-
- Using `venv`:
49-
```bash
50-
python -m venv game
51-
source game/bin/activate # On Windows use `game\Scripts\activate`
52-
```
53-
- Using `conda`:
54-
```bash
55-
conda env create -f environment.yml
56-
conda activate game
57-
```
37+
To load the variables from the `.env` file into your current terminal session, you can use the `export` command along with the `dotenv` command if you have the `dotenv` utility installed.
5838

59-
3. **Install dependencies**:
60-
- Install general dependencies:
61-
```bash
62-
pip install -r requirements.txt
63-
```
64-
- Install development dependencies:
65-
```bash
66-
pip install -r dev-requirements.txt
67-
```
39+
**Using `export` directly (manual method):**
6840

69-
4. **Configuration**:
70-
- Create an `.env` file in the root directory of the repository.
71-
- Add the following variables to the `.env` file:
72-
```ini
73-
# Database configuration
74-
MYSQL_USERNAME=<your_mysql_username>
75-
MYSQL_PASSWORD=<your_mysql_password>
76-
MYSQL_HOST=<your_mysql_host>
77-
MYSQL_PORT=<your_mysql_port>
78-
MYSQL_DB_NAME=<your_mysql_db_name>
79-
```
41+
```bash
42+
export $(grep -v '^#' .env | xargs)
43+
```
8044

81-
# `steamstore` CLI
45+
- `grep -v '^#' .env` removes any comments from the file.
46+
- `xargs` converts the output into environment variable export commands.
47+
48+
**Using `dotenv` (requires installation):**
49+
50+
If you prefer a tool, you can use `dotenv`:
51+
52+
- Install `dotenv` if you don't have it:
53+
54+
```bash
55+
sudo apt-get install python3-dotenv
56+
```
57+
58+
- Then, use the following command to load the `.env` file:
59+
60+
```bash
61+
dotenv
62+
```
63+
64+
**Using `source` (not typical for `.env` but useful for `.sh` files):**
8265
83-
CLI for Steam Store Data Ingestion ETL Pipeline
66+
If your `.env` file is simple, you can use `source` directly (this method assumes no special parsing is needed):
67+
68+
```bash
69+
source .env
70+
```
71+
72+
Note that `source` works well if your `.env` file only contains simple `KEY=VALUE` pairs.
73+
74+
2. **Verify the Variables**
75+
76+
After loading, you can check that the environment variables are set:
77+
78+
```bash
79+
echo $MYSQL_USERNAME
80+
```
81+
82+
#### For Windows
83+
84+
1. **Load `.env` Variables into PowerShell**
85+
86+
You can use a PowerShell script to load the variables from the `.env` file.
87+
88+
**Create a PowerShell script (e.g., `load_env.ps1`):**
89+
90+
```powershell
91+
Get-Content .env | ForEach-Object {
92+
if ($_ -match "^(.*?)=(.*)$") {
93+
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], [System.EnvironmentVariableTarget]::Process)
94+
}
95+
}
96+
```
97+
98+
- This script reads each line from the `.env` file and sets it as an environment variable for the current PowerShell session.
99+
100+
**Run the script:**
101+
102+
```powershell
103+
.\load_env.ps1
104+
```
105+
106+
**Verify the Variables:**
107+
108+
```powershell
109+
echo $env:MYSQL_USERNAME
110+
```
111+
112+
2. **Load `.env` Variables into Command Prompt**
113+
114+
The Command Prompt does not have built-in support for `.env` files. You can use a batch script to achieve this.
115+
116+
**Create a batch script (e.g., `load_env.bat`):**
117+
118+
```batch
119+
@echo off
120+
for /f "tokens=1,2 delims==" %%A in (.env) do set %%A=%%B
121+
```
122+
123+
**Run the batch script:**
124+
125+
```batch
126+
load_env.bat
127+
```
128+
129+
**Verify the Variables:**
130+
131+
```batch
132+
echo %MYSQL_USERNAME%
133+
```
134+
135+
## CLI for Steam Store Data Ingestion ETL Pipeline
84136
85137
**Usage**:
86138
@@ -163,6 +215,51 @@ $ steamstore fetch_steamstore_data [OPTIONS]
163215
- `--bulk-factor INTEGER`: Factor to determine when to perform a bulk insert (batch_size * bulk_factor). [default: 10]
164216
- `--reverse / --no-reverse`: Process app IDs in reverse order. [default: no-reverse]
165217
- `--help`: Show this message and exit.
218+
219+
# Setup Instructions
220+
## Development Setup
221+
222+
For development purposes, you might need to have additional dependencies and tools:
223+
224+
1. **Clone the repository**:
225+
```bash
226+
git clone https://github.com/DataForgeOpenAIHub/Steam-Sales-Analysis.git
227+
cd steam-sales-analysis
228+
```
229+
230+
2. **Create a virtual environment**:
231+
- Using `venv`:
232+
```bash
233+
python -m venv game
234+
source game/bin/activate # On Windows use `game\Scripts\activate`
235+
```
236+
- Using `conda`:
237+
```bash
238+
conda env create -f environment.yml
239+
conda activate game
240+
```
241+
242+
3. **Install dependencies**:
243+
- Install general dependencies:
244+
```bash
245+
pip install -r requirements.txt
246+
```
247+
- Install development dependencies:
248+
```bash
249+
pip install -r dev-requirements.txt
250+
```
251+
252+
4. **Configuration**:
253+
- Create an `.env` file in the root directory of the repository.
254+
- Add the following variables to the `.env` file:
255+
```ini
256+
# Database configuration
257+
MYSQL_USERNAME=<your_mysql_username>
258+
MYSQL_PASSWORD=<your_mysql_password>
259+
MYSQL_HOST=<your_mysql_host>
260+
MYSQL_PORT=<your_mysql_port>
261+
MYSQL_DB_NAME=<your_mysql_db_name>
262+
```
166263
167264
## Database Integration
168265

0 commit comments

Comments
 (0)