Skip to content

Commit 3ea9969

Browse files
committed
added pycharm git cloning and restructured working with packages into ecosystems part
1 parent feb3e54 commit 3ea9969

File tree

68 files changed

+458
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+458
-6
lines changed

text/main/basics/variables/errorsInIde/errorsInIde.tex

+8-2
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,15 @@
177177
So even correct program output does not guarantee that the program itself is correct.
178178
Therefore, always checking each and every piece of code that your \pgls{IDE} marks as dodgy is very important.
179179
Make sure that you full understand all error and warning messages.
180-
Always fix them when necessary (obviously).
180+
181+
Warnings can be important, too.
182+
They can indicate possible errors, potential problems with variable types, or missing required packages (see, e.g., \cref{sec:gitClonePycharm}).
183+
Always fix errors and warnings wherever possible (obviously).
181184
Even where you deem the warnings as false-positives, try to fix them anyway.
182-
On one hand, \emph{you} might wrong on.
185+
They could result from non-standard code formatting that still \inQuotes{works}, but may be confusing for readers of your code.
186+
You should always try to produce warning-free code.
187+
For every warning or error that you deem as not a problem, remember:
188+
On one hand, \emph{you} might wrong.
183189
On the other hand, having fewer warnings and false-positive suspected errors makes it easier to find the actual problem if an actual problem happens.%
184190
%
185191
\FloatBarrier%

text/main/ecosystem/ecosystem.tex

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
\hsection{Working with the Ecosystem}%
2+
%
3+
A software developer rarely works on a stand-alone project all by themself.
4+
Instead, they develop projects that are part of an ecosystem of applications.
5+
Their programs will usually depend on libraries, i.e., \python\ packages that offer functionality.
6+
Often, their projects are stored in \pglspl{VCS} like \git\ repositories.
7+
In this part of the book, we will take a small glimpse on how to work within a system of existing projects and \pglspl{VCS}.%
8+
%
9+
\hinput{packages}{packages.tex}%
10+
\hinput{git}{git.tex}%
11+
%
12+
\endhsection%

text/main/ecosystem/git/git.tex

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\hsection{The Distributed Version Control System git}%
2+
%
3+
Today, \git~\cite{S2023LG,T2024BGAGVCPMATFTND} is maybe the \pgls{VCS} with the most wide-spread use.
4+
It is the \pgls{VCS} on which \github~\cite{PRGWSUdVLFTEKPKFBV2016TSRFTAOGAG} is based, which, in turn, is maybe the most important hub for open source software projects in the world.
5+
\git\ is based on a \pgls{clientServerArchitecture}, where the \pgls{server} hosts and manages repositories of source code and other resources.
6+
The \git\ \pgls{client} is a command line application that is run in the \pgls{terminal} and which allows you to clone (i.e., download) source code repositories and upload (i.e., commit) changes to them.
7+
A repository is something like a directory with files and their editing history, i.e., you can work and improve source code, commit changes, and see the history of all past commits.
8+
This is what \pglspl{VCS} are for:
9+
They do not just provide the current state of a project and allow teams to cooperative and continuous develop software, they also store the history of the project so as to enable us to see which code was used in which version of our software and to track changes.
10+
How to correctly use \git\ thus is a very complex and involved topic beyond the scope of this book.
11+
However, we will here take at least a look into a very small subset of functions that provide you a starting point for working with \git\ repositories.%
12+
%
13+
\hinput{gitClone}{gitClone.tex}%
14+
%
15+
\endhsection%
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
\hsection{Cloning git Repositories}%
2+
%
3+
The most fundamental activity you will encounter is \emph{cloning} repositories.
4+
Under \git, this basically means to download the complete repository and its history to your machine.
5+
You can now make local changes to the downloaded files.
6+
You can create commits, that will change the local version of your repository.
7+
Then you could push these changes back to the repository hosted by the \git\ \pgls{server}, making them accessible for other users.
8+
But, well, the first step is to clone - i.e., to download -- the repository.
9+
10+
You can clone \git\ repositories with the command line \bashil{git} \pgls{client} program.
11+
However, \pycharm\ also has a \git \pgls{client} built in.
12+
We here outline both approaches.%
13+
%
14+
\hinput{gitClonePycharm}{gitClonePycharm}%
15+
%
16+
\endhsection%

