Skip to content

Commit 39d660f

Browse files
committed
Add poetry dependency manager
1 parent b3b4866 commit 39d660f

25 files changed

+1749
-298
lines changed

README.md

Lines changed: 75 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# 🔢 NumPy Workshop
22

3-
[![License](https://img.shields.io/github/license/mr-pylin/numpy-workshop)](https://github.com/mr-pylin/numpy-workshop/blob/main/LICENSE)
4-
[![Python Version](https://img.shields.io/badge/Python-3.12.3-blue?logo=python&logoColor=white)](https://www.python.org/downloads/release/python-3123/)
3+
[![License](https://img.shields.io/github/license/mr-pylin/numpy-workshop?color=blue)](https://github.com/mr-pylin/numpy-workshop/blob/main/LICENSE)
4+
[![Python Version](https://img.shields.io/badge/Python-3.12.8-yellow?logo=python&logoColor=white)](https://www.python.org/downloads/release/python-3128/)
55
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1faf9d4577d3406a9ac65a4cb8d3d4f1)](https://app.codacy.com/gh/mr-pylin/numpy-workshop/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
6-
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
7-
![Repo Size](https://img.shields.io/github/repo-size/mr-pylin/numpy-workshop)
8-
![Last Updated](https://img.shields.io/github/last-commit/mr-pylin/numpy-workshop)
9-
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen)](https://github.com/mr-pylin/numpy-workshop/pulls)
6+
[![Code Style](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/psf/black)
7+
![Repo Size](https://img.shields.io/github/repo-size/mr-pylin/numpy-workshop?color=lightblue)
8+
![Last Updated](https://img.shields.io/github/last-commit/mr-pylin/numpy-workshop?color=orange)
9+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?color=brightgreen)](https://github.com/mr-pylin/numpy-workshop/pulls)
1010

1111
An in-depth guide to mastering **NumPy**, covering fundamental to advanced array operations for **data science** and **numerical computing**.
1212

@@ -72,36 +72,91 @@ An in-depth guide to mastering **NumPy**, covering fundamental to advanced array
7272

7373
## ⚙️ Setup
7474

75-
This project requires Python **v3.10** or higher. It was developed and tested using Python **v3.12.3**. If you encounter issues running the specified version of dependencies, consider using this version of Python.
75+
This project requires Python **v3.10** or higher. It was developed and tested using Python **v3.12.8**. If you encounter issues running the specified version of dependencies, consider using this version of Python.
7676

7777
### 📝 List of Dependencies
7878

79-
Installing **matplotlib** and **pandas** is **OPTIONAL**. They are used exclusively in the [**Looking Ahead Notebook**](./code/21-looking-ahead.ipynb) to show an application of using them.
79+
Installing `matplotlib` and `pandas` is **OPTIONAL**. They are used exclusively in the [**Looking Ahead Notebook**](./code/21-looking-ahead.ipynb) to show an application of using them.
8080

81-
[![numpy](https://img.shields.io/badge/numpy-2.1.3-orange)](https://pypi.org/project/numpy/2.1.3/)
82-
[![matplotlib](https://img.shields.io/badge/matplotlib-3.9.1-green)](https://pypi.org/project/matplotlib/3.9.1/)
83-
[![pandas](https://img.shields.io/badge/pandas-2.2.2-yellow)](https://pypi.org/project/pandas/2.2.2/)
81+
[![ipykernel](https://img.shields.io/badge/ipykernel-6.29.5-ff69b4)](https://pypi.org/project/ipykernel/6.29.5/)
82+
[![ipywidgets](https://img.shields.io/badge/ipywidgets-8.1.5-ff6347)](https://pypi.org/project/ipywidgets/8.1.5/)
83+
[![matplotlib](https://img.shields.io/badge/matplotlib-3.10.0-green)](https://pypi.org/project/matplotlib/3.10.0/)
84+
[![numpy](https://img.shields.io/badge/numpy-2.2.1-orange)](https://pypi.org/project/numpy/2.2.1/)
85+
[![pandas](https://img.shields.io/badge/pandas-2.2.3-yellow)](https://pypi.org/project/pandas/2.2.3/)
8486

85-
### 📦 Installing Dependencies
87+
### 📦 Install Dependencies
8688

87-
You can install all dependencies listed in [**requirements.txt**](./requirements.txt) using [**pip**](https://pip.pypa.io/en/stable/installation/):
89+
#### 📦 Method 1: Poetry (Recommended)
90+
91+
Use [**Poetry**](https://python-poetry.org/) for dependency management. It handles dependencies, virtual environments, and locking versions more efficiently than pip. To install dependencies using Poetry:
92+
93+
- **Option 1 [Recommended]**: Install exact dependency versions specified in [**poetry.lock**](./poetry.lock) for consistent environments:
94+
95+
```bash
96+
poetry install
97+
```
98+
99+
- **Option 2**: Install the latest compatible dependency versions from [**pyproject.toml**](./pyproject.toml) and regenerate the [**poetry.lock**](./poetry.lock) file:
100+
101+
```bash
102+
poetry install --no-root
103+
```
104+
105+
#### 📦 Method 2: Pip
106+
107+
Install all dependencies listed in [**requirements.txt**](./requirements.txt) using [**pip**](https://pip.pypa.io/en/stable/installation/):
88108

89109
```bash
90110
pip install -r requirements.txt
91111
```
92112

113+
#### 🌐 Connection Issues
114+
115+
If you encounter connection issues during installation, you can try extending the **timeout** and increasing the number of **retries** with the following:
116+
117+
- **For Poetry**: Use the following command to set the retries and timeout directly in the terminal **before running the install**:
118+
- **Windows**:
119+
- **PowerShell**:
120+
121+
```bash
122+
$env:POETRY_HTTP_TIMEOUT=300
123+
$env:POETRY_HTTP_RETRIES=10
124+
```
125+
126+
- **Command Prompt**:
127+
128+
```bash
129+
set POETRY_HTTP_TIMEOUT=300
130+
set POETRY_HTTP_RETRIES=10
131+
```
132+
133+
- **Linux/macOS**:
134+
- **Terminal**:
135+
136+
```bash
137+
export POETRY_HTTP_TIMEOUT=300
138+
export POETRY_HTTP_RETRIES=10
139+
```
140+
141+
- **For Pip**: Use the `--retries` and `--timeout` flags directly in your pip command:
142+
143+
```bash
144+
pip install -r requirements.txt --retries 10 --timeout 300
145+
```
146+
93147
### 🛠️ Usage Instructions
94148

95-
1. Open the root folder with [**VS Code**](https://code.visualstudio.com/):
96-
- **Windows/Linux**: `Ctrl + K` followed by `Ctrl + O`
97-
- **macOS**: `Cmd + K` followed by `Cmd + O`
98-
1. Open `.ipynb` files using [**Jupyter extension**](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) integrated with **VS Code**.
99-
1. Allow **VS Code** to install any **recommended dependencies** for working with Jupyter Notebooks.
149+
1. Open the root folder with [**VS Code**](https://code.visualstudio.com/) (`Ctrl/Cmd + K` followed by `Ctrl/Cmd + O`).
150+
1. Open `.ipynb` files using the [**Jupyter extension**](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) integrated with **VS Code**.
151+
1. Select the correct Python kernel and virtual environment where the dependencies were installed.
152+
1. Allow **VS Code** to install any recommended dependencies for working with Jupyter Notebooks.
100153

101154
✍️ **Notes**:
102155

103-
- The **table of contents** embedded in the **notebooks** is not fully functional on **GitHub**!
104-
- To navigate the **table of contents** effectively, open the notebooks **locally** or view them via [**nbviewer**](https://nbviewer.org/github/mr-pylin/pytorch-workshop) for a better experience.
156+
- It is **highly recommended** to stick with the exact dependency versions specified in [**poetry.lock**](./poetry.lock) or [**requirements.txt**](./requirements.txt) rather than using the latest package versions. The repository has been **tested** on these versions to ensure **compatibility** and **stability**.
157+
- This repository is **actively maintained**, and dependencies are **updated regularly** to the latest **stable** versions.
158+
- The **table of contents** embedded in the **notebooks** may not function correctly on **GitHub**.
159+
- For an improved experience, open the notebooks **locally** or view them via [**nbviewer**](https://nbviewer.org/github/mr-pylin/numpy-workshop).
105160

106161
## 🔗 Useful Links
107162

code/01-array-basics.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
{
4343
"cell_type": "code",
44-
"execution_count": null,
44+
"execution_count": 1,
4545
"metadata": {},
4646
"outputs": [],
4747
"source": [
@@ -410,7 +410,7 @@
410410
"author_github": "https://github.com/mr-pylin",
411411
"author_name": "Amirhossein Heydari",
412412
"kernelspec": {
413-
"display_name": "Python 3",
413+
"display_name": "numpy-workshop-0psJcWas-py3.12",
414414
"language": "python",
415415
"name": "python3"
416416
},
@@ -424,7 +424,7 @@
424424
"name": "python",
425425
"nbconvert_exporter": "python",
426426
"pygments_lexer": "ipython3",
427-
"version": "3.12.3"
427+
"version": "3.12.8"
428428
},
429429
"origin_repo": "https://github.com/mr-pylin/numpy-workshop"
430430
},

code/02-arithmetic-operations.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
{
4141
"cell_type": "code",
42-
"execution_count": null,
42+
"execution_count": 1,
4343
"metadata": {},
4444
"outputs": [],
4545
"source": [
@@ -74,7 +74,7 @@
7474
},
7575
{
7676
"cell_type": "code",
77-
"execution_count": null,
77+
"execution_count": 2,
7878
"metadata": {},
7979
"outputs": [
8080
{
@@ -109,7 +109,7 @@
109109
},
110110
{
111111
"cell_type": "code",
112-
"execution_count": null,
112+
"execution_count": 3,
113113
"metadata": {},
114114
"outputs": [
115115
{
@@ -172,7 +172,7 @@
172172
},
173173
{
174174
"cell_type": "code",
175-
"execution_count": null,
175+
"execution_count": 4,
176176
"metadata": {},
177177
"outputs": [
178178
{
@@ -208,7 +208,7 @@
208208
},
209209
{
210210
"cell_type": "code",
211-
"execution_count": null,
211+
"execution_count": 5,
212212
"metadata": {},
213213
"outputs": [
214214
{
@@ -275,7 +275,7 @@
275275
},
276276
{
277277
"cell_type": "code",
278-
"execution_count": null,
278+
"execution_count": 6,
279279
"metadata": {},
280280
"outputs": [
281281
{
@@ -329,7 +329,7 @@
329329
"author_github": "https://github.com/mr-pylin",
330330
"author_name": "Amirhossein Heydari",
331331
"kernelspec": {
332-
"display_name": "Python 3",
332+
"display_name": "numpy-workshop-0psJcWas-py3.12",
333333
"language": "python",
334334
"name": "python3"
335335
},
@@ -343,7 +343,7 @@
343343
"name": "python",
344344
"nbconvert_exporter": "python",
345345
"pygments_lexer": "ipython3",
346-
"version": "3.12.3"
346+
"version": "3.12.8"
347347
},
348348
"origin_repo": "https://github.com/mr-pylin/numpy-workshop"
349349
},

code/03-comparative-operations.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
{
4141
"cell_type": "code",
42-
"execution_count": null,
42+
"execution_count": 1,
4343
"metadata": {},
4444
"outputs": [],
4545
"source": [
@@ -107,7 +107,7 @@
107107
},
108108
{
109109
"cell_type": "code",
110-
"execution_count": null,
110+
"execution_count": 3,
111111
"metadata": {},
112112
"outputs": [
113113
{
@@ -199,7 +199,7 @@
199199
},
200200
{
201201
"cell_type": "code",
202-
"execution_count": null,
202+
"execution_count": 5,
203203
"metadata": {},
204204
"outputs": [
205205
{
@@ -315,7 +315,7 @@
315315
"author_github": "https://github.com/mr-pylin",
316316
"author_name": "Amirhossein Heydari",
317317
"kernelspec": {
318-
"display_name": "Python 3",
318+
"display_name": "numpy-workshop-0psJcWas-py3.12",
319319
"language": "python",
320320
"name": "python3"
321321
},
@@ -329,7 +329,7 @@
329329
"name": "python",
330330
"nbconvert_exporter": "python",
331331
"pygments_lexer": "ipython3",
332-
"version": "3.12.3"
332+
"version": "3.12.8"
333333
},
334334
"origin_repo": "https://github.com/mr-pylin/numpy-workshop"
335335
},

0 commit comments

Comments
 (0)