Skip to content

Commit f939598

Browse files
committed
init main
0 parents  commit f939598

6 files changed

Lines changed: 641 additions & 0 deletions

File tree

.github/copilot-instruction.md

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# HTTPX Python — Project Setup Instructions
2+
3+
## Overview
4+
5+
This file contains step-by-step instructions for setting up an HTTPX-based Python project that connects to the Refinitiv Data Platform (RDP) REST API. Follow every step in order. All steps are mandatory unless marked optional.
6+
7+
**AI Assistant Note:** Execute each step sequentially. Do not skip steps or combine steps unless explicitly told to do so. All file paths are relative to the project root directory.
8+
9+
---
10+
11+
## Prerequisites
12+
13+
Verify the following are available before starting:
14+
15+
- Python 3.9 or higher (verify with `python --version`)
16+
- Git (verify with `git --version`)
17+
- Network access to PyPI
18+
19+
---
20+
21+
## Expected Project Structure
22+
23+
After completing all steps, the project root should look like this:
24+
25+
```
26+
RDP_HTTPX/
27+
├── .github/
28+
│ └── copilot-instruction.md
29+
├── .venv/ # virtual environment (not committed to Git)
30+
├── src/
31+
│ ├── .env # local secrets (not committed to Git)
32+
│ └── .env.example # template committed to Git
33+
├── .gitignore
34+
├── LICENSE.md
35+
└── requirements.txt
36+
```
37+
38+
---
39+
40+
## Part 1: Set Up the Python Virtual Environment
41+
42+
### Step 1 — Create the virtual environment
43+
44+
Run in the project root directory:
45+
46+
```bash
47+
python -m venv .venv
48+
```
49+
50+
> This creates a `.venv/` folder containing an isolated Python environment.
51+
52+
---
53+
54+
### Step 2 — Activate the virtual environment
55+
56+
Choose the command that matches the current OS and shell:
57+
58+
| OS / Shell | Command |
59+
|---|---|
60+
| Windows — PowerShell | `.\.venv\Scripts\Activate.ps1` |
61+
| Windows — CMD | `.venv\Scripts\activate.bat` |
62+
| macOS / Linux — bash/zsh | `source .venv/bin/activate` |
63+
64+
After activation, the terminal prompt should show `(.venv)`.
65+
66+
---
67+
68+
### Step 3 — Update pip inside the virtual environment
69+
70+
Use the virtual environment's Python binary directly to avoid using a system-level pip:
71+
72+
- **Windows:**
73+
```powershell
74+
.\.venv\Scripts\python.exe -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir --upgrade pip
75+
```
76+
- **macOS / Linux:**
77+
```bash
78+
.venv/bin/python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir --upgrade pip
79+
```
80+
81+
---
82+
83+
### Step 4 — Install required packages
84+
85+
Install `httpx` and `python-dotenv` into the virtual environment:
86+
87+
- **Windows:**
88+
```powershell
89+
.\.venv\Scripts\pip.exe install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir httpx python-dotenv
90+
```
91+
- **macOS / Linux:**
92+
```bash
93+
.venv/bin/pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir httpx python-dotenv
94+
```
95+
96+
---
97+
98+
### Step 5 — Save dependencies to `requirements.txt`
99+
100+
Generate `requirements.txt` in UTF-8 encoding at the project root:
101+
102+
- **Windows (PowerShell):**
103+
```powershell
104+
.\.venv\Scripts\pip.exe freeze | Out-File -Encoding utf8 requirements.txt
105+
```
106+
- **Windows (CMD):**
107+
```cmd
108+
.venv\Scripts\pip.exe freeze > requirements.txt
109+
```
110+
- **macOS / Linux:**
111+
```bash
112+
.venv/bin/pip freeze > requirements.txt
113+
```
114+
115+
---
116+
117+
### Step 6 — Create the `src` folder
118+
119+
Create the `src/` directory in the project root:
120+
121+
```bash
122+
mkdir src
123+
```
124+
125+
---
126+
127+
### Step 7 — Create `.env` and `.env.example` files
128+
129+
Create both files inside the `src/` folder with exactly the following content:
130+
131+
**File path:** `src/.env` and `src/.env.example`
132+
133+
```env
134+
RDP_BASE_URL=https://api.refinitiv.com
135+
RDP_AUTH_URL=/auth/oauth2/v1/token
136+
RDP_AUTH_REVOKE_URL=/auth/oauth2/v1/revoke
137+
138+
139+
MACHINEID_RDP=<RDP Machine-ID>
140+
PASSWORD_RDP=<RDP Password>
141+
APPKEY_RDP=<RDP AppKey>
142+
```
143+
144+
> **Important:** `src/.env` holds real credentials and must not be committed to Git. `src/.env.example` is a template and will be committed.
145+
146+
### Step 8 -- Create VS Code launch.json file
147+
148+
Create the `.vscode/` directory in the project root:
149+
150+
```bash
151+
mkdir .vscode
152+
```
153+
154+
Next, create file name `launch.json` in `.vscode/` folder with the following content.
155+
156+
```json
157+
{
158+
// Use IntelliSense to learn about possible attributes.
159+
// Hover to view descriptions of existing attributes.
160+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
161+
"version": "0.2.0",
162+
"configurations": [
163+
{
164+
"name": "Python Debugger: Current File",
165+
"type": "debugpy",
166+
"request": "launch",
167+
"program": "${file}",
168+
"console": "integratedTerminal"
169+
}
170+
]
171+
}
172+
```
173+
174+
> **Important:** `.vscode/launch.json` must be committed to Git.
175+
176+
---
177+
178+
## Part 2: Initialize the Git Repository
179+
180+
### Step 8 — Add `LICENSE.md`
181+
182+
Create `LICENSE.md` in the project root containing the full [Apache 2.0 license text](https://www.apache.org/licenses/LICENSE-2.0):
183+
184+
Then change the `Copyright [yyyy] [name of copyright owner]` line to `Copyright 2026 LSEG`.
185+
186+
---
187+
188+
### Step 9 — Add `.gitignore`
189+
190+
Create a `.gitignore` file in the project root suitable for Python projects. Use the template from [gitignore.io for Python](https://www.toptal.com/developers/gitignore/api/python).
191+
192+
The `.gitignore` **must** include the following entries (add them if not already present):
193+
194+
```gitignore
195+
# Virtual environment
196+
.venv/
197+
198+
# Environment secrets
199+
.env
200+
```
201+
202+
---
203+
204+
### Step 10 — Initialize Git and create the initial commit
205+
206+
Run the following commands in order from the project root:
207+
208+
```bash
209+
git init
210+
git add .
211+
git commit -m "init main"
212+
```
213+
214+
---
215+
216+
### Step 11 — Rename the default branch to `main`
217+
218+
```bash
219+
git branch -m master main
220+
```
221+
222+
Verify the branch name:
223+
224+
```bash
225+
git branch
226+
```
227+
228+
Expected output: `* main`
229+

0 commit comments

Comments
 (0)