Skip to content

Commit

Permalink
change help to codeblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajtospoga01 committed Dec 18, 2023
1 parent cef1b10 commit 0f5547a
Showing 1 changed file with 64 additions and 46 deletions.
110 changes: 64 additions & 46 deletions docs/source/help/get_started/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,49 @@ Use the following vs code extensions:
### General Python Commands
It may be necessary to replace 'python' with 'python3', 'py', or 'py3' depending on your system.
To run a python script via the command line use command:
>python 'script_name'.py
```bash
python 'script_name'.py
```
To install a package to the virtual environment use command:
>python -m pip install 'package_name'
```bash
python -m pip install 'package_name'
```
To create a requirements folder use command:
>python -m pip freeze > requirements.txt
```bash
python -m pip freeze > requirements.txt
```
To install a packages specfied in a file called requiremnts.txt use command:
>python -m pip install -r requirements.txt
```bash
python -m pip install -r requirements.txt
```
To run unittests use command:


### Python Virtual Environments

To create a virtual envrionment called venv_name (typically just called "venv") use command:
>python -m venv 'venv_name'
```bash
python -m venv 'venv_name'
```
To activate the virtual environment located in folder venv_name on windows cmd use command:
>'venv_name'\Scripts\activate
```bash
'venv_name'\Scripts\activate
```
To activate the virtual environment located in folder "venv_name" in a bash terminal use command:
>'venv_name'\bin\activate
```bash
'venv_name'\bin\activate
```
Once the virtual environment is active the bash or cmd terminal will indicate this by showing (venv_name) at the command prompt. The active virtual enviornment is a normal python environment and you interact with it exactly like a normal python installtion. To install a package to the virtual environment use command is the same as for normal Python (see above).

### Unittests
If python code files are located in a 'src' directory and tests are located in a 'tests' directory, then the following command can be used to run all tests in the 'tests' directory:
>python -m unittest discover -s tests
```bash
python -m unittest discover -s tests
```
To run a specific test file use command:
>python -m unittest tests.'test_file_name'
```bash
python -m unittest tests.'test_file_name'
```
## Git Notes


Expand All @@ -65,41 +74,46 @@ To run a specific test file use command:
### Setting up Git for the first time

Once git is installed on your computer, you will need to set up your git account. To do this, open a terminal and type the following commands:

>git config --global user.name "Your Name"
>git config --global user.email "
```bash
git config --global user.name "Your Name"
git config --global user.email "
```
To get github to save your password you will use the git credential manager, if you are on windows then you can install this while installing git. If you are on linux or mac then you will need to install this seperately. To install this on linux or mac use the following commands:
>brew install git-credential-manager
```bash
brew install git-credential-manager
```
Followed by:

> git-credential-manager install
```bash
git-credential-manager install
```
### General Git Commands
Always update your local copy of a repository to the current github copy using command while located in the directory on the terminal:
>git pull
```bash
git pull
```
### Preparing a local branch to contribute to an existing repository
First get a local copy of the repository by cloning the existing repository, to do this you require the web url from github e.g. For this repo: https://github.com/guorbit/software_template.git (Note address should end in '.git'). Then use command:

>git clone "https_address"
```bash
git clone "https_address"
```
The second step is to setup a development branch on which you will develop your code, this has 3 stages:
1. create a nwe local branch
2. switch to this local branch
3. push (inform repository of new branch) to github
To create a new local branch use command below. Note, the quatation marks should not be added, and the branch name shoud have no spaces.
>git branch 'new_branch_name'
```bash
git branch 'new_branch_name'
```
To switch to this branch use command:
>git switch 'new_branch_name'
```bash
git switch 'new_branch_name'
```
To push this branch to github use command:
>git push -u origin 'new_branch_name'
```bash
git push -u origin 'new_branch_name'
```
After this you should be able to see the new branch on the github website in the repository by clicking the branch dropdown menu at the top left.
### Pushing code to the repository
Expand All @@ -109,17 +123,21 @@ The easiest way to push code to a Github repository is to use VS codes inbuilt g
3. push all stored commits to github
To add a specfic file called file_name to the current commit use command:
>git add "file_name"
```bash
git add "file_name"
```
To add all changes to the current commit use command:
>git add .
```bash
git add .
```
To commit changes use command below. Note, in this case the quatation marks around the message are mandatory:
>git commit -m "your message"
```bash
git commit -m "your message"
```
Finally, to push all stored commits to github use command:
>git push
```bash
git push
```
### Creating a pull request
A pull request is a request to merge your current branch into the main/master branch. To create a pull request on github, first push your code to github (see above). Then go to the github website and click on the "pull requests" tab. Then click "new pull request". Then select the branch you want to merge into the main branch. Then click "create pull request". Then add a title and description to the pull request. Then click "create pull request".
Expand Down

0 comments on commit 0f5547a

Please sign in to comment.