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

Auto transpiling to catchup to node sdk (as of 19.0 branch of node sdk) #517

Merged
merged 137 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
8020175
few modifications
rishabhpoddar Jul 21, 2024
df89713
adds new type of user
rishabhpoddar Jul 21, 2024
48a1b65
adds more changes
rishabhpoddar Jul 22, 2024
018cbc4
adds process state file changes
rishabhpoddar Jul 22, 2024
f88a855
removes get_users_oldest/newest first from supertokens.py
rishabhpoddar Jul 22, 2024
83fd382
adds auto init of usermetadata
rishabhpoddar Jul 23, 2024
0afaace
adds types for account linking recipe
rishabhpoddar Jul 25, 2024
e242d09
merges with latest
rishabhpoddar Aug 1, 2024
5b71f87
adds normalising of input for account linking recipe
rishabhpoddar Aug 7, 2024
2db2b94
adds more functions to accountlinking recipe
rishabhpoddar Aug 7, 2024
9b1ee92
completes recipe.py for accountlinking
rishabhpoddar Aug 7, 2024
fbd3d88
exposes account linking functions
rishabhpoddar Aug 8, 2024
d091f6d
adds recipe impl for account linking
rishabhpoddar Aug 8, 2024
9789fd3
modifies email verification recipe fully
rishabhpoddar Aug 8, 2024
e9ab861
makes changes for session recipe
rishabhpoddar Aug 9, 2024
1cd37b7
adds interfaces for mfa recipe
rishabhpoddar Aug 13, 2024
8b7e0c4
more types
rishabhpoddar Aug 13, 2024
023830a
more changes
rishabhpoddar Aug 13, 2024
c746310
adds recipe impl for mfa recipe
rishabhpoddar Aug 16, 2024
57ce38b
adds mfa recipe
rishabhpoddar Aug 16, 2024
ac55aa8
merges with latest
rishabhpoddar Aug 16, 2024
ad9ae35
starts working on totp
rishabhpoddar Aug 25, 2024
1c15536
more code
rishabhpoddar Aug 25, 2024
eb1a5b4
adds totp recipe
rishabhpoddar Aug 26, 2024
35c7cd0
more changes
rishabhpoddar Aug 26, 2024
d5028e6
multi tenancy recipe
rishabhpoddar Aug 26, 2024
b3b93f7
adds auth utils
rishabhpoddar Aug 27, 2024
a281813
emailpassword recipe translation - wip
rishabhpoddar Aug 28, 2024
13fa57c
changes ep recipe
rishabhpoddar Aug 29, 2024
4066605
merges with latest
rishabhpoddar Sep 3, 2024
a09ca6e
Merge branch '0.24' into auto-transpiling
rishabhpoddar Sep 3, 2024
11797c6
complets passwordless changes without fixing all types
rishabhpoddar Sep 4, 2024
a630649
fixes linting errors
rishabhpoddar Sep 4, 2024
7251e05
third party recipe changes
rishabhpoddar Sep 6, 2024
7af26f7
third party provider updates
rishabhpoddar Sep 13, 2024
c69dfea
adds 2 dashboard apis
rishabhpoddar Sep 16, 2024
d123e19
adds one more dahsboard api
rishabhpoddar Sep 16, 2024
09f54cf
more apis
rishabhpoddar Sep 16, 2024
713efb5
more apis
rishabhpoddar Sep 16, 2024
da03488
more apis
rishabhpoddar Sep 16, 2024
9a4fa38
more apis
rishabhpoddar Sep 17, 2024
06e5d86
more apis
rishabhpoddar Sep 17, 2024
0b08858
more apis
rishabhpoddar Sep 17, 2024
051c29f
more apis
rishabhpoddar Sep 17, 2024
85b8083
more apis
rishabhpoddar Sep 17, 2024
edd294f
more apis
rishabhpoddar Sep 17, 2024
2a7599f
renames AccountLinkingUser to User
rishabhpoddar Sep 17, 2024
aa7cd07
more changes
rishabhpoddar Sep 18, 2024
8d7b630
small change
rishabhpoddar Sep 18, 2024
406172c
fixes a bunch of cyclic imports
rishabhpoddar Sep 23, 2024
d6ee839
fixes
rishabhpoddar Sep 23, 2024
4e0e11a
fixes
rishabhpoddar Sep 23, 2024
537db95
more fixes
rishabhpoddar Sep 24, 2024
960af0e
fixes
rishabhpoddar Sep 24, 2024
a2873c4
fixes
rishabhpoddar Sep 24, 2024
36eaa1f
fixes
rishabhpoddar Sep 24, 2024
446534b
merges with latest
rishabhpoddar Sep 25, 2024
76cdb54
fixes more tests
rishabhpoddar Sep 25, 2024
160af9b
fixes more tests
rishabhpoddar Sep 25, 2024
f36ddd0
fixes more tests
rishabhpoddar Sep 25, 2024
12d6bff
fixes an implementation
rishabhpoddar Sep 25, 2024
85221ea
fixes more tests
rishabhpoddar Sep 25, 2024
19a13bf
fixes more tests
rishabhpoddar Sep 25, 2024
4989a8f
fixes more tests
rishabhpoddar Sep 25, 2024
d604a7f
fixes more tests
rishabhpoddar Sep 25, 2024
05c1242
fixes more tests
rishabhpoddar Sep 25, 2024
8278867
Merge branch '0.24' into auto-transpiling
rishabhpoddar Sep 27, 2024
8e3a7b2
fixes frontendintegration tests with st-website repo
rishabhpoddar Sep 29, 2024
e0995f0
fixes stuff
rishabhpoddar Sep 30, 2024
eae7e2d
cyclic import issue
rishabhpoddar Sep 30, 2024
0cfec6f
fixes all cyclic imports
rishabhpoddar Sep 30, 2024
0c48c1b
Merge pull request #529 from supertokens/auto-transpiling-cyclic-import
rishabhpoddar Sep 30, 2024
9e78f99
small changes
rishabhpoddar Sep 30, 2024
5d0c4d3
fixes stuff
rishabhpoddar Sep 30, 2024
91dcf57
adds comments
rishabhpoddar Sep 30, 2024
cfe84f5
Merge pull request #528 from supertokens/auto-transpiling-e2e-tests
rishabhpoddar Sep 30, 2024
fa03181
fixes a few bugs
rishabhpoddar Sep 30, 2024
12a624c
fixes bugs
rishabhpoddar Sep 30, 2024
d31a8fb
fixes bugs
rishabhpoddar Sep 30, 2024
37b41d4
fixes more tests
rishabhpoddar Oct 1, 2024
cdcc4fc
fixes dependencies for cicd
rishabhpoddar Oct 1, 2024
61cfea3
fixes more tests
rishabhpoddar Oct 1, 2024
520a30b
more fixes
rishabhpoddar Oct 1, 2024
8c6f331
fixes more issues
rishabhpoddar Oct 2, 2024
51b5a27
fixes more tests
rishabhpoddar Oct 2, 2024
b0b2a5c
fixes fastapi auth-react server
rishabhpoddar Oct 3, 2024
7b9d23c
more test fixes
rishabhpoddar Oct 3, 2024
bb56f1e
more fixes
rishabhpoddar Oct 3, 2024
fc8927b
fixes
rishabhpoddar Oct 3, 2024
c7b77b6
fixes
rishabhpoddar Oct 3, 2024
75ec737
solves https://github.com/supertokens/supertokens-node/issues/657
rishabhpoddar Oct 7, 2024
0708bc4
fixes a small issue
rishabhpoddar Oct 7, 2024
0128820
fixes script for cicd
rishabhpoddar Oct 8, 2024
90d8d52
small changes
rishabhpoddar Oct 9, 2024
1832599
fixes test server code
rishabhpoddar Oct 9, 2024
999c636
fixes test server
rishabhpoddar Oct 9, 2024
e5fe1da
fixes more code
rishabhpoddar Oct 9, 2024
9e181dd
gets more tests to pass
rishabhpoddar Oct 9, 2024
364ccaa
gets more tests to pass
rishabhpoddar Oct 9, 2024
0797226
fixes error logging
rishabhpoddar Oct 9, 2024
c1f1975
fixes stuff
rishabhpoddar Oct 10, 2024
29a8969
adds more apis
rishabhpoddar Oct 10, 2024
81cf53d
fixes more tests
rishabhpoddar Oct 10, 2024
c1ec3c9
fixes bugs
rishabhpoddar Oct 10, 2024
edfef83
fixes more stuff
rishabhpoddar Oct 10, 2024
d851594
fixes more bugs
rishabhpoddar Oct 10, 2024
579ac9a
fixes more issues
rishabhpoddar Oct 11, 2024
c812d73
fixes stuff
rishabhpoddar Oct 11, 2024
74ddd39
fixes more tests
rishabhpoddar Oct 11, 2024
45ff58f
fixes stuff
rishabhpoddar Oct 11, 2024
e50c851
fixes stuff
rishabhpoddar Oct 11, 2024
c1ab497
fixes more stuff
rishabhpoddar Oct 11, 2024
107a612
fixes stuff
rishabhpoddar Oct 12, 2024
ff089d8
fixes stuff
rishabhpoddar Oct 12, 2024
9e0406a
fixes more stuff
rishabhpoddar Oct 12, 2024
3634233
fixes stuff
rishabhpoddar Oct 12, 2024
ad7c89e
fixes stuff
rishabhpoddar Oct 12, 2024
e654e94
fixes stuff
rishabhpoddar Oct 12, 2024
2ad8b1b
fixe stuff
rishabhpoddar Oct 12, 2024
937cbb2
adds comments
rishabhpoddar Oct 12, 2024
cb9f1e9
more fixes
rishabhpoddar Oct 12, 2024
42420ce
fixes stuff
rishabhpoddar Oct 13, 2024
a0b0aaf
fixes stuff
rishabhpoddar Oct 13, 2024
21ba18e
fixes stuff
rishabhpoddar Oct 13, 2024
f6cf304
fixes a small issue
rishabhpoddar Oct 13, 2024
b8fd8d0
makes type simpler
rishabhpoddar Oct 13, 2024
5236c14
fixes more stuff
rishabhpoddar Oct 14, 2024
b106a0d
removes overwrite session flag
rishabhpoddar Oct 14, 2024
5ddcd16
Merge pull request #533 from supertokens/removing-overwrite-session-flag
rishabhpoddar Oct 15, 2024
41cea1a
merges with latest
rishabhpoddar Oct 17, 2024
01f5387
Merge branch '0.24' into auto-transpiling
rishabhpoddar Oct 18, 2024
edddad0
fixes type
rishabhpoddar Oct 19, 2024
1252649
changes versions
rishabhpoddar Oct 24, 2024
dd36038
fixes dependency version
rishabhpoddar Oct 24, 2024
4900c48
changes to pre commit hook for debugging
rishabhpoddar Oct 25, 2024
897588b
more fixes
rishabhpoddar Oct 25, 2024
04ffcf6
undoes temp change for pre commit hook
rishabhpoddar Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .circleci/setupAndTestBackendSDKWithFreeCore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ ST_CONNECTION_URI=http://localhost:8081