text/main/ecosystem/git/gitClone/gitClonePycharm/gitClonePycharm.tex

+399
Large diffs are not rendered by default.

text/main/packages/packages.tex renamed to text/main/ecosystem/packages/packages.tex

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
%
22
\hsection{Using Packages}%
3+
\label{sec:usingPackages}%
34
%
45
\begin{figure}%
56
\centering%

text/main/packages/pipAndVenv/pipAndVenv.tex renamed to text/main/ecosystem/packages/pipAndVenv/pipAndVenv.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
\begin{sloppypar}%
195195
Finally, in our example in \cref{lst:packages:numpy_user_venv_sh,fig:venvLinux8}, we delete the \pgls{virtualEnvironment} directory again via~\bashil{rm -rf .venv}.
196196
Normally, you would \emph{not} do this.\footnote{%
197-
I just clean up here because my examples are automatically executed whenever the book is built and I want to avoid that the examples interfer with each other or that, accidentally, some files from the environment land in my \git\ repositories.}%
197+
I just clean up here because my examples are automatically executed whenever the book is built and I want to avoid that the examples interfer with each other or that, accidentally, some files from the environment land in my \git\ repositories.}
198198
You do not want to re-create the \pgls{virtualEnvironment} again every time you execute your application.
199199
As said, once you have installed the required \pglspl{package}, you can simply activate the environment and run your program whenever you want.%
200200
\end{sloppypar}%
File renamed without changes.
File renamed without changes.

text/main/packages/requirementsFiles/requirementsFiles.tex renamed to text/main/ecosystem/packages/requirementsFiles/requirementsFiles.tex

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
%
2-
\hsection{Requirements Files}
2+
\hsection{Requirements Files}%
3+
\label{sec:requirementsFiles}%
34
%
45
\gitPython{\programmingWithPythonCodeRepo}{packages/requirements.txt}{--args format}{packages:requirementstxt}{%
56
A requirements file demanding that version~\textil{1.26.4} of \numpy\ be installed.}%

text/main/packages/venvAndPycharm/venvAndPycharm.tex renamed to text/main/ecosystem/packages/venvAndPycharm/venvAndPycharm.tex

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
%
22
\hsection{Virtual Environments in PyCharm}%
3+
\label{sec:venvAndPycharm}%
34
%
45
\begin{figure}%
56
\centering%
@@ -78,6 +79,7 @@
7879
The \pgls{IDE} \pycharm\ also supports using \pglspl{virtualEnvironment} and \textil{requirements.txt} files.
7980
Let us here demonstrate this on the example program that requires \numpy\ which was given as \cref{lst:packages:numpy_user} and \textil{requirements.txt} file given in \cref{lst:packages:requirementstxt}.
8081
In \cref{fig:venvPycharmA}, we work through the steps to create and manage a project with a \pgls{virtualEnvironment} in \pycharm\ on their basis.
82+
(A complete example on how to copy a source code repository from \git\ or \github\ and how to set up a \pgls{virtualEnvironment} for its dependencies is given in \cref{sec:gitClonePycharm}.)
8183

8284
First, we need to create a new project~(\cref{fig:venvPycharm1}).
8385
For this purpose, we already copied the files \pglspl{virtualEnvironment} and \textil{requirements.txt} into a folder~(here:~\textil{/tmp/packages}).

text/main/mainmatter.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
\hinput{basics}{basics.tex}%
77
\hinput{controlFlow}{controlFlow.tex}%
88
\hinput{classes}{classes.tex}%
9-
\hinput{packages}{packages.tex}%
9+
\hinput{ecosystem}{ecosystem.tex}%
1010
%

0 commit comments

Comments
 (0)