You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/appendix/index.md
+5-12Lines changed: 5 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,13 @@
2
2
3
3
While there are numerous ways to install and configure Python for data analysis, advanced users like to take advantage of modern Python tools to have more control over when and where code is installed on their system.
4
4
5
-
This guide will demonstrate how to install everything your computer needs using either traditional tools like pipenv or modern alternatives like uv.llation
6
-
7
-
While there are numerous ways to install and configure Python for data analysis, advanced users like to take advantage of modern Python tools to have more control over when and where code is installed on their system.
8
-
9
-
This guide will demonstrate how to install everything your computer needs using either traditional tools like pipenv or modern alternatives like uv.
5
+
This guide provides comprehensive setup instructions using [uv](https://docs.astral.sh/uv/), a fast and modern Python package manager that simplifies dependency management and virtual environments.
10
6
11
7
```{contents} Sections
12
8
:depth: 1
13
9
:local:
14
10
```
15
11
16
-
## A command-line interface/_templates/nav.html
17
-
```
18
-
19
-
# Advanced installation
20
-
21
12
While there are numerous ways to install and configure Jupyter notebooks, advanced users like to take advantage of Python’s power tools to have more control over when and where code is installed on their system.
22
13
23
14
This guide will demonstrate how to install everything your computer needs to play like the pros.
@@ -67,9 +58,11 @@ Instructions for both new installations and upgrades can be found [here](https:/
67
58
68
59
## Package and environment managers
69
60
70
-
Modern Python development benefits from using package managers that handle dependencies and virtual environments automatically. We'll cover two popular options: uv (recommended for new projects) and pipenv (traditional approach).
61
+
## Python Package Management with uv
62
+
63
+
Modern Python development benefits from using package managers that handle dependencies and virtual environments automatically. We recommend [uv](https://docs.astral.sh/uv/) for all users because it's fast, reliable, and simple to use.
71
64
72
-
### Option 1: uv (Recommended)
65
+
### Installing uv
73
66
74
67
[uv](https://docs.astral.sh/uv/) is a modern, fast Python package manager written in Rust that makes dependency management simple and reliable. It automatically handles virtual environments and is significantly faster than traditional tools.
Copy file name to clipboardExpand all lines: docs/src/notebooks/pandas.ipynb
+20-3Lines changed: 20 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@
44
44
"```{note}\n",
45
45
"Since pandas is created by a third party independent from the core Python developers, it wouldn't be installed by default in a basic Python installation.\n",
46
46
"\n",
47
-
"If you followed the VS Code setup chapter and used uv to set up your project, pandas should already be installed. If your Python environment doesn't have pandas, you can install it by opening the VS Code terminal (`View > Terminal`) and running `uv add pandas` (if using uv) or `pip install pandas` (if using pip).\n",
47
+
"\"If you followed the VS Code setup chapter and used uv to set up your project, pandas should already be installed. If your Python environment doesn't have pandas, you can install it by opening the VS Code terminal (`View > Terminal`) and running `uv add pandas`.\\n\",\n",
48
48
"```\n",
49
49
"\n",
50
50
"Return to your import section and rewrite it like this:"
@@ -55,7 +55,18 @@
55
55
"execution_count": null,
56
56
"id": "8fa1655e",
57
57
"metadata": {},
58
-
"outputs": [],
58
+
"outputs": [
59
+
{
60
+
"ename": "",
61
+
"evalue": "",
62
+
"output_type": "error",
63
+
"traceback": [
64
+
"\u001b[1;31mRunning cells with 'first-python-notebook-vscode (Python 3.12.7)' requires the ipykernel package.\n",
65
+
"\u001b[1;31mInstall 'ipykernel' into the Python environment. \n",
Copy file name to clipboardExpand all lines: docs/src/pandas.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ If nothing happens, that's good. It means you have pandas installed and ready to
43
43
```{note}
44
44
Since pandas is created by a third party independent from the core Python developers, it wouldn't be installed by default in a basic Python installation.
45
45
46
-
If you followed the VS Code setup chapter and used uv to set up your project, pandas should already be installed. If your Python environment doesn't have pandas, you can install it by opening the VS Code terminal (`View > Terminal`) and running `uv add pandas` (if using uv) or `pip install pandas` (if using pip).
46
+
If you followed the VS Code setup chapter and used uv to set up your project, pandas should already be installed. If your Python environment doesn't have pandas, you can install it by opening the VS Code terminal (`View > Terminal`) and running `uv add pandas`.
47
47
```
48
48
49
49
Return to your import section and rewrite it like this:
Copy file name to clipboardExpand all lines: docs/src/vscode_setup.md
+76-29Lines changed: 76 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,10 +16,10 @@ Examples of data journalism projects that could be developed using VS Code inclu
16
16
17
17
You can find thousands of Python projects on [GitHub](https://github.com/search?q=language%3APython+data+analysis&type=Repositories) that use VS Code for development, including projects by [The New York Times](https://github.com/nytimes), [FiveThirtyEight](https://github.com/fivethirtyeight), [BuzzFeed News](https://github.com/BuzzFeedNews), and many others.
18
18
19
-
There are several ways to set up Python development in VS Code. Since this tutorial is designed for beginners, we'll show you how to install VS Code and set up a Python environment that includes all the tools you need for data analysis.
19
+
There are several ways to set up Python development in VS Code. This tutorial uses [uv](https://docs.astral.sh/uv/), a fast and modern Python package manager that makes dependency management simple and reliable. We'll walk you through installing VS Code, Python, uv, and all the tools you need for data analysis.
20
20
21
21
```{note}
22
-
Advanced users who prefer command-line tools can still follow this tutorial, but may want to use their existing Python environments. The code examples will work in any Python environment with pandas and other data analysis libraries installed.
22
+
We recommend uv for all users because it automatically manages Python installations and virtual environments, preventing common setup issues. Advanced users familiar with other tools (conda, pipenv, etc.) can adapt the examples, but following the uv approach will give you the smoothest experience.
23
23
```
24
24
25
25
## Install Visual Studio Code
@@ -77,42 +77,94 @@ This extension enables:
77
77
- Data viewer for pandas DataFrames
78
78
- Notebook diffing and merge capabilities
79
79
80
-
## Set Up Python Environment
80
+
## Install uv (Python Package Manager)
81
+
82
+
Before setting up Python, we'll install uv, which will handle Python installation and package management for us. This approach ensures you get the latest Python version and eliminates common environment issues.
83
+
84
+
Open your terminal or command prompt and run the appropriate command for your operating system:
-[pyenv](https://github.com/pyenv/pyenv) for managing multiple Python versions
109
+
1.**Create your project directory:**
110
+
```bash
111
+
uv init first-python-notebook
112
+
cd first-python-notebook
113
+
```
114
+
115
+
2.**Install required packages:**
116
+
```bash
117
+
uv add pandas matplotlib seaborn jupyter altair
118
+
```
119
+
120
+
This command will:
121
+
- Download and install Python 3.12+ if needed
122
+
- Create a virtual environment automatically
123
+
- Install all required packages for data analysis
124
+
- Create a `pyproject.toml` file to track dependencies
125
+
126
+
The installation may take a few minutes the first time as uv downloads Python and packages.
127
+
128
+
## Set Up Python Environment
129
+
130
+
Now we'll install uv, which will handle both Python installation and package management for us.
131
+
132
+
## Install uv
133
+
134
+
uv is a fast Python package manager that automatically handles Python installation and virtual environments. It's the simplest way to get everything set up correctly.
97
135
98
136
## Verify Your Setup
99
137
100
-
Let's verify everything is working:
138
+
Let's verify everything is working by testing Python and our installed packages:
101
139
102
-
1. Open VS Code
103
-
2. Create a new file by pressing `Ctrl+N` (or `Cmd+N` on Mac)
104
-
3. Save it as `test.py` (press `Ctrl+S` or `Cmd+S`)
105
-
4. Type the following code:
140
+
1.**Open VS Code in your project:**
141
+
```bash
142
+
code .
143
+
```
144
+
145
+
2.**Create a test file:** Press `Ctrl+N` (or `Cmd+N` on Mac) to create a new file
146
+
3.**Save it as `test.py`:** Press `Ctrl+S` (or `Cmd+S`) and name it `test.py`
147
+
4.**Add test code:**
106
148
107
149
```python
108
-
print("Hello, VS Code!")
150
+
import pandas as pd
151
+
import matplotlib.pyplot as plt
152
+
import seaborn as sns
153
+
import altair as alt
154
+
155
+
print("🎉 All packages imported successfully!")
156
+
print(f"Python version: {pd.np.version.version}")
157
+
print(f"pandas version: {pd.__version__}")
158
+
print(f"altair version: {alt.__version__}")
109
159
```
110
160
111
-
5. Right-click in the editor and select "Run Python File in Terminal"
161
+
5.**Run the file:**Right-click in the editor and select "Run Python File in Terminal"
112
162
113
-
You should see "Hello, VS Code!" printed in the integrated terminal at the bottom of the screen.
163
+
You should see success messages and version numbers printed in the integrated terminal at the bottom of the screen.
Once uv is installed, create a new Python project and install the required packages:
139
186
140
187
```bash
@@ -159,7 +206,7 @@ uv is much faster than pip and provides better dependency resolution. It automat
159
206
160
207
## Your First Interactive Session
161
208
162
-
VS Code supports multiple ways to work with Python and Jupyter notebooks. If you set up your project with uv, make sure you're working in the project directory:
209
+
VS Code provides excellent support for working with Python and Jupyter notebooks. Now that you've set up your project with uv, make sure you're working in the project directory:
0 commit comments