# start test-server
pushd tests/test-server
sh setup-for-test.sh
SUPERTOKENS_ENV=testing API_PORT=$API_PORT ST_CONNECTION_URI=$ST_CONNECTION_URI python3 app.py &
popd

Expand Down
10 changes: 10 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
You are an expert Python and Typescript developer. Your job is to convert node code (in typescript) into Python code. The python code then goes into this SDK. The python code style should keep in mind:
- Avoid using TypeDict
- Avoid using generic Dict as much as possible, except when defining the types for `user_context`.
- If a function has multiple `status` strings as outputs, then define one unique class per unique `status` string. The class name should be such that it indicates the status it is associated with.
- Variable and function names should be in snake_case. Class names in PascalCase.
- Whenever importing `Literal`, import it from `typing_extensions`, and not `types`.
- Do not use `|` for OR type, instead use `Union`
- When defining API interface functions, make sure the output classes inherit from `APIResponse` class, and that they have a `to_json` function defined whose output matches the structure of the provided Typescript code output objects.

The semantic of the python code should be the same as what's of the provided Typescript code.
16 changes: 12 additions & 4 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[MASTER]

# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
Expand All @@ -20,11 +19,11 @@ fail-on=
fail-under=10.0

# Files or directories to be skipped. They should be base names, not paths.
ignore=CVS
ignore=CVS,

# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against paths and can be in Posix or Windows format.
ignore-paths=
ignore-paths=tests/test-server

# Files or directories matching the regex patterns are skipped. The regex
# matches against base names, not paths.
Expand Down Expand Up @@ -116,7 +115,16 @@ disable=raw-checker-failed,
global-statement,
too-many-lines,
duplicate-code,
too-many-return-statements
too-many-return-statements,
logging-not-lazy,
logging-fstring-interpolation,
consider-using-f-string,
consider-using-in,
no-else-return,
no-self-use,
no-else-raise,
too-many-nested-blocks,


# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
90 changes: 90 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask, supertokens-website tests",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/tests/frontendIntegration/flask-server/app.py",
"args": [
"--port",
"8080"
],
"cwd": "${workspaceFolder}/tests/frontendIntegration/flask-server",
"env": {
"FLASK_DEBUG": "1"
},
"jinja": true
},
{
"name": "Python: FastAPI, supertokens-website tests",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/tests/frontendIntegration/fastapi-server/app.py",
"args": [
"--port",
"8080"
],
"cwd": "${workspaceFolder}/tests/frontendIntegration/fastapi-server",
"env": {
"FLASK_DEBUG": "1"
},
"jinja": true
},
{
"name": "Python: Flask, supertokens-auth-react tests",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/tests/auth-react/flask-server/app.py",
"args": [
"--port",
"8083"
],
"cwd": "${workspaceFolder}/tests/auth-react/flask-server",
"env": {
"FLASK_DEBUG": "1"
},
"jinja": true
},
{
"name": "Python: FastAPI, supertokens-auth-react tests",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/tests/auth-react/fastapi-server/app.py",
"args": [
"--port",
"8083"
],
"cwd": "${workspaceFolder}/tests/auth-react/fastapi-server",
"jinja": true
},
{
"name": "Python: Django, supertokens-auth-react tests",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/tests/auth-react/django3x/manage.py",
"args": [
"runserver",
"0.0.0.0:8083"
],
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}/tests/auth-react/django3x",
"jinja": true
},
{
"name": "Python: backend-sdk-testing repo",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/tests/test-server/app.py",
"cwd": "${workspaceFolder}/tests/test-server",
"env": {
"SUPERTOKENS_ENV": "testing",
"API_PORT": "3030",
"ST_CONNECTION_URI": "http://localhost:8081"
},
"console": "integratedTerminal"
},
]
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]


