Skip to content

Commit e9d1c1d

Browse files
authored
Merge pull request #80 from bleykauf/feature/use-ruff
Replace isort/flake8/black with ruff
2 parents e6a0bc7 + dc9c47c commit e9d1c1d

File tree

9 files changed

+29
-41
lines changed

9 files changed

+29
-41
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 25.1.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.9.9
44
hooks:
5-
- id: black
6-
7-
- repo: https://github.com/pycqa/isort
8-
rev: 6.0.1
9-
hooks:
10-
- id: isort
5+
- id: ruff
6+
args: [--fix]
7+
- id: ruff-format

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
![Test Status](https://github.com/bleykauf/aisim/actions/workflows/workflow.yml/badge.svg)
44
![Test Coverage](https://raw.githubusercontent.com/bleykauf/aisim/master/docs/coverage.svg)
55
[![Documentation Status](https://readthedocs.org/projects/aisim/badge/?version=latest)](https://aisim.readthedocs.io/en/latest/?badge=latest)
6-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
76

87
AISim ‒ Simulations for light-pulse atom interferometry
98
=======================================================

aisim/prop.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ def _index_shift(self):
266266
return index_shift_matrix
267267

268268
def _prop_matrix(self, atoms):
269-
assert (
270-
atoms.state_kets.shape[1] == 2 * self.n_pulses
271-
), "Number of states must be twice the number of pulses."
269+
assert atoms.state_kets.shape[1] == 2 * self.n_pulses, (
270+
"Number of states must be twice the number of pulses."
271+
)
272272

273273
u_two_level = super()._prop_matrix(atoms)
274274
u = self._block_diag(u_two_level, self.n_pulses)

docs/CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ We welcome everybody to help by reporting bugs or making suggestions via our
77

88
Code style
99
----------
10-
We use the `black <https://black.readthedocs.io/en/stable/index.html>`__code style.
10+
We use the `ruff <https://github.com/astral-sh/ruff>`__code formatter and linter.
1111

1212
Testing
1313
-------

docs/examples/basic-usage.ipynb

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

docs/examples/multiport-ai.ipynb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
16-
"%matplotlib inline\n",
17-
"\n",
1816
"import numpy as np\n",
1917
"\n",
2018
"import aisim as ais"
@@ -173,7 +171,7 @@
173171
{
174172
"data": {
175173
"text/plain": [
176-
"[0.465166693003362, 0.0, 0.0, 0.0, 0.0, 0.534833306996638]"
174+
"[0.4726310895777855, 0.0, 0.0, 0.0, 0.0, 0.5273689104222146]"
177175
]
178176
},
179177
"execution_count": 6,
@@ -210,12 +208,12 @@
210208
{
211209
"data": {
212210
"text/plain": [
213-
"[0.10469171680133398,\n",
211+
"[0.11123080212838952,\n",
214212
" 0.0,\n",
215-
" 0.39920486834428104,\n",
216-
" 0.36047497620202806,\n",
213+
" 0.38155435087015555,\n",
214+
" 0.36140028744939595,\n",
217215
" 0.0,\n",
218-
" 0.13562843865235696]"
216+
" 0.14581455955205894]"
219217
]
220218
},
221219
"execution_count": 8,
@@ -259,7 +257,7 @@
259257
{
260258
"data": {
261259
"text/plain": [
262-
"[0.013478798496272988, 0.746201046050036]"
260+
"[0.012668168137841305, 0.7302864701817102]"
263261
]
264262
},
265263
"execution_count": 10,

docs/examples/rabi-oscillations.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@
298298
{
299299
"data": {
300300
"text/plain": [
301-
"<matplotlib.legend.Legend at 0x14bca3a10>"
301+
"<matplotlib.legend.Legend at 0x107865550>"
302302
]
303303
},
304304
"execution_count": 11,
1.65 KB
Loading

pyproject.toml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,20 @@ dynamic = ["version"]
2626

2727
[project.optional-dependencies]
2828
dev = [
29-
"black>=24.10.0",
30-
"flake8>=7.1.1",
31-
"flake8-pyproject>=1.2.3",
32-
"isort>=5.13.2",
29+
"ruff>=0.9.9",
3330
"pre-commit>=4.1.0",
3431
"pytest>=8.3.4",
3532
"setuptools_scm>=8.1.0",
3633
]
37-
docs = ["sphinx", "nbsphinx", "pygments>=2.4", "sphinx_rtd_theme"]
34+
docs = [
35+
"sphinx>=8.2.1",
36+
"nbsphinx>=0.9.6",
37+
"pygments>=2.4",
38+
"sphinx_rtd_theme>=3.0.2",
39+
]
3840

3941
[tool.setuptools_scm]
4042

4143
[project.urls]
4244
homepage = "https://github.com/bleykauf/aisim/"
4345
repository = "https://github.com/bleykauf/aisim/"
44-
45-
[tool.flake8]
46-
max-line-length = 88
47-
extend-ignore = "E203"
48-
docstring-convention = "numpy"
49-
50-
[tool.isort]
51-
profile = "black"

0 commit comments

Comments
 (0)