Commit c99c36b8 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

Merge branch 'conda-pre-commit' into 'master'

Use conda for pre-commit hook installation

See merge request !4670
parents f0c7ab34 af332777
Pipeline #75126 passed with stages
in 143 minutes and 20 seconds
......@@ -8,15 +8,10 @@ To clone bliss:
```
git clone https://gitlab.esrf.fr/bliss/bliss.git
```
The first thing to do after cloning bliss is to set up the pre-commit hook:
```
./pre-commit.sh
pre-commit installed at /home/user/bliss/.git/hooks/pre-commit
```
This will cause black to run before any commit is made, ensuring a consistent
code style in the project. For more information, see the
[code formatting](dev_guidelines.md#code-formatting-with-black) section.
The first thing to do after cloning bliss is to set up the pre-commit hook, as explained
in the [code formatting](dev_guidelines.md#code-formatting-with-black) section.
This way, black will run before any commit, ensuring a consistent code style in the project.
Bliss has some dependencies on third-party software. The complete list
of dependencies can be obtained from the `setup.py` script:
......@@ -128,8 +123,8 @@ differences and extensions.
Code formatting is automatically managed by [black](https://black.readthedocs.io/en/stable/).
The project use a specific version of black.
It is part of the development requirements: `conda install --file requirements-dev.txt`.
The project use a specific version of black, which is part of the development requirements:
`conda install --file requirements-dev.txt`.
There is 3 complementary ways to work with black:
......@@ -147,8 +142,9 @@ There is 3 complementary ways to work with black:
```
* Let the pre-commit hook format your changes. Make sure it is properly set up by running:
```
./pre-commit.sh
```bash
# requirements-dev.txt should be installed first
pre-commit install
```
!!! note
......@@ -264,7 +260,7 @@ Guide](http://google.github.io/styleguide/pyguide.html):
!!!note
**Move** takes no final **s** to follow [PEP257 coding
convention](https://www.python.org/dev/peps/pep-0257/#one-line-docstrings)
convention](https://www.python.org/dev/peps/pep-0257/#one-line-docstrings)
**Raises**, **Returns** take a final **s** as they are sphinx keywords.
(Returns has Return as alias so... this is just a quesiton or convention)
......@@ -332,7 +328,6 @@ for ESRF, see: <http://wikiserv.esrf.fr/bliss/index.php/BLISS_Releasing>
├─ spec/
├─ tests/
├─ LICENSE LGPLv3 license description
├─ pre-commit.sh Script to install git-hook to autoformat code with "black"
├─ README.md Documentation entry-point
├─ .gitignore Files to be ignored by git
├─ .gitlab-ci.yml Configuration of the continuous integration workflow
......
#!/bin/bash
# This script installs a pre-commit hook on the local repository
# It allows black to run before any git commit.
# Install pre-commit, with a local install fallback
pip install --quiet --upgrade pre-commit 2>/dev/null \
|| pip install --quiet --user --upgrade pre-commit
# Install the pre-commit hook on the local repository
pre-commit install
......@@ -3,3 +3,4 @@
python >= 3.7, <3.8
black == 22.3
flake8
pre-commit
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment