Skip to content

Commit 8dd0409

Browse files
authored
Precommit hook for black (#103)
* add precommit hook * fmt * fix: ci
1 parent 6ee99bc commit 8dd0409

File tree

7 files changed

+44
-7
lines changed

7 files changed

+44
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
run: |
2626
python -m pip install --upgrade pip
2727
pip install -r requirements.txt
28+
pip install -r requirements-dev.txt
2829
2930
- name: Run Pylint
3031
run: |

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 25.1.0
4+
hooks:
5+
- id: black
6+
language_version: python3.10

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
- [2.2. Setup](#22-setup)
4848
- [2.3. Miners](#23-miners)
4949
- [2.4. Validators](#24-validators)
50+
- [2.5. Develop](#25-develop)
5051
* [3. License](#-3-license)
5152

5253
## 🔭 1. Overview
@@ -350,6 +351,15 @@ Please refer to this [guide](./docs/validator_guide.md) for detailed instruction
350351

351352
<sup>[Back to top ^][table-of-contents]</sup>
352353

354+
### 2.5 Develop
355+
356+
```shell
357+
pip install -r requirements-dev.txt
358+
pre-commit install
359+
```
360+
361+
<sup>[Back to top ^][table-of-contents]</sup>
362+
353363
## 📄 3. License
354364

355365
Please refer to the [LICENSE](./LICENSE) file.

alembic/env.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
fileConfig(config.config_file_name)
2121

2222
# Get the individual environment variables
23-
if os.getenv('DB_URL_TEST') is not None:
24-
db_url = os.getenv('DB_URL_TEST')
23+
if os.getenv("DB_URL_TEST") is not None:
24+
db_url = os.getenv("DB_URL_TEST")
2525
else:
2626
db_url = f"postgresql://{os.getenv('POSTGRES_USER')}:{os.getenv('POSTGRES_PASSWORD')}@{os.getenv('POSTGRES_HOST')}:{os.getenv('POSTGRES_PORT')}/{os.getenv('POSTGRES_DB')}"
2727

2828
# Get database URL from environment variable
29-
config.set_main_option('sqlalchemy.url', db_url)
29+
config.set_main_option("sqlalchemy.url", db_url)
3030

3131
# add your model's MetaData object here
3232
# for 'autogenerate' support

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[tool.black]
2+
line-length = 79
3+
exclude = '''
4+
/(
5+
\.git
6+
| \.hg
7+
| \.mypy_cache
8+
| \.tox
9+
| \.venv
10+
| _build
11+
| buck-out
12+
| build
13+
| dist
14+
| env
15+
| venv
16+
| bt_venv
17+
| .eggs
18+
)/
19+
'''

requirements-dev.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pre_commit==4.1.0
2+
pytest>=8
3+
black>=25.1.0
4+
testcontainers>=4.9.0
5+
pylint>=3.3.4

requirements.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
starlette>=0.37.2
22
pydantic>=2
33
rich>=13
4-
pytest>=8
54
numpy>=1
65
setuptools>=68
76
requests>=2
@@ -12,7 +11,4 @@ alembic>=1.14.0
1211
python-dotenv>=1.0.1
1312
psycopg2-binary>=2.9.10
1413
sqlalchemy>=2.0.36
15-
testcontainers>=4.9.0
1614
wandb>=0.19.4
17-
pylint>=3.3.4
18-
black>=25.1.0

0 commit comments

Comments
 (0)