Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion Python/Module1_GettingStartedWithPython/Informal_Intro_Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.2'
jupytext_version: 1.3.0
jupytext_version: 1.5.0
kernelspec:
display_name: Python 3
language: python
Expand All @@ -19,6 +19,39 @@ jupyter:
<!-- #endraw -->

# An Informal Introduction to Python

<div class="alert alert-warning">

**Before You Start This Section**:

In the following section we will be using IPython or a Jupyter notebook to run our code.
Presently, there is an incompatibility with these programs and a Python package called `jedi`, which typically is responsible for performing auto-completions in our code (when prompted by hitting `<TAB>`, which we will be doing below).
It is really useful!

First, let's check to see if we have an incompatible version of `jedi` installed.
In your terminal (before starting a Python/IPython/Jupyter session), run

```
conda list
```

And look for the line that starts with `jedi`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the windows version have grep built in? would be a lot easier to

conda list | grep jedi

if so

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mine does, but I have no clue if it is because I installed git-bash or something. I know some students use powershell and anaconda terminal, so I figure... just let 'em scroll 😬


```
jedi 0.18.0
```

If you see that you have version `0.18.0` installed (as above), then you will want to downgrade it.
In the same terminal, run the following command

```
conda install jedi=0.17.2
```
You should be all set once you have followed the prompts and the installation has completed!

Note that you will need to repeat this process if you [create a new conda environment](https://www.pythonlikeyoumeanit.com/Module1_GettingStartedWithPython/Installing_Python.html#A-Brief-Introduction-to-Conda-Environments) with IPython/Jupter installed in it.
</div>

Now that you have the Anaconda distribution of Python installed on your machine, let's write some simple Python code! We are going to forego writing a full Python script for now, and instead make use of a convenient tool for doing quick code scratchwork. The IPython console was installed as a part of Anaconda; it will allow us to build incrementally off of snippets of code, instead of having to execute an entire script all at once.

Let's open an IPython console. Open your terminal if you are a Mac/Linux user, or start `cmd.exe` if you are a Windows user. Now type `ipython` into the console and hit `<Enter>`. You should see the following display on your screen:
Expand Down
37 changes: 35 additions & 2 deletions Python/Module1_GettingStartedWithPython/Jupyter_Notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.2'
jupytext_version: 1.3.0rc1
jupytext_version: 1.5.0
kernelspec:
display_name: Python 3
language: python
Expand All @@ -19,6 +19,39 @@ jupyter:
<!-- #endraw -->

# Jupyter Notebooks

<div class="alert alert-warning">

**Before You Start This Section**:

In the following section we will be using IPython or a Jupyter notebook to run our code.
Presently, there is an incompatibility with these programs and a Python package called `jedi`, which typically is responsible for performing auto-completions in our code (when prompted by hitting `<TAB>`, which we will be doing below).
It is really useful!

First, let's check to see if we have an incompatible version of `jedi` installed.
In your terminal (before starting a Python/IPython/Jupyter session), run

```
conda list
```

And look for the line that starts with `jedi`

```
jedi 0.18.0
```

If you see that you have version `0.18.0` installed (as above), then you will want to downgrade it.
In the same terminal, run the following command

```
conda install jedi=0.17.2
```
You should be all set once you have followed the prompts and the installation has completed!

Note that you will need to repeat this process if you [create a new conda environment](https://www.pythonlikeyoumeanit.com/Module1_GettingStartedWithPython/Installing_Python.html#A-Brief-Introduction-to-Conda-Environments) with IPython/Jupter installed in it.
</div>

In recent years, the Jupyter Notebook has become a massively popular tool for doing research-oriented work in Python and other languages alike. Its emergence marked a paradigm shift in the way data science is conducted.

A Jupyter notebook is similar to the IPython console, but, instead of only being able to work with a single line of code at a time, you can easily edit and re-execute *any* code that had been written in a notebook. Furthermore, you can save a notebook, and thus return to it later. Additionally, a notebook provides many terrific features. For instance, you can embed visualizations of data within a notebook, and write blocks of nicely-formatted text (using the [Markdown syntax](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)), for presenting and explaining the contents of the notebook.
Expand Down Expand Up @@ -186,4 +219,4 @@ The Jupyter Notebook does not work exclusively with Python. A "kernel" can be de
The ever-growing list of available kernels for use with Jupyter can be found [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels). It should be noted that these efforts are not all equally mature. For instance, whereas the Python and Julia kernels are robust, the Haskell kernel cannot run natively on Windows machines, and the C++ kernel is still in early development, as of writing this.

### Jupyter Notebook Support in Visual Studio Code
Native Jupyter notebook support was [recently added to Visual Studio Code](https://devblogs.microsoft.com/python/announcing-support-for-native-editing-of-jupyter-notebooks-in-vs-code/). This means that you can now edit Jupyter notebooks within the [Visual Studio Code IDE](https://www.pythonlikeyoumeanit.com/Module1_GettingStartedWithPython/Getting_Started_With_IDEs_and_Notebooks.html), and that you will benefit from added features like code-completion, debugging, and variable inspection.
Native Jupyter notebook support was [recently added to Visual Studio Code](https://devblogs.microsoft.com/python/announcing-support-for-native-editing-of-jupyter-notebooks-in-vs-code/). This means that you can now edit Jupyter notebooks within the [Visual Studio Code IDE](https://www.pythonlikeyoumeanit.com/Module1_GettingStartedWithPython/Getting_Started_With_IDEs_and_Notebooks.html), and that you will benefit from added features like code-completion, debugging, and variable inspection.
2 changes: 1 addition & 1 deletion Python/Module2_EssentialsOfPython/Basic_Objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.2'
jupytext_version: 1.3.0rc1
jupytext_version: 1.5.0
kernelspec:
display_name: Python 3
language: python
Expand Down