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>

docs/cluster/model.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,4 +468,4 @@ <h4><code><a title="codeflare_sdk.cluster.model.RayClusterStatus" href="#codefla
468468
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
469469
</footer>
470470
</body>
471-
</html>
471+
</html>

docs/index.html

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

docs/job/index.html

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

docs/job/jobs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,4 +566,4 @@ <h4><code><a title="codeflare_sdk.job.jobs.JobDefinition" href="#codeflare_sdk.j
566566
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
567567
</footer>
568568
</body>
569-
</html>
569+
</html>

docs/utils/generate_yaml.html

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

docs/utils/index.html

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

docs/utils/pretty_print.html

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

src/codeflare_sdk.egg-info/SOURCES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ src/codeflare_sdk/job/__init__.py
1515
src/codeflare_sdk/job/jobs.py
1616
src/codeflare_sdk/utils/__init__.py
1717
src/codeflare_sdk/utils/generate_yaml.py
18-
src/codeflare_sdk/utils/pretty_print.py
18+
src/codeflare_sdk/utils/pretty_print.py
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

src/codeflare_sdk/cluster/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
The auth sub-module contains the definitions for the Authentication objects, which represent
1717
the methods by which a user can authenticate to their cluster(s). The abstract class, `Authentication`,
1818
contains two required methods `login()` and `logout()`. Users can use one of the existing concrete classes to
19-
authenticate to their cluster or add their own custom concrete classes here.
19+
authenticate to their cluster or add their own custom concrete classes here.
2020
"""
2121

2222
import abc

src/codeflare_sdk/templates/base-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,4 @@ spec:
153153
memory: "512Mi"
154154
requests:
155155
cpu: "500m"
156-
memory: "256Mi"
156+
memory: "256Mi"

src/codeflare_sdk/templates/new-template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ spec:
189189
- name: MY_POD_IP
190190
valueFrom:
191191
fieldRef:
192-
fieldPath: status.podIP
192+
fieldPath: status.podIP
193193
# environment variables to set in the container.Optional.
194194
# Refer to https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
195195
lifecycle:
@@ -220,4 +220,4 @@ spec:
220220
kind: Service
221221
name: deployment-name-head-svc
222222
port:
223-
targetPort: dashboard
223+
targetPort: dashboard

tests/unit_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,6 @@ def test_DDPJob_cancel(mocker):
19201920

19211921

19221922
def parse_j(cmd):
1923-
19241923
pattern = r"--nnodes\s+\d+\s+--nproc_per_node\s+\d+"
19251924
match = re.search(pattern, cmd)
19261925
if match:

0 commit comments

Comments
 (0)