generated from PreTeXtBook/pretext-codespace
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update pretext * add jupyter chapter stub * move old jupyter stuff, add vanilla programming stuff * Update source/ch-coding.ptx Co-authored-by: Daniel Hodgins <121420574+DanielHodgins@users.noreply.github.com> * add terminal info * fix merge mistake * whitespace * add more on jupyter notebook chapter --------- Co-authored-by: Daniel Hodgins <121420574+DanielHodgins@users.noreply.github.com>
- Loading branch information
1 parent
06c7593
commit 1ed1f50
Showing
8 changed files
with
237 additions
and
45 deletions.
There are no files selected for viewing
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# <!-- Managed automatically by PreTeXt authoring tools --> | ||
pretext == 2.4.2.dev20240629061947 | ||
pretext == 2.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<chapter xml:id="ch-jupyter"> | ||
<title>Jupyter Notebooks</title> | ||
<introduction> | ||
<p> | ||
In <xref ref="sec-run-code"/> you wrote and ran a few short | ||
scripts in various programming languages. But often, we want | ||
to not only be able to write and execute code, but do so | ||
piece-by-piece, and share the results with other people | ||
without requiring them to run the code themselves... | ||
</p> | ||
</introduction> | ||
<section xml:id="sec-intro-to-jupyter"> | ||
<title>Intro to Jupyter</title> | ||
<definition xml:id="def-jupyter"> | ||
<statement> | ||
<p> | ||
A <term>Jupyter notebook</term> is a file that stores | ||
commentary, code, and output in an all-in-one format suitable for | ||
sharing with other people. | ||
</p> | ||
</statement> | ||
</definition> | ||
<p> | ||
Jupyter is a popular open-source tool used in | ||
data science, scientific computing, and computational journalism. | ||
GitHub provides a Codespace ready for running Jupyter notebooks | ||
out of the box: | ||
<url href="https://github.com/github/codespaces-jupyter/"/>. | ||
</p> | ||
</section> | ||
<section xml:id="sec-github-codespaces-jupyter"> | ||
<title>GitHub's Jupyter Codespace</title> | ||
<p> | ||
Let's begin by going to | ||
<url href="https://github.com/github/codespaces-jupyter/"> | ||
github/codespaces-jupyter</url> | ||
directly. Before we dive into editing a notebook ourselves, | ||
we can first browse the <c>notebooks</c> directory on | ||
the repository page. We see three files, each with the | ||
extension <c>*.ipynb</c> | ||
(short for <q><em>IPY</em>thon <em>N</em>ote<em>B</em>ook</q>, | ||
Jupyter's original name). | ||
</p> | ||
<p> | ||
Clicking on each file, you'll note that while there's code, | ||
most of the file is actually narrative and visualization. | ||
That's the appeal of Jupyter for many people: it's about | ||
communicating <em>stories</em>, not just data or software. | ||
</p> | ||
<p> | ||
Additionally, you'll see a <c>data</c> directory, which | ||
includes a <c>*.csv</c> <em>C</em>omma <em>S</em>eparated | ||
<em>V</em>alues spreadsheet. This file can be read into a | ||
notebook for analysis. | ||
</p> | ||
<p> | ||
Now, let's follow the instructions of the repository's | ||
README file (<xref ref="remark-readme"/>). | ||
</p> | ||
</section> | ||
<!-- <section> | ||
<p> | ||
To get started, create a Codespace | ||
(<xref ref="note-create-codespace"/>) | ||
on either an existing or new repository | ||
(<xref ref="sec-creating-the-repo"/>). | ||
You can then create a Jupyter notebook file named | ||
<c>notebook.ipynb</c>. | ||
</p> | ||
<note xml:id="note-provision-notebook"> | ||
<p> | ||
In a Codespace, any file with the extension | ||
will be treated as a | ||
Jupyter notebook. When opening this file, you'll see a notebook | ||
interface, and be prompted to | ||
<q>install the recommended 'Python' extension</q> if it's | ||
not already enabled - do this. | ||
</p> | ||
<p> | ||
Then in your notebook file, click the <q>Select Kernel</q> | ||
button, then <q>Install/Enable suggested extensions</q> for | ||
Python+Jupyter. You should then have the option to select | ||
a <q>Python environment</q> such as <c>Python 3.*.*</c>. | ||
</p> | ||
<p> | ||
If successful, you should be able to enter | ||
<c>import sys; print(sys.version)</c> into the displayed | ||
text box, | ||
and see the result of executing it with | ||
<kbd>Shift</kbd>+<kbd>Enter</kbd>. | ||
</p> | ||
</note> | ||
<p> | ||
There are plenty of existing tutorials on the internet to help you | ||
get acquainted with Python and Jupyter now that you have them | ||
available to you in your Codespace. But to get you started, I've provided | ||
one <dataurl source="first-notebook.ipynb">sample notebook</dataurl> | ||
that you can upload to your Codespace to break the ice. | ||
</p> | ||
</section> --> | ||
</chapter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters