forked from exp4-age/agepy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added git and venv documenatation from sharepoint
- Loading branch information
Showing
3 changed files
with
257 additions
and
0 deletions.
There are no files selected for viewing
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,172 @@ | ||
:orphan: | ||
|
||
git tutorial | ||
============ | ||
|
||
This is a short introduction to *git*, which is copied from the | ||
`git tutorial`_ on the sharepoint. | ||
|
||
Installation | ||
------------ | ||
|
||
* On Windows: | ||
There are several options for git under Windows. | ||
The Windows PowerShell already supports git, so no installation is really | ||
needed. | ||
|
||
The official standard toolbox is available at https://git-scm.com/, | ||
which gives you the "Git Bash". | ||
|
||
* Linux has git installed on almost all distributions. | ||
|
||
Execute the commands :: | ||
|
||
git config --global user.name "Your name" | ||
git config --global user.email "[email protected]" | ||
|
||
with your name and E-Mail in order to setup your signature for the commits | ||
you will make. | ||
|
||
Using git | ||
--------- | ||
|
||
*Git* is a version control system, which means that it can keep track of the | ||
changes you are making in a project folder (repository). | ||
|
||
To setup a repository, create and go to a project folder with :: | ||
|
||
mkdir path/to/your/project | ||
cd path/to/your/project | ||
|
||
and initialize it:: | ||
|
||
git init | ||
|
||
.. note:: | ||
|
||
If you want to start using git, you probably already have files you want to | ||
add into a repository. However, a repository can not be initialized in a | ||
non-empty folder. To work around this, just create a new folder, initialize | ||
a repository and then copy the existing files/folders into this newly | ||
created repository. | ||
|
||
With :: | ||
|
||
git add -A | ||
|
||
you tell *git* to track all files present in the project folder. | ||
|
||
.. note:: | ||
|
||
You can track only specific files by dropping the ``-A`` and | ||
providing the path to files or folders instead. | ||
|
||
.. note:: | ||
|
||
You can create a file called ``.gitignore`` inside the repository, where | ||
you can specify files and folders, which should not be tracked. This is | ||
useful if you have large data files or a bunch of unimportant files. | ||
|
||
In order to save the state of the added files to the history of the | ||
repository, create a commit with:: | ||
|
||
git commit -m "Some descriptive message" | ||
|
||
For more information on using *git* you can checkout the | ||
`Learn Git Branching`_ interactive tutorial. This is a really nice way to | ||
learn the basics (don't worry, you don't need to do all the chapters - the | ||
first few will already give you a good starting point). | ||
|
||
Commonly used git commands | ||
-------------------------- | ||
|
||
The following list of commands is not complete. It only provides a quick | ||
overview. For a full documentation see the `git docs`_ or use the | ||
command ``git help``. | ||
|
||
* :: | ||
git init <repository name> | ||
|
||
Creates a new folder named <repository name> inside the current folder and | ||
initializes a repository inside this folder. | ||
|
||
* :: | ||
git add <filepattern> | ||
|
||
Adds some files into the local stage part of the repository. Patterns like \* | ||
or \*.py can be used here. | ||
|
||
* :: | ||
git commit -m "<Message>" | ||
|
||
Commits the currently added files with a message into the local repository. | ||
|
||
* :: | ||
git log | ||
|
||
Show the history of a repository. | ||
|
||
* :: | ||
git status | ||
|
||
Show the current status of the repository. Will show files that have been | ||
altered after the last commit. | ||
|
||
* :: | ||
git diff | ||
|
||
Shows detailes about changes made to files. | ||
|
||
* :: | ||
git push <remote> <branch> | ||
|
||
Uploads the given branch (usually master) of the repository to the given | ||
remote (usually origin). | ||
|
||
* :: | ||
git pull | ||
|
||
Downloads the current status of the repository from the configured remote. | ||
|
||
* :: | ||
git clone <remote-address> | ||
|
||
Clones a remote repository into the current local folder. | ||
|
||
* :: | ||
git checkout <branch/commit> | ||
|
||
Loads the status of the repository at a given commit or loads the given | ||
branch. | ||
|
||
* :: | ||
git remote <options> | ||
|
||
Configures or shows the remote repository for this local repository. Will be | ||
configured automatically if the local repository was downloaded via git | ||
clone. | ||
|
||
Ressources | ||
---------- | ||
|
||
* Sharepoint `git tutorial`_ | ||
* official `git docs`_ | ||
* Tutorial `Learn Git Branching`_ | ||
* Online repository storage `GitHub`_ / `GitLab`_ | ||
|
||
.. _git tutorial: https://sharepoint.uni-kassel.de/sites/fb10-exp4/wiki/AGE%20Wiki/git.aspx | ||
.. _Learn Git Branching: https://learngitbranching.js.org/?locale=en_US | ||
.. _git docs: https://git-scm.com/docs | ||
.. _GitHub: https://github.com/ | ||
.. _GitLab: https://gitlab.uni-kassel.de/users/sign_in |
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,77 @@ | ||
:orphan: | ||
|
||
Python virtual environments | ||
=========================== | ||
|
||
This is the `Python Virtual Environments`_ tutorial copied from the sharepoint. | ||
|
||
Why should you use virtual environments for your projects | ||
--------------------------------------------------------- | ||
|
||
Every Python Project should be started with its own virtual environment. | ||
This way, it is easy to restore older projects, share them or work on them with | ||
others. The benefit comes from a clear definition of the packages and versions | ||
(!) used in the project. So older projects can run with older versions of the | ||
packages, i.e., deprecated commands will be no issue. | ||
|
||
How to setup your PC to use virtual environments | ||
------------------------------------------------ | ||
|
||
There are several ways to do it. One way is as follows. Use the Python package | ||
virtualenv together with virtualenvwrapper (on Linux). On Windows you need | ||
virtualenvwrapper-win instead. These packages can be installed via pip. | ||
|
||
Installing the packages | ||
^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
* Linux:: | ||
pip install virtualenv virtualenvwrapper | ||
|
||
* Windows:: | ||
pip install virtualenv virtualenvwrapper-win | ||
|
||
Configuring virtualenvwrapper | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
You need to set up your $PATH variable to include the folder where virtualenv | ||
is located. | ||
|
||
You can configure a path where your environments will be stored. For this, use | ||
the $WORKON_HOME variable. Make sure to use an existing folder. | ||
|
||
Working with virtualenvwrapper | ||
------------------------------ | ||
|
||
Create a new virtual environment via mkvirtualenv <env_name>. You can then | ||
activate this environment via workon <env_name>. Inside the environment you can | ||
install and configure all Python packages you need for your project. It is | ||
highly recommended to save the required packages into a text file via :: | ||
pip freeze > requirements.txt | ||
|
||
inside your project folder. You will be able to restore all required packages | ||
later (or on another computer) via :: | ||
pip install -r requirements.txt | ||
To leave the environment after your work is done, just use ``deactivate``. | ||
|
||
Links to the documentation | ||
-------------------------- | ||
|
||
You can find more information on the packages' sites for `Windows`_ or | ||
`Linux`_. | ||
|
||
Other hints | ||
----------- | ||
|
||
Using virtual environments together with a useful template is really beneficial | ||
for your programming style and others (including your future you) will thank | ||
you for using this. | ||
|
||
|
||
.. _Python Virtual Environments: https://sharepoint.uni-kassel.de/sites/fb10-exp4/wiki/AGE%20Wiki/Python%20Virtual%20Environments.aspx | ||
.. _Windows: https://pypi.org/project/virtualenvwrapper-win/ | ||
.. _Linux: https://virtualenvwrapper.readthedocs.io/en/latest/index.html |