Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI pipelines for linting and formatting #35

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Development
on:
pull_request:
branches:
- "**"

jobs:
lint_and_format:
name: Linting and formatting checks
uses: ./.github/workflows/lint-and-format.yml

# build:
# needs: lint_and_format
# name: Build
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# # TODO
35 changes: 35 additions & 0 deletions .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Linting and formatting checks
on:
workflow_call:

jobs:
lint_and_format:
name: Lint and Format
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
uv sync

- name: Check for linting errors
run: |
uv run ruff check

- name: Check formatting
run: |
uv run ruff format --check
6 changes: 3 additions & 3 deletions storb/challenge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def serialize_prf_value(self, prf_value: bytes) -> str:
return base64.b64encode(prf_value).decode("utf-8")

@field_validator("prf_value", mode="before")
def deserialize_prf_value(cls, value):
def deserialize_prf_value(self, value):
"""Deserialize PRF value from base64."""

if isinstance(value, str):
Expand Down Expand Up @@ -292,7 +292,7 @@ def serialize_prf_key(self, prf_key: bytes) -> str:
return prf_key

@field_validator("prf_key", mode="before")
def deserialize_prf_key(cls, value):
def deserialize_prf_key(self, value):
"""Deserialize PRF key from base64."""

if isinstance(value, str):
Expand All @@ -304,7 +304,7 @@ def deserialize_prf_key(cls, value):
return value

@field_validator("prp_key", mode="before")
def deserialize_prp_key(cls, value):
def deserialize_prp_key(self, value):
"""Deserialize PRP key from base64."""

if isinstance(value, str):
Expand Down
3 changes: 1 addition & 2 deletions storb/miner/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import asyncio
import time

from storb.util.logging import get_logger

from storb.miner import Miner
from storb.util.logging import get_logger

logger = get_logger(__name__)

Expand Down
1 change: 0 additions & 1 deletion storb/util/message_signing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from binascii import unhexlify
from typing import Union

from pydantic import BaseModel
from substrateinterface import Keypair
Expand Down
1 change: 0 additions & 1 deletion storb/util/uids.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import random

import numpy as np
from fiber.chain.metagraph import Metagraph

from storb.neuron import Neuron
Expand Down
Loading