Skip to content

Commit 84694f6

Browse files
committed
Add pre-commit configs for repository
Signed-off-by: Anish Asthana <anishasthana1@gmail.com>
1 parent 12057e9 commit 84694f6

File tree

23 files changed

+41
-29
lines changed

23 files changed

+41
-29
lines changed

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.2.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/psf/black
12+
rev: 23.3.0
13+
hooks:
14+
- id: black
15+
language_version: python3.8

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ Can be installed via `pip`: `pip install codeflare-sdk`
1919

2020
We recommend using Python 3.8 for development.
2121
Install development specific dependencies:
22-
`$ pip install poetry pytest pytest-mock coverage black==22.3.0`
22+
`$ pip install pre-commit poetry pytest pytest-mock coverage black==22.3.0`
2323

2424
Additional dependencies can be found in `requirements.txt`: `$ pip install -r requirements.txt`
2525

26+
### Pre-commit
27+
28+
We use pre-commit to make sure the code is consistently formatted. To make sure that pre-commit is run every time you commit changes, simply run `pre-commit install`
29+
2630
### Testing
2731

2832
- To run the unit tests, run `pytest -v tests/unit_test.py`

custom-nb-image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ COPY requirements.txt requirements.txt
2020

2121
RUN pip install -r requirements.txt
2222

23-
RUN pip uninstall pickle5 -y
23+
RUN pip uninstall pickle5 -y
2424

2525
# Install codeflare-sdk and other libraries
2626
RUN pip install codeflare-sdk==0.4.1 \

custom-nb-image/imagestream.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ metadata:
2020
opendatahub.io/notebook-image: 'true'
2121
annotations:
2222
opendatahub.io/notebook-image-name:
23-
"Codeflare Notebook"
24-
opendatahub.io/notebook-image-desc: "Custom Jupyter notebook image with codeflare SDK, Python 3.8, Ray 2.1.0 and PyTorch 1.12.1"
23+
"CodeFlare Notebook"
24+
opendatahub.io/notebook-image-desc: "Custom Jupyter notebook image with CodeFlare SDK, Python 3.8, Ray 2.1.0 and PyTorch 1.12.1"
2525
spec:
2626
lookupPolicy:
2727
local: true
@@ -32,8 +32,5 @@ spec:
3232
from:
3333
kind: DockerImage
3434
name: quay.io/project-codeflare/notebook:latest
35-
name: "latest"
36-
referencePolicy:
37-
type: Source
3835
importPolicy:
3936
scheduled: true

demo-notebooks/batch-job/mnist.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
class LitMNIST(LightningModule):
4040
def __init__(self, data_dir=PATH_DATASETS, hidden_size=64, learning_rate=2e-4):
41-
4241
super().__init__()
4342

4443
# Set our init args as class attributes
@@ -119,7 +118,6 @@ def prepare_data(self):
119118
MNIST(self.data_dir, train=False, download=True)
120119

121120
def setup(self, stage=None):
122-
123121
# Assign train/val datasets for use in dataloaders
124122
if stage == "fit" or stage is None:
125123
mnist_full = MNIST(self.data_dir, train=True, transform=self.transform)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pytorch_lightning==1.5.10
22
ray_lightning
33
torchmetrics==0.9.1
4-
torchvision==0.12.0
4+
torchvision==0.12.0

docs/cluster/auth.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
4949
The auth sub-module contains the definitions for the Authentication objects, which represent
5050
the methods by which a user can authenticate to their cluster(s). The abstract class, `Authentication`,
5151
contains two required methods `login()` and `logout()`. Users can use one of the existing concrete classes to
52-
authenticate to their cluster or add their own custom concrete classes here.
52+
authenticate to their cluster or add their own custom concrete classes here.
5353
&#34;&#34;&#34;
5454

5555
import abc
@@ -483,4 +483,4 @@ <h4><code><a title="codeflare_sdk.cluster.auth.TokenAuthentication" href="#codef
483483
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
484484
</footer>
485485
</body>
486-
</html>
486+
</html>

docs/cluster/cluster.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,4 +1287,4 @@ <h4><code><a title="codeflare_sdk.cluster.cluster.Cluster" href="#codeflare_sdk.
12871287
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
12881288
</footer>
12891289
</body>
1290-
</html>
1290+
</html>

docs/cluster/config.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,4 @@ <h4><code><a title="codeflare_sdk.cluster.config.ClusterConfiguration" href="#co
232232
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
233233
</footer>
234234
</body>
235-
</html>
235+
</html>

docs/cluster/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ <h1>Index</h1>
8282
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
8383
</footer>
8484
</body>
85-
</html>
85+
</html>

0 commit comments

Comments
 (0)