Skip to content

Commit 9f9ede1

Browse files
authored
style: Bump version of pre-commit-hooks and add prettier (#277)
1 parent fb54ec0 commit 9f9ede1

File tree

4 files changed

+37
-68
lines changed

4 files changed

+37
-68
lines changed

.github/README.md

Lines changed: 29 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Q-CTRL Open Controls
22

3-
Q-CTRL Open Controls is an open-source Python package that makes it easy to
4-
create and deploy established error-robust quantum control protocols from the
5-
open literature. The aim of the package is to be the most comprehensive library
6-
of published and tested quantum control techniques developed by the community,
7-
with easy to use export functions allowing users to deploy these controls on:
3+
Q-CTRL Open Controls is an open-source Python package that makes it easy to create and deploy established error-robust quantum control protocols from the open literature. The aim of the package is to be the most comprehensive library of published and tested quantum control techniques developed by the community, with easy to use export functions allowing users to deploy these controls on:
84

95
- Custom quantum hardware
106
- Publicly available cloud quantum computers
@@ -14,23 +10,13 @@ Anyone interested in quantum control is welcome to contribute to this project.
1410

1511
## Installation
1612

17-
Q-CTRL Open Controls can be installed through `pip` or from source. We recommend
18-
the `pip` distribution to get the most recent stable release. If you want the
19-
latest features, then install from source.
13+
Q-CTRL Open Controls can be installed through `pip` or from source. We recommend the `pip` distribution to get the most recent stable release. If you want the latest features, then install from source.
2014

2115
### Requirements
2216

23-
To use Q-CTRL Open Controls you will need an installation of Python (>=3.8, <3.12).
24-
We recommend using the [Anaconda](https://www.anaconda.com/) distribution of
25-
Python. Anaconda includes standard numerical and scientific Python packages
26-
which are optimally compiled for your machine. Follow the [Anaconda
27-
Installation](https://docs.anaconda.com/anaconda/install/) instructions and
28-
consult the [Anaconda User
29-
guide](https://docs.anaconda.com/anaconda/user-guide/) to get started.
17+
To use Q-CTRL Open Controls you will need an installation of Python (>=3.8, <3.12). We recommend using the [Anaconda](https://www.anaconda.com/) distribution of Python. Anaconda includes standard numerical and scientific Python packages which are optimally compiled for your machine. Follow the [Anaconda Installation](https://docs.anaconda.com/anaconda/install/) instructions and consult the [Anaconda User guide](https://docs.anaconda.com/anaconda/user-guide/) to get started.
3018

31-
We use interactive jupyter notebooks for our usage examples. The Anaconda
32-
python distribution comes with editors for these files, or you can [install the
33-
jupyter notebook editor](https://jupyter.org/install) on its own.
19+
We use interactive jupyter notebooks for our usage examples. The Anaconda python distribution comes with editors for these files, or you can [install the jupyter notebook editor](https://jupyter.org/install) on its own.
3420

3521
### Using PyPi
3622

@@ -40,11 +26,9 @@ Use `pip` to install the latest version of Q-CTRL Open Controls.
4026
pip install qctrl-open-controls
4127
```
4228

43-
### From Source
29+
### From source
4430

45-
The source code is hosted on
46-
[GitHub](https://github.com/qctrl/open-controls). The repository can be
47-
cloned using
31+
The source code is hosted on [GitHub](https://github.com/qctrl/open-controls). The repository can be cloned using
4832

4933
```shell
5034
git clone [email protected]:qctrl/open-controls.git
@@ -54,9 +38,7 @@ Once the clone is complete, you have two options:
5438

5539
1. Using Poetry
5640

57-
Follow the instructions from the
58-
[Poetry documentation](https://python-poetry.org/docs/#installation) to
59-
install Poetry.
41+
Follow the instructions from the [Poetry documentation](https://python-poetry.org/docs/#installation) to install Poetry.
6042

6143
After you have installed Poetry, use:
6244

@@ -75,61 +57,56 @@ Once the clone is complete, you have two options:
7557
rm requirements.txt
7658
```
7759

78-
Once installed via one of the above methods, test your installation by running
79-
`pytest` in the `open-controls` directory.
60+
Once installed via one of the above methods, test your installation by running `pytest` in the `open-controls` directory.
8061

8162
```shell
8263
pytest
8364
```
8465

8566
## Usage
8667

87-
See the [Jupyter notebooks examples](../examples) and the
88-
[Q-CTRL Open Controls reference documentation](https://docs.q-ctrl.com/open-controls/references/qctrl-open-controls/).
68+
See the [Jupyter notebooks examples](../examples) and the [Q-CTRL Open Controls reference documentation](https://docs.q-ctrl.com/open-controls/references/qctrl-open-controls/).
8969

9070
## Contributing
9171

9272
For general guidelines, see [Contributing](https://code.q-ctrl.com/contributing).
9373

9474
### Building documentation
9575

96-
Documentation generation relies on [Sphinx](http://www.sphinx-doc.org).
97-
The reference documentation for the latest released version of
98-
Q-CTRL Open Controls is hosted online in the
99-
[Q-CTRL documentation website](https://docs.q-ctrl.com/open-controls/references/qctrl-open-controls/).
76+
Documentation generation relies on [Sphinx](http://www.sphinx-doc.org). The reference documentation for the latest released version of Q-CTRL Open Controls is hosted online in the [Q-CTRL documentation website](https://docs.q-ctrl.com/open-controls/references/qctrl-open-controls/).
10077

10178
To build it locally:
10279

10380
1. Ensure you have used one of the install options above.
10481
1. Execute the make file from the docs directory:
10582

106-
If using Poetry:
83+
If using Poetry:
10784

108-
```bash
109-
cd docs
110-
poetry run make html
111-
```
85+
```bash
86+
cd docs
87+
poetry run make html
88+
```
11289

113-
If using pip:
90+
If using pip:
11491

115-
```bash
116-
cd docs
117-
# Activate your virtual environment if required
118-
make html
119-
```
92+
```bash
93+
cd docs
94+
# Activate your virtual environment if required
95+
make html
96+
```
12097

12198
The generated HTML will appear in the `docs/_build/html` directory.
12299

123100
### Formatting, linting, and static analysis
124101

125102
Code is formatted, linted and checked using the following tools:
103+
126104
- [Black](https://github.com/psf/black)
127105
- [Pylint](https://pypi.org/project/pylint/)
128106
- [isort](https://github.com/timothycrosley/isort)
129107
- [mypy](http://mypy-lang.org/)
130108

131-
These checks are run on all code merged to master, and may also be run locally from the open-controls
132-
directory:
109+
These checks are run on all code merged to master, and may also be run locally from the open-controls directory:
133110

134111
```shell
135112
pip install black isort mypy pylint
@@ -139,39 +116,29 @@ black --check .
139116
pylint .
140117
```
141118

142-
Note that you can speed up the execution of Pylint by running it in the parallel mode with the `-j`
143-
option: `pylint -j 0 .`.
144-
See the [official documentation](https://pylint.readthedocs.io/en/latest/user_guide/usage/run.html#parallel-execution)
145-
for details.
119+
Note that you can speed up the execution of Pylint by running it in the parallel mode with the `-j` option: `pylint -j 0 .`. See the [official documentation](https://pylint.readthedocs.io/en/latest/user_guide/usage/run.html#parallel-execution) for details.
146120

147-
Black and isort, in addition to checking code, can also automatically apply fixes. To fix all code
148-
in the open-controls tree, run:
121+
Black and isort, in addition to checking code, can also automatically apply fixes. To fix all code in the open-controls tree, run:
149122

150123
```shell
151124
isort
152125
black .
153126
```
154127

155-
You can also run these checks only in the files that you changed by using the
156-
`pre-commit` tool. To use it, run:
128+
You can also run these checks only in the files that you changed by using the `pre-commit` tool. To use it, run:
157129

158130
```shell
159131
pip install pre-commit
160132
pre-commit install
161133
```
162134

163-
With this, the checks will run every time that you commit code with
164-
`git commit`. If you prefer to run the checks every time that you push changes
165-
instead of when you commit changes, use `pre-commit install -t pre-push`.
135+
With this, the checks will run every time that you commit code with `git commit`. If you prefer to run the checks every time that you push changes instead of when you commit changes, use `pre-commit install -t pre-push`.
166136

167-
If you no longer wish to use `pre-commit`, you can uninstall it by running
168-
`pre-commit uninstall` in the `open-controls` directory (or by running
169-
`pre-commit uninstall -t pre-push`, if you used the pre-push hooks).
137+
If you no longer wish to use `pre-commit`, you can uninstall it by running `pre-commit uninstall` in the `open-controls` directory (or by running `pre-commit uninstall -t pre-push`, if you used the pre-push hooks).
170138

171139
## Credits
172140

173-
See
174-
[Contributors](https://github.com/qctrl/open-controls/graphs/contributors).
141+
See [Contributors](https://github.com/qctrl/open-controls/graphs/contributors).
175142

176143
## License
177144

.pre-commit-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.4.0
5+
rev: v4.4.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
@@ -39,3 +39,8 @@ repos:
3939
# when passing in a single file as argument the ignore entry in the .pylintrc does
4040
# not seem to be considered.
4141
exclude: .*(venv|\.conf\.py)
42+
- repo: https://github.com/pre-commit/mirrors-prettier
43+
rev: v3.0.0
44+
hooks:
45+
- id: prettier
46+
files: .*(\.js|\.graphql|\.json|\.md)$

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
proseWrap: "never"

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Q-CTRL Open Controls
22

3-
Q-CTRL Open Controls is an open-source Python package that makes it easy to
4-
create and deploy established error-robust quantum control protocols from the
5-
open literature. The aim of the package is to be the most comprehensive library
6-
of published and tested quantum control techniques developed by the community,
7-
with easy to use export functions allowing users to deploy these controls on:
3+
Q-CTRL Open Controls is an open-source Python package that makes it easy to create and deploy established error-robust quantum control protocols from the open literature. The aim of the package is to be the most comprehensive library of published and tested quantum control techniques developed by the community, with easy to use export functions allowing users to deploy these controls on:
84

95
- Custom quantum hardware
106
- Publicly available cloud quantum computers

0 commit comments

Comments
 (0)