Repository: stytchauth/stytch-python (language: python)

Issue:
Generate stytch-python completely from API definitions + docs
A fully codegen'd version of the stytch-python backend SDK based on parsed definitions from our API + docs from the official stytch.com/docs/api pages.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml
index 45883a78..09abaa6c 100644
--- a/.github/workflows/auto-publish.yml
+++ b/.github/workflows/auto-publish.yml
@@ -19,7 +19,7 @@ jobs:
       - name: Install dependencies
         run: |
           python -m pip install --upgrade pip
-          pip install -r requirements.txt
+          pip install -r requirements_dev.txt
 
       - name: Build source tarball
         run: python setup.py sdist
diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
index e66de5a5..59e3f3c9 100644
--- a/.github/workflows/pull-request.yml
+++ b/.github/workflows/pull-request.yml
@@ -1,8 +1,6 @@
-name: Test
+name: Pull Request checks
 
 on:
-  push:
-    branches: [main]
   pull_request:
     branches: [main]
 
@@ -26,10 +24,10 @@ jobs:
       - name: Install dependencies
         run: |
           python -m pip install --upgrade pip
-          pip install -r requirements.txt
+          pip install -r requirements_dev.txt
 
-      - name: Check types
-        run: mypy stytch codegen test
+      - name: Check types and run linter
+        run: make lint
 
       - name: Run unit tests
-        run: python -m unittest
+        run: make test
diff --git a/.isort.cfg b/.isort.cfg
new file mode 100644
index 00000000..45116675
--- /dev/null
+++ b/.isort.cfg
@@ -0,0 +1,2 @@
+[settings]
+group_by_package=True
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 9d647764..6e0c3a99 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -6,7 +6,7 @@ Thanks for contributing to Stytch's Python library! If you run into trouble, fin
 
 1. Install [Python](https://www.python.org/) version 3.7 or greater.
 2. (Recommended, but optional) Create a new [virtualenv](https://docs.python.org/3/tutorial/venv.html).
-3. `pip install -r requirements.txt`
+3. `pip install -r requirements_dev.txt`
 
 ## Generating (and regenerating) the API
 
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..063a9826
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+.PHONY: help
+help:
+	@echo "Available commands"
+	@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort
+
+
+.PHONY: tests
+tests:  # Run the unit tests
+	python3 -m unittest
+
+# A useful alias
+.PHONY: test
+test: tests # alias for tests
+
+.PHONY: lint
+lint: # Run the autoformatter and type checker
+	black . && mypy .
diff --git a/mypy.ini b/mypy.ini
new file mode 100644
index 00000000..45467760
--- /dev/null
+++ b/mypy.ini
@@ -0,0 +1,5 @@
+[mypy]
+python_version = 3.7
+pretty = true
+ignore_missing_imports = true
+show_error_codes = true
diff --git a/requirements.txt b/requirements.txt
index 67431eee..ab042837 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,15 +1,6 @@
 -e .
 
-# For distributing the package
-setuptools>=65.5.1
-
-# For type checking, codegen, and testing
-Jinja2==3.1.2
-autoflake==2.0.0
-#black==22.12.0
-isort==5.11.2
-mypy==0.991
-pyright==1.1.284
-pyyaml==6.0
-types-PyYAML==6.0.12.2
-types-requests==2.28.11.5
+aiohttp>=3.8.3
+requests>=2.7.0
+pydantic>=1.10.2
+pyjwt[crypto]>=2.4.0
diff --git a/requirements_dev.txt b/requirements_dev.txt
new file mode 100644
index 00000000..2a3ee1ad
--- /dev/null
+++ b/requirements_dev.txt
@@ -0,0 +1,15 @@
+-r requirements.txt
+
+# For distributing the package
+setuptools>=65.5.1
+
+# For type checking, codegen, and testing
+Jinja2==3.1.2
+autoflake==2.0.0
+black==22.12.0
+isort==5.11.2
+mypy==0.991
+pyright==1.1.284
+pyyaml==6.0
+types-PyYAML==6.0.12.2
+types-requests==2.28.11.5


Test patch:
diff --git a/stytch/core/test/test_models.py b/stytch/core/test/test_models.py
index fe129a48..c52a8c9c 100644
--- a/stytch/core/test/test_models.py
+++ b/stytch/core/test/test_models.py
@@ -109,11 +109,11 @@ def test_stytcherror(self) -> None:
 
     def test_stytcherror_fields(self) -> None:
         resp = {
-          "status_code": 418,
-          "request_id": "request-id-test-fea11c44-5514-4aac-a76b-3ca685e3443a",
-          "error_type": "is_a_teapot",
-          "error_message": "I'm a teapot!",
-          "error_url": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418",
+            "status_code": 418,
+            "request_id": "request-id-test-fea11c44-5514-4aac-a76b-3ca685e3443a",
+            "error_type": "is_a_teapot",
+            "error_message": "I'm a teapot!",
+            "error_url": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418",
         }
         expected = models.StytchErrorDetails(**resp)