Skip to content

Commit

Permalink
added github workflows for flake8, mypy, and black
Browse files Browse the repository at this point in the history
  • Loading branch information
hello-fri-end committed Mar 28, 2024
1 parent 51093e6 commit 01ed30e
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 118 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Testing unify

on: push

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install deps
uses: knowsuchagency/poetry-install@v1
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Run black check
run: poetry run black --check .
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install deps
uses: knowsuchagency/poetry-install@v1
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Run flake8 check
run: poetry run flake8 --count .
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install deps
uses: knowsuchagency/poetry-install@v1
env:
POETRY_VIRTUALENVS_CREATE: false
# - name: Run mypy check
#run: poetry run mypy --install-types --non-interactive .
61 changes: 61 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: check-ast
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.1.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.1.0
hooks:
- id: pretty-format-yaml
args:
- --autofix
- --preserve-quotes
- --indent=2

- repo: local
hooks:
- id: autoflake
name: autoflake
entry: poetry run autoflake
language: system
types: [python]
args: [--in-place, --remove-all-unused-imports, --remove-duplicate-keys]

- id: black
name: Format with Black
entry: poetry run black
language: system
types: [python]

- id: isort
name: isort
entry: poetry run isort
language: system
types: [python]

- id: flake8
name: Check with Flake8
entry: poetry run flake8
language: system
pass_filenames: false
types: [python]
args: [--count, .]

#- id: mypy
# name: Validate types with MyPy
# entry: poetry run mypy
# language: system
# types: [python]
# pass_filenames: false
# args:
# - "."
27 changes: 0 additions & 27 deletions new_test.py

This file was deleted.

47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[tool.poetry]
name = "unify"
version = "0.1.0"
description = "A Python package for interacting with the Unify API"
authors = ["Unify <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.7.1"
openai = "1.12.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 88
target-version = ["py37"]

[tool.flake8]
max-line-length = 88
extend-ignore = "E203, W503"

[tool.isort]
profile = "black"

[tool.autoflake]
remove-all-unused-imports = true
ignore-init-module-imports = true

[tool.poetry.dev-dependencies]
# Add pre-commit as a dev dependency to ensure it is installed in the virtual environment
pre-commit = "^2.15.0"

[tool.pre-commit]
# Specify the hooks to run
hooks = [
"check-ast",
"trailing-whitespace",
"end-of-file-fixer",
"add-trailing-comma",
"pretty-format-yaml",
{ id = "autoflake", args = ["--in-place", "--remove-all-unused-imports", "--remove-duplicate-keys"] },
"black",
"isort",
"flake8",
{ id = "mypy", args = ["."] }
]
22 changes: 0 additions & 22 deletions setup.py

This file was deleted.

9 changes: 7 additions & 2 deletions src/unify/Exceptions.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
class UnifyError(Exception):
pass

class KeyError(UnifyError):
pass

class BadRequestError(UnifyError):
pass


class AuthenticationError(UnifyError):
pass


class PermissionDeniedError(UnifyError):
pass


class NotFoundError(UnifyError):
pass


class ConflictError(UnifyError):
pass


class UnprocessableEntityError(UnifyError):
pass


class RateLimitError(UnifyError):
pass


class InternalServerError(UnifyError):
pass

Expand Down
Loading

0 comments on commit 01ed30e

Please sign in to comment.