Skip to content

Commit aca722e

Browse files
Merge pull request #6 from SmartMonkey-git/rr/readme/add-extensive-ruff
Add extensive ruff explanation
2 parents f83e9bb + 9d41143 commit aca722e

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
## How to use this template
2+
To the top right-hand side of this repository, you will find a button labeled $${\color{green}Use \space this \space Template}$$. Press it and then click on ``Create a new repository``. This will copy the contents of the repository to your account.
13
## Robinson Group Python Template
24
This repo serves as a template for python projects in the [Robinson Group](https://robinsongroup.github.io/) of the BIH.
35
To get started copy or fork this project and follow the steps below.
4-
### Install conda
6+
## Install conda
57
If you not already have conda, miniconda or Anaconda installed. Check out the [miniconda installation guide](https://www.anaconda.com/docs/getting-started/miniconda/install#quickstart-install-instructions).
68

7-
#### Setup env
9+
### Setup env
810
Open `requirements/environment.yml` and adjust `<Project-Name>`.
911

1012
To create and activate the env execute:
@@ -14,15 +16,15 @@ conda env create -f requirements/environment.yml
1416
conda activate <Project-Name>
1517
```
1618

17-
### Basic Setup
19+
## Basic Setup
1820
As this is a template project, some of the directories and setting have generic names. To ensure the project is set up, that it aligns with your intended name please:
1921

2022
1. Rename the folder inside of src
2123
2. Open the pyproject.toml
2224
- Rename all variables in the sections ``[project]`` and ``[project.urls]``
2325
3. Depending on your needs, you should change the LICENSE of this repository. Default is MIT.
2426

25-
### Ruff Linting and Formatting
27+
## Ruff Linting and Formatting
2628
Ruff helps to maintain the same code style and prevent the most common bugs in our code base. Keeping the code style uniform simplifies the collaboration - it is much easier to review a pull request without hundreds of whitespace changes.
2729

2830
Please take a moment to learn how to use the IDE plugins. In PyCharm, the formatting action can be invoked with right-clicking at any code location and the same applies for VS Code. The keyboard shortcuts are also available. However, it is recommended to format and lint on saving a file.
@@ -39,8 +41,27 @@ ruff check
3941
```
4042
We recommend to run commit the resulting changes before opening a PR, because the unformatted code will fail the Continuous Integration (CI) pipeline. A PR cannot be merged until the code passes the CI.
4143

42-
#### Ruff Plugins
44+
### Ruff Plugins
45+
This section will explain how to set up ruff for your choosen IDE.
46+
#### Pycharm
47+
To get ruff automatically running install the following Plugin:
4348
- [Pycharm - Ruff Plugin](https://plugins.jetbrains.com/plugin/20574-ruff)
49+
50+
To use the plugin, make sure that PyCharm has the environment assigned that contains the ruff installation.
51+
52+
##### **Configs:**
53+
54+
![img.png](readme_images/ruff_config.png)
55+
56+
You can find out if ruff works by violating one of the rules. Should you do so, you will see a yellow squirrelly line. An easy way to violate one of the rules is to put a
57+
``print`` statement somewhere.
58+
59+
Then you will see something like this:
60+
61+
![img.png](readme_images/ruff_violation.png)
62+
63+
#### VSCode
64+
To get ruff automatically running install the following Plugin:
4465
- [VSCode - Ruff Plugin](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)
4566

4667
### Continuous Delivery
@@ -50,6 +71,6 @@ that will build and upload your packages to Pypi for you. To get the CD running
5071
Then open your repository page on Github. To the right you should find **Create new Release**. Press it!
5172

5273
You will find this page:
53-
![img.png](release_page.png)
74+
![img.png](readme_images/release_page.png)
5475

5576
Create a new Tag for your release, add a title and a description. If you are still unsure what to do check out the [github release how-to](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release). Press **Publish release**, watch the CD launch in the **Actions Tab** and enjoy your well deserved coffee. ☕

readme_images/ruff_config.png

132 KB
Loading

readme_images/ruff_violation.png

12.2 KB
Loading

src/project_name/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)