Skip to content

Commit

Permalink
Merge pull request #39 from Sindri-Labs/kp-complete-method-params
Browse files Browse the repository at this point in the history
Refactor internal methods, update docstrings, align methods to api endpoints
  • Loading branch information
KPreisner authored Mar 28, 2024
2 parents 5fcc2a4 + 8c3463d commit 8a42f1e
Show file tree
Hide file tree
Showing 12 changed files with 825 additions and 398 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ exclude =
.pytest_cache/*
__pycache__/*
.vscode
venv
env

ignore =
# Ignore flake8 errors that conflict with Black
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Lint Codebase

on:
push:
branches: [ "main" ]
pull_request:
# Do not run on draft pull requests
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
run-lint:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} # Do not run on draft pull requests

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

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

- name: Install poetry
run: pip install poetry

- name: Install Dependencies
run: poetry install

- name: Check formatting with black
if: success() || failure()
run: |
poetry run black --check .
- name: Check import order with isort
if: success() || failure()
run: |
poetry run isort --check-only .
- name: Lint with flake8
if: success() || failure()
run: |
poetry run flake8 .
- name: Verify typing annotations
if: success() || failure()
run: |
poetry run mypy .
2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ skip =
.pytest_cache/*
.vscode
__pycache__/*
venv
env
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Contains SDK code for Sindri APIs. Please see [sindri.app](https://sindri.app) f

## Documentation and Usage
Documentation for this repo is automatically generated from the Python docstrings using [lazydocs](https://pypi.org/project/lazydocs/) and published to [sindri.app/docs/reference/sdk/](https://sindri.app/docs/reference/sdk/python) along with the rest of the documentation for Sindri.
Docstrings for functions and methods follow the [google standard](https://google.github.io/styleguide/pyguide.html#383-functions-and-methods) for formatting.

## License
[![](https://img.shields.io/github/license/sindri-labs/sindri-python?style=for-the-badge)](https://img.shields.io/github/license/sindri-labs/sindri-python?style=for-the-badge)
Expand Down
199 changes: 190 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions py_format_code.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# File formatters
echo ""
echo "(python) black..."
black .


echo ""
echo "(python) isort..."
isort --overwrite-in-place .

# Analyze code and report errors
echo ""
echo "(python) flake8..."
flake8 .

echo ""
echo "(python) mypy..."
mypy .

11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ exclude = '''
| .mypy_cache
| .pytest_cache
| __pycache__
| venv
| env
)/
)
'''

[tool.mypy]
python_version = "3.10"
exclude = ["venv/*", 'env/*']

[tool.poetry]
authors = [
Expand All @@ -32,7 +35,7 @@ license = "MIT"
name = "sindri"
readme = "README.md"
repository = "https://github.com/Sindri-Labs/sindri-python"
version = "0.0.6"
version = "0.0.0"

[tool.poetry.dependencies]
python = "^3.10"
Expand All @@ -43,4 +46,8 @@ lazydocs = "^0.4.8"
mkdocs = "^1.5.3"
mkdocs-awesome-pages-plugin = "^2.9.2"
pytest = "^8.1.1"

black = "24.2.0"
flake8 = "7.0.0"
isort = "5.10.1"
mypy = "^1.9.0"
types-requests = "^2.31.0.20240311"
Empty file added src/__init__.py
Empty file.
Loading

0 comments on commit 8a42f1e

Please sign in to comment.