Skip to content

Commit

Permalink
Use typeddicts instead of pydantic, update dependencies (#4)
Browse files Browse the repository at this point in the history
* Support python 3.10 and add gh action

* Without pydantic

* Skip 3.8

* Fix codegen
  • Loading branch information
steinitzu authored Feb 5, 2024
1 parent 40cce0f commit 9180e9a
Show file tree
Hide file tree
Showing 37 changed files with 1,320 additions and 745 deletions.
71 changes: 0 additions & 71 deletions .circleci/config.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Python package

# Run on push to the master branch and any pull request
on:
push:
branches:
- master
pull_request:
branches:
- master


jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache Poetry dependencies
uses: actions/cache@v2
with:
path: |
~/.cache/pypoetry
!~/.cache/pypoetry/artifacts
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.6.1

- name: Install dependencies
run: poetry install

- name: Lint with flake8
run: poetry run flake8 spoffy

- name: Type-check
run: poetry run mypy spoffy

- name: Test with pytest
run: poetry run pytest tests
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Spoffy

[![CircleCI](https://circleci.com/gh/steinitzu/spoffy/tree/master.svg?style=svg)](https://circleci.com/gh/steinitzu/spoffy/tree/master)
[![Documentation Status](https://readthedocs.org/projects/spoffy/badge/?version=latest&style=flat-square)](https://spoffy.readthedocs.io/en/latest/?badge=latest)


Expand All @@ -14,7 +13,7 @@ Read the docs: https://spoffy.readthedocs.io
```
pip install spoffy
```
Python3.6 and newer are supported
Python3.9 and newer are supported



4 changes: 2 additions & 2 deletions codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def signature_to_keywords(method):


def build_method_def(
method: ast.FunctionDef
method: ast.FunctionDef,
) -> Tuple[ast.FunctionDef, ast.AsyncFunctionDef]:
orig = method
method = deepcopy(method)
Expand Down Expand Up @@ -241,6 +241,6 @@ def build_classes():
out_body += classes
out_tree = ast.Module(out_body)
source = to_source(out_tree)
source = black.format_str(source, line_length=79)
source = black.format_str(source, mode=black.Mode(line_length=79))
output_file.write(source)
print(source)
24 changes: 12 additions & 12 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
[mypy]
# Specify the target platform details in config, so your developers are
# free to run mypy on Windows, Linux, or macOS and get consistent
# results.
python_version=3.6
# results
python_version=3.9
platform=linux

# flake8-mypy expects the two following for sensible formatting
show_column_numbers=True
show_error_context=False

# Follow imports but not show errors in other files
follow_imports=silent

# # since we're ignoring imports, writing .mypy_cache doesn't make any sense
# cache_dir=/dev/null

# suppress errors about unsatisfied imports
ignore_missing_imports=True

# allow untyped calls as a consequence of the options above
disallow_untyped_calls=False
Expand All @@ -25,7 +16,9 @@ disallow_untyped_calls=False
warn_return_any=False

# treat Optional per PEP 484
strict_optional=True
# Implicit optional allows for more flexible code, but can be a source of bugs.
# If you want to be strict, you can set this to False.
no_implicit_optional=False

# ensure all execution paths are returning
warn_no_return=True
Expand All @@ -39,3 +32,10 @@ warn_unused_ignores=False
# Flip them on if you feel adventurous.
disallow_untyped_defs=False
check_untyped_defs=True


[mypy-urlobject.*]
ignore_missing_imports = True

[mypy-snapshottest.*]
ignore_missing_imports = True
Loading

0 comments on commit 9180e9a

Please sign in to comment.