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

updates mypy and httpx #3

Merged
merged 12 commits into from
Mar 17, 2023
66 changes: 66 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---

name: Pre-commit Linters

on:
workflow_dispatch:
pull_request:
branches:
- main


###############
# Set the Job #
###############
jobs:

# Label of the runner job
runner-job:
# You must use a Linux environment when using service containers or container jobs
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:

##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3

################
# Setup Python #
################
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.7"

- name: Bootstrap poetry
shell: bash
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry

- name: Configure poetry
shell: bash
run: |
python -m poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
shell: bash
run: |
python -m poetry install

- name: Pre-Commit
uses: pre-commit/action@v2.0.3
16 changes: 5 additions & 11 deletions .github/workflows/tests.yaml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

name: All checks and tests
name: Unit tests

on:
workflow_dispatch:
Expand Down Expand Up @@ -28,16 +28,13 @@ jobs:
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
uses: actions/checkout@v3

################
# Setup Python #
################
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: "3.7"

Expand Down Expand Up @@ -68,12 +65,9 @@ jobs:
- name: Run tests
shell: bash
env: # Or as an environment variable
client_id: 'e3b723f3-08a9-4895-8552-3ebfebd6f958'
tenant_id: 'eeb76355-f594-4e54-875b-d933451e0bd7'
client_id: '00000000-0000-0000-0000-000000000000'
tenant_id: '00000000-0000-0000-0000-000000000001'
client_secret: 'imaabadasecret'
session_secret: 'imaabadasecret'
session_expire_time_minutes: '5'
run: poetry run pytest

- name: Pre-Commit
uses: pre-commit/action@v2.0.3
42 changes: 16 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,34 @@ repos:
- id: check-added-large-files
- repo: local
hooks:
- id: system
- id: black
name: Black
entry: poetry run black fastapimsal tests examples
pass_filenames: false
entry: poetry run black
language: system
- repo: local
hooks:
- id: system
types: ["python"]
- id: isort
name: isort
entry: poetry run isort fastapimsal tests examples
pass_filenames: false
entry: poetry run isort
language: system
- repo: local
hooks:
- id: system
types: ["python"]
- id: safety
name: Safety
# Ignore pip vulnerability
entry: poetry run safety check --full-report -i 40291 -i 40622 -i 42559 -i 42218
pass_filenames: false
language: system
- repo: local
hooks:
- id: system
- id: mypy
name: MyPy
entry: poetry run mypy fastapimsal tests examples
pass_filenames: false
entry: poetry run mypy --install-types --non-interactive
language: system
- repo: local
hooks:
- id: system
types: ["python"]
- id: pylint
name: Pylint
entry: poetry run pylint --rcfile=.python-lint fastapimsal tests examples
pass_filenames: false
entry: poetry run pylint --rcfile=.python-lint
language: system
- repo: local
hooks:
- id: system
types: ["python"]
- id: flake8
name: Flake8
entry: poetry run flake8 fastapimsal tests examples
pass_filenames: false
entry: poetry run flake8
language: system
types: ["python"]
2 changes: 1 addition & 1 deletion fastapimsal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ class Config:
@lru_cache()
def get_auth_settings() -> AuthSettings:

return AuthSettings()
return AuthSettings() # type: ignore
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ disallow_untyped_defs = True
disallow_untyped_decorators = False
ignore_missing_imports = True
warn_unused_ignores = False
no_namespace_packages = True
Loading