python
This repo contains python scripts and modules which may not be available as package.
installation
Clone the repo:
git clone git@gitlab.phys.ethz.ch:core/python.git
cd python
Install the requirements.
requirements
system
Required minimal packages:
apt install python3
apt install python3-setuptools
apt install python3-pip
Optional packages (these packages will probably be outdated in debian/ubuntu, and may break scripts):
apt install python3-ldap3
apt install python3-gssapi
apt install python3-tabulate
git / pip
Required for modules installation via pip
:
apt install libkrb5-dev # required for `gssapi` module
Required modules in local lib directory:
/usr/bin/pip3 install --upgrade pip
/usr/bin/pip3 install -r requirements-git.txt -t lib/git
/usr/bin/pip3 install -r requirements-pip.txt -t lib/pip
Alternative install from a clean venv (may be needed if you have any conflicting outdated modules installed as packages):
python3 -m venv venv
source venv/bin/activate
pip3 install --upgrade pip
pip3 install -r requirements-git.txt -t lib/git
pip3 install -r requirements-pip.txt -t lib/pip
deactivate
rm -r venv
modules
Store or load modules in these directories:
-
lib/isg/
: modules developed at isg dphys -
lib/git/
: modules installed with git (github) -
lib/pip/
: modules installed with pip
In your script or module the following 2 imports are required in order:
import lib_path
import lib
After that you can import modules from the lib paths, searched in the following order isg
> git
> pip
> system
.`
scripts
Store scripts here:
bin/
collaborating
- Merge requests should be review from at least one other person
- Only merge yourself if you are absolutely sure it does not break anything
feature request
If you would like to have a new feature, script or module, open an issue.
- add title and description
- choose assignee: the person who should do it or
Unassigned
- choose label:
Feature request
- submit
bug report
To report a bug, open an issue.
- add title and description
- choose assignee: the person who should do it or
Unassigned
- choose label:
Bug
- submit
contributing
This gitlab repo will be cloned to many locations, and the master
branch should always be stable. Therefore the master
branch is protected. No one can push to it directly.
To contribute create your own local- branch or a feature/bugfix branch:
git checkout -b newfeature
git push -u origin newfeature
Make your changes and push to your branch:
git add -A
git commit
git push
Git will show you the link to open a pull request:
remote: To create a merge request for local-rda, visit:
remote: https://gitlab.phys.ethz.ch/core/python/merge_requests/new?merge_request%5Bsource_branch%5D=newfeature
You can also go to branches and click Merge request.
- add description: If it closes an issue write the issue nuber it fixes (
Fixes #1
/Closes #1
) - add assignee (optional)
- add label:
Feature
orFix
- submit
Let someone review it and discuss. Changes shows the diff.
Once it is ready to be merged:
- merge it by clicking the green Merge button
- remove source branch now with the Remove Source Branch button
Pull the updated master
branch (which now contains your work):
git checkout master
git pull
You can now also safely remove your feature branch in your own git repo:
git branch -d newfeature