## [0.25.0] - 2024-09-18

### Breaking changes
- `supertokens_python.recipe.emailverification.types.User` has been renamed to `supertokens_python.recipe.emailverification.types.EmailVerificationUser`
- The user object has been changed to be a global one, containing information about all emails, phone numbers, third party info and login methods associated with that user.
- Type of `get_email_for_user_id` in `emailverification.init` has changed
- Session recipe's error handlers take an extra param of recipe_user_id as well
- Session recipe, removes `validate_claims_in_jwt_payload` that is exposed to the user.
- TODO..

## [0.24.4] - 2024-10-16

- Updates `phonenumbers` and `twilio` to latest versions

>>>>>>> 0.24
## [0.24.3] - 2024-09-24

- Adds support for form field related improvements by making fields accept any type of values
- Adds support for optional fields to properly optional
>>>>>>> 0.24

### Migration

Expand Down
4 changes: 2 additions & 2 deletions coreDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_comment": "contains a list of core-driver interfaces branch names that this core supports",
"versions": [
"3.1"
"5.1"
]
}
}
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ uvicorn==0.18.2
Werkzeug==2.0.3
wrapt==1.13.3
zipp==3.7.0
pyotp==2.9.0
aiofiles==23.2.1
6 changes: 5 additions & 1 deletion frontendDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"_comment": "contains a list of frontend-driver interfaces branch names that this core supports",
"versions": [
"1.17",
"2.0"
"1.18",
"1.19",
"2.0",
"3.0",
"3.1"
]
}
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
"Fastapi",
"uvicorn==0.18.2",
"python-dotenv==0.19.2",
"pyotp<3",
"aiofiles==23.2.1",
]
),
"flask": (
[
"flask_cors",
"Flask",
"python-dotenv==0.19.2",
"pyotp<3",
]
),
"django": (
Expand All @@ -35,6 +38,7 @@
"django-stubs==1.9.0",
"uvicorn==0.18.2",
"python-dotenv==0.19.2",
"pyotp<3",
]
),
"django2x": (
Expand All @@ -44,6 +48,7 @@
"django-stubs==1.9.0",
"gunicorn==20.1.0",
"python-dotenv==0.19.2",
"pyotp<3",
]
),
"drf": (
Expand All @@ -57,6 +62,7 @@
"uvicorn==0.18.2",
"python-dotenv==0.19.2",
"tzdata==2021.5",
"pyotp<3",
]
),
}
Expand All @@ -83,7 +89,7 @@

setup(
name="supertokens_python",
version="0.24.4",
version="0.25.0",
author="SuperTokens",
license="Apache 2.0",
author_email="[email protected]",
Expand Down Expand Up @@ -121,10 +127,11 @@
"asgiref>=3.4.1,<4",
"typing_extensions>=4.1.1,<5.0.0",
"Deprecated==1.2.13",
"phonenumbers==8.13.47",
"twilio==9.3.3",
"phonenumbers<9",
"twilio<10",
"aiosmtplib>=1.1.6,<4.0.0",
"pkce==1.0.3",
"pyotp<3",
],
python_requires=">=3.7",
include_package_data=True,
Expand Down
5 changes: 5 additions & 0 deletions supertokens_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from typing_extensions import Literal

from supertokens_python.framework.request import BaseRequest
from supertokens_python.types import RecipeUserId

from . import supertokens
from .recipe_module import RecipeModule
Expand Down Expand Up @@ -49,3 +50,7 @@ def get_request_from_user_context(
user_context: Optional[Dict[str, Any]],
) -> Optional[BaseRequest]:
return Supertokens.get_instance().get_request_from_user_context(user_context)


def convert_to_recipe_user_id(user_id: str) -> RecipeUserId:
return RecipeUserId(user_id)
Loading
Loading