Difference between revisions of "Imperial DIRAC Development"
(5 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
+ | <p style="color:red">'''This Wiki page has been frozen and will soon become obsolete. The current version can be found under [https://github.com/ic-hep/gridpp-dirac-users/wiki https://github.com/ic-hep/gridpp-dirac-users/wiki].'''</p> | ||
+ | |||
So you need to patch things ..... | So you need to patch things ..... | ||
Line 54: | Line 56: | ||
</pre> | </pre> | ||
All good ? Now push your changes back to git. | All good ? Now push your changes back to git. | ||
+ | |||
+ | |||
+ | '''New as of Oct 2022: pyupgrade''' | ||
+ | |||
+ | <pre> | ||
+ | source diracos/diracosrc | ||
+ | (if not installed:) pip install pyupgrade | ||
+ | </pre> | ||
+ | check in .pre-commit-config.yaml for options | ||
+ | <pre> | ||
+ | (base) lxxx:DIRAC > pyupgrade --py39-plus src/DIRAC/Interfaces/scripts/dls.py | ||
+ | Rewriting src/DIRAC/Interfaces/scripts/dls.py | ||
+ | git diff src/DIRAC/Interfaces/scripts/dls.py | ||
+ | </pre> | ||
+ | Now decide whether to accept the re-write or do something even more clever. | ||
+ | |||
+ | |||
+ | '''Committing code back to DIRAC''' | ||
+ | |||
+ | A note on DIRAC commit messages: These must start with "fix:", "feat:" or "docs:". | ||
+ | |||
+ | Pull requests must start with the release in [] in the title: "[8.0] Make everything better". | ||
+ | |||
+ | If you need to amend a 'faulty' commit message in DIRAC | ||
+ | (assuming this was the last commit) | ||
+ | <pre> | ||
+ | git rebase -i HEAD^ | ||
+ | amend 'pick' to 'reword' (do not change the message) | ||
+ | this will re-open commit message: edit and save | ||
+ | git push --force | ||
+ | </pre> | ||
+ | '''Re-basing your code, simplest case'''<br> | ||
+ | Make sure your upstream is set correctly, if not set it: | ||
+ | <pre> | ||
+ | git remote add upstream https://github.com/DIRACGrid/DIRAC.git | ||
+ | git remote -v | ||
+ | origin git@github.com:ic-hep/DIRAC.git (fetch) | ||
+ | origin git@github.com:ic-hep/DIRAC.git (push) | ||
+ | upstream https://github.com/DIRACGrid/DIRAC.git (fetch) | ||
+ | upstream https://github.com/DIRACGrid/DIRAC.git (push) | ||
+ | </pre> | ||
+ | You must fetch your upstream before doing anything: | ||
+ | <pre> | ||
+ | git fetch upstream | ||
+ | </pre> | ||
+ | In the simplest case, i.e. you are developing against rel-v8r0 and just need to re-base against the most up to date version of this branch: | ||
+ | <pre> | ||
+ | git rebase upstream/rel-v8r0 | ||
+ | Successfully rebased and updated refs/heads/comdirac_merge | ||
+ | </pre> | ||
+ | Afterwards git status should look approximately like this: | ||
+ | <pre> | ||
+ | (base) lx04:DIRAC > git status | ||
+ | On branch comdirac_merge | ||
+ | Your branch and 'origin/comdirac_merge' have diverged, | ||
+ | and have 103 and 9 different commits each, respectively. | ||
+ | </pre> | ||
+ | Now push it back: | ||
+ | <pre> | ||
+ | git push -f | ||
+ | </pre> | ||
+ | and check the branch on github to make sure it all still looks reasonable. | ||
+ | (If it doesn't, blame Simon and ask him to fix it.) |
Latest revision as of 13:56, 25 June 2024
This Wiki page has been frozen and will soon become obsolete. The current version can be found under https://github.com/ic-hep/gridpp-dirac-users/wiki.
So you need to patch things .....
Installing UI in development mode
Example: Testing the branch 'comdirac_merge' agaist diracdev.
git clone git@github.com:ic-hep/DIRAC.git cd DIRAC git checkout comdirac_merge cd .. curl -LO https://github.com/DIRACGrid/DIRACOS2/releases/latest/download/DIRACOS-Linux-$(uname -m).sh bash DIRACOS-Linux-$(uname -m).sh rm DIRACOS-Linux-$(uname -m).sh source diracos/diracosrc pip install -e DIRAC dirac-proxy-init -x -N dirac-configure -F -S GridPP -C dips://diracdev.grid.hep.ph.ic.ac.uk:9135/Configuration/Server -I
Building readthedocs locally
source diracos/diracosrc cd DIRAC/docs/source micromamba create -n docs -f environment.yml micromamba activate docs export READTHEDOCS=True python -m sphinx -T -E -W --keep-going -b html -d _build/doctrees -D language=en . _build/html
When finished copy the html directory somewhere easily accessible by the internet.
pylint
pylint-3 --rcfile .pylintrc src/DIRAC/Interfaces/scripts/dls.py
Not ideal, but will catch most problems.
Blacking your files (low key approach)
File to be formatted: src/DIRAC/Interfaces/scripts/dls.py This is for v8 onwards, so we are only interested in py3.
source diracos/diracosrc cd DIRAC git status (Find files you want to black. Do a commit if you think black might mangle your files beyond recovery.) pip install black (if not done previously) black -t py39 -l 120 src/DIRAC/Interfaces/scripts/dls.py if black has reformatted your file: git diff src/DIRAC/Interfaces/scripts/dls.py
All good ? Now push your changes back to git.
New as of Oct 2022: pyupgrade
source diracos/diracosrc (if not installed:) pip install pyupgrade
check in .pre-commit-config.yaml for options
(base) lxxx:DIRAC > pyupgrade --py39-plus src/DIRAC/Interfaces/scripts/dls.py Rewriting src/DIRAC/Interfaces/scripts/dls.py git diff src/DIRAC/Interfaces/scripts/dls.py
Now decide whether to accept the re-write or do something even more clever.
Committing code back to DIRAC
A note on DIRAC commit messages: These must start with "fix:", "feat:" or "docs:".
Pull requests must start with the release in [] in the title: "[8.0] Make everything better".
If you need to amend a 'faulty' commit message in DIRAC (assuming this was the last commit)
git rebase -i HEAD^ amend 'pick' to 'reword' (do not change the message) this will re-open commit message: edit and save git push --force
Re-basing your code, simplest case
Make sure your upstream is set correctly, if not set it:
git remote add upstream https://github.com/DIRACGrid/DIRAC.git git remote -v origin git@github.com:ic-hep/DIRAC.git (fetch) origin git@github.com:ic-hep/DIRAC.git (push) upstream https://github.com/DIRACGrid/DIRAC.git (fetch) upstream https://github.com/DIRACGrid/DIRAC.git (push)
You must fetch your upstream before doing anything:
git fetch upstream
In the simplest case, i.e. you are developing against rel-v8r0 and just need to re-base against the most up to date version of this branch:
git rebase upstream/rel-v8r0 Successfully rebased and updated refs/heads/comdirac_merge
Afterwards git status should look approximately like this:
(base) lx04:DIRAC > git status On branch comdirac_merge Your branch and 'origin/comdirac_merge' have diverged, and have 103 and 9 different commits each, respectively.
Now push it back:
git push -f
and check the branch on github to make sure it all still looks reasonable. (If it doesn't, blame Simon and ask him to fix it.)