GitHub
Webhooks
Found on the left bar on github website.
Define an event (e.g. push) that triggers a call to a website that I created. The event will call the website and send a json file with information from github. Then this website will receive the json file from github and perform things e.g. git pull and then generate pages from the files...
git stash
Take the local changes, keep them aside, and return to the latest committed version.
git stash
The changes were not lost.
Now I can
git pull
Bring my changes back from stash to my working directory.
git stash pop
The stash is a stack that keeps several changes. To see all changes:
git stash list
To see the most recent change in the stash
git stash show -p
To see a change in a specific stash in the stack
git stash show 1
Remove the most recent change from stash
git stash drop
Remove a specific change from the stash
git stash drop 1
Stash pop might also cause a merge conflict which needs to be resolved. In that case, the change will not be removed from the stash.
Docker playground
https://github.com/szabgab/playground
We can use @szabgab docker as playground
alias dr='docker run -it --rm --workdir /opt -v$(pwd):/opt szabgab/playground:latest bash'
dr
dr
Run an image
docker run imagename:version
If the image does not exist locally it will be downbloaded first from docker hub and then run.
Build a docker from a Docker file
docker build -t username/dockername:version
Run a project from git inside docker
Use @szabgab playground docker
dr
Or use some other docker image
docker run -it --rm --workdir /opt -v$(pwd):/opt python:3.11 bash
To explore the project we can look at the github folder, and we might find the ci tests.
make and Makefile
Run shell commands with dependencies
Instead of README.md - the Makefile contains all the commands to be run, and executing make
will run these commands.
make
is the command and Makefile
is a file that contains commands. Each set of commands have some tag. So one might run the specific set of commands in a tag
make sometag
Example for the Makefile
init:
pip install -r requirements.txt
ci:
pytest tests
So to run the ci
make ci
tox
a tool to run tests on several versions of python
Coverage report for tests
First install
pip install pytest pytest-random-order pytest-coverage
pytest -svv --random-order --cov-branch cov-report html cov-report term cov somedir......
random-order
runs functions on random order to make sure functions are not dependent on each other
cov-report html
will generate the report in html format
cov-report term
will send the report to the terminal
cov-branch
Branch coverage
In case we have an if command in the code, or loop or something along these lines, it means that depending on the data transferred to the function the code inside the if or loop might be executed or not. So the cov-branch will report in case we have several "branches" in the code, and the coverage for all branches.
contribute to pydigger
- Look at the list of missing stuff.
- Pick a project.
- Go to the github of the project.
- make a change on the project's github (e.g. add the author to the setup.py file)
- Send a pull request
- Once the author of the project accepts the change and place it on pypi, pydigger will retrieve the change and be updated accordingly.
Top comments (0)