First changes to markdown file README.md to include information on git workflow and conda environments

This commit is contained in:
daviditschan committed 2026-06-09 10:45:07 +02:00
1 parent 0372977f0b
commit b68d499409
1 file changed
+40
+40
View File
@@ -0,0 +1,40 @@
# Welcome!
Hello! This is the read-me file with some important information for the code project.
# Coding help
## Conda
Extensive documentation is available on [docs.conda.io](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html).
1. Get info on conda environments: `conda info --envs` or `conda env list`;
2. Create new conda environments: `conda create --name <my_env>` where `<my_env>` is replaced with the name; Additional flags include `python=3.0.0` indicating the python version;
3. Creating an environment from a `.yaml` file: `conda create --name <my_env> --file path/to/file/environment.yaml`, or navigate directly to the good location via `cd path/to/file`;
4. Exporting a python environment to a `.yml` file: `conda env export --name <my_env> --format=environment-yaml --file=environment.yaml`;
5. Updating an environment: `conda env update --file environment.yaml --prune`, where `--prune` removes any unused dependencies;
6. Activating a conda environment: `conda activate <my_env>`;
7. Deactivate an environment: `conda deactivate`;
8. List packages in environment: if the environment is not activated, run `conda list -n <my_env>`, else (if it is activated) run `conda list`;
9. Add a channel: `conda config --prepend channels new_channel` to add a channel to top of the channel list, or run `conda config --append channels new_channel` to append a channel to the bottom of the channel list;
10. Installing packages: `conda install --name <my_env> numpy scipy ...` to install packages `numpy`, `scipy` etc. into the environment `<my_env>`; Package versions may be specified like this `numpy=3.4.2`;
11. Update packages: run `conda update --name <my_env> package` to update `package` in `<my_env>`; updating python is `conda update python` and updating conda itself is `conda update conda`;
12. Pinning a package: add a file named `pinned` to the `conda-meta` directory of the enviornment, and add the following lines to the file `package 1.7.*` to restrict the package to remain in the `1.7` series, or `package==1.5.4` to force the package to remain at exactly the specified version; The pinning may be overrun by `conda update package --no-pin`.
13. Remove package: `conda remove -n <my_env> package` to remove `package` from `<my_env>`;
## Git
This ensures that there is a connection to the psi network, use the vpn domain `vpn.psi.ch`.
1. Add the private key to the ssh agent via the following snippet on mac
```
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<name_of_key>
ssh -T git@gitea.psi.ch
```
or windows
```
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<name_of_key>
ssh -T git@gitea.psi.ch
```
2. To create a local repository, clone the remote one via `git clone git@gitea.psi.ch:tschan_d/Master_Thesis.git`. This command creates a new local folder named `repo`, initialises a git repo within it, a remote named `origin` is created, pointing to the connected server, all of the files and and commits are downloaded and the default branch is checked out.
3. Use `git fetch git@gitea.psi.ch:tschan_d/Master_Thesis.git` to retrieve new work on the remote, without merging everything into the local branches.
4. use `git merge REMOTE-NAME/BRANCH-NAME` to merge a remote branch with the local branch.
5. Steps 3 and 4 may be executed more succinctly via `git pull REMOTE-NAME BRANCH-NAME` to grab online updates and merge them into the local branches.