diff --git a/.github/workflows/on-push-to-main.yml b/.github/workflows/on-push-to-main.yml index b5ad724..ffd978c 100644 --- a/.github/workflows/on-push-to-main.yml +++ b/.github/workflows/on-push-to-main.yml @@ -1,42 +1,42 @@ -#name: Release Main -# -#on: -# push: -# branches: -# - main -# -#jobs: -# release: -# name: Release main -# runs-on: ubuntu-latest -# -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# with: -# fetch-depth: 0 -# ref: main -# -# - name: Setup Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: 'lts/*' -# -# - name: Set up Python 3.9 -# uses: actions/setup-python@v3 -# with: -# python-version: 3.9 -# -# - name: Install python dependencies -# run: | -# python -m pip install --upgrade wheel setuptools pipenv-setup twine -# -# - name: Install semantic release dependencies -# run: npm i semantic-release-slack-bot semantic-release-pypi -# -# - name: Release -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_NT_SEMANTIC_RELEASE_PROD }} -# PYPI_TOKEN: ${{ secrets.GH_PYPI_TOKEN }} -# run: npx semantic-release +name: Release Main + +on: + push: + branches: + - main + +jobs: + release: + name: Release main + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: main + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 'lts/*' + + - name: Set up Python 3.9 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + + - name: Install python dependencies + run: | + python -m pip install --upgrade wheel setuptools pipenv-setup twine + + - name: Install semantic release dependencies + run: npm i semantic-release-slack-bot semantic-release-pypi + + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_NT_SEMANTIC_RELEASE_PROD }} + PYPI_TOKEN: ${{ secrets.GH_PYPI_TOKEN }} + run: npx semantic-release diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 394510c..7a14acf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: pass_filenames: false require_serial: true args: [ - "changeme-package-name-stubs", + "jose-stubs", "--show-error-codes", "--namespace-packages", "--show-traceback", @@ -30,7 +30,7 @@ repos: hooks: - id: reorder-python-imports args: [ - "--application-directories=changeme-package-name-stubs" + "--application-directories=jose-stubs" ] - repo: https://gitlab.com/pycqa/flake8 rev: 4.0.1 diff --git a/.releaserc b/.releaserc index 204a70e..2fd0c56 100644 --- a/.releaserc +++ b/.releaserc @@ -12,7 +12,7 @@ { "notifyOnSuccess": false, "notifyOnFail": false, - "packageName": "changeme-types-package-name", + "packageName": "types-python-jose", "branchesConfig": [ { "pattern": "main", diff --git a/Pipfile b/Pipfile index f99ea95..d483578 100644 --- a/Pipfile +++ b/Pipfile @@ -5,6 +5,7 @@ name = "pypi" # If you edit this file, run `pipenv-setup sync --pipfile --dev` afterwards [dev-packages] +python-jose = "==3.3.0" mypy = "==0.942" pipenv-setup = "==3.2.0" diff --git a/Pipfile.lock b/Pipfile.lock index c03d483..8a8c025 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "200fa8e5b3bde15bae56abd007b616b96f7d9d171ba0e3634cd8e0659083108e" + "sha256": "371cc6e068621fa1a71c76670f9cdf7e5326b106fcc35735030ff9c1455b48f2" }, "pipfile-spec": 6, "requires": { @@ -27,11 +27,11 @@ }, "bleach": { "hashes": [ - "sha256:0900d8b37eba61a802ee40ac0061f8c2b5dee29c1927dd1d233e075ebf5a71da", - "sha256:4d2651ab93271d1129ac9cbc679f524565cc8a1b791909c4a51eac4446a15994" + "sha256:08a1fe86d253b5c88c92cc3d810fd8048a16d15762e1e5b74d502256e5926aa1", + "sha256:c6d6cc054bdc9c83b48b8083e236e5f00f238428666d2ce2e083eaa5fd568565" ], - "markers": "python_version >= '3.6'", - "version": "==4.1.0" + "markers": "python_version >= '3.7'", + "version": "==5.0.0" }, "cached-property": { "hashes": [ @@ -180,6 +180,14 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", "version": "==0.18.1" }, + "ecdsa": { + "hashes": [ + "sha256:5cf31d5b33743abe0dfc28999036c849a69d548f994b535e527ee3cb7f3ef676", + "sha256:b9f500bb439e4153d0330610f5d26baaf18d17b8ced1bc54410d189385ea68aa" + ], + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==0.17.0" + }, "idna": { "hashes": [ "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff", @@ -326,6 +334,24 @@ "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==0.2.3" }, + "pyasn1": { + "hashes": [ + "sha256:014c0e9976956a08139dc0712ae195324a75e142284d5f87f1a87ee1b068a359", + "sha256:03840c999ba71680a131cfaee6fab142e1ed9bbd9c693e285cc6aca0d555e576", + "sha256:0458773cfe65b153891ac249bcf1b5f8f320b7c2ce462151f8fa74de8934becf", + "sha256:08c3c53b75eaa48d71cf8c710312316392ed40899cb34710d092e96745a358b7", + "sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d", + "sha256:5c9414dcfede6e441f7e8f81b43b34e834731003427e5b09e4e00e3172a10f00", + "sha256:6e7545f1a61025a4e58bb336952c5061697da694db1cae97b116e9c46abcf7c8", + "sha256:78fa6da68ed2727915c4767bb386ab32cdba863caa7dbe473eaae45f9959da86", + "sha256:7ab8a544af125fb704feadb008c99a88805126fb525280b2270bb25cc1d78a12", + "sha256:99fcc3c8d804d1bc6d9a099921e39d827026409a58f2a720dcdb89374ea0c776", + "sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba", + "sha256:e89bf84b5437b532b0803ba5c9a5e054d21fec423a89952a74f87fa2c9b7bce2", + "sha256:fec3e9d8e36808a28efb59b489e4528c10ad0f480e57dcc32b4de5c9d8c9fdf3" + ], + "version": "==0.4.8" + }, "pycparser": { "hashes": [ "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9", @@ -343,11 +369,11 @@ }, "pyparsing": { "hashes": [ - "sha256:18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea", - "sha256:a6c06a88f252e6c322f65faf8f418b16213b51bdfaece0524c1c1bc30c63c484" + "sha256:7bf433498c016c4314268d95df76c81b842a4cb2b276fa3312cfb1e1d85f6954", + "sha256:ef7b523f6356f763771559412c0d7134753f037822dad1b16945b7b846f7ad06" ], - "markers": "python_version >= '3.6'", - "version": "==3.0.7" + "markers": "python_full_version >= '3.6.8'", + "version": "==3.0.8" }, "python-dateutil": { "hashes": [ @@ -357,6 +383,14 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.8.2" }, + "python-jose": { + "hashes": [ + "sha256:55779b5e6ad599c6336191246e95eb2293a9ddebd555f796a65f838f07e5d78a", + "sha256:9b1376b023f8b298536eedd47ae1089bcdb848f1535ab30555cd92002d78923a" + ], + "index": "pypi", + "version": "==3.3.0" + }, "readme-renderer": { "hashes": [ "sha256:262510fe6aae81ed4e94d8b169077f325614c0b1a45916a80442c6576264a9c2", @@ -398,11 +432,19 @@ }, "rich": { "hashes": [ - "sha256:198ae15807a7c1bf84ceabf662e902731bf8f874f9e775e2289cab02bb6a4e30", - "sha256:b60ff99f4ff7e3d1d37444dee2b22fdd941c622dbc37841823ec1ce7f058b263" + "sha256:c50f3d253bc6a9bb9c79d61a26d510d74abdf1b16881260fab5edfc3edfb082f", + "sha256:ea74bc9dad9589d8eea3e3fd0b136d8bf6e428888955f215824c2894f0da8b47" ], - "markers": "python_full_version >= '3.6.2' and python_full_version < '4.0.0'", - "version": "==12.1.0" + "markers": "python_full_version >= '3.6.3' and python_full_version < '4.0.0'", + "version": "==12.2.0" + }, + "rsa": { + "hashes": [ + "sha256:5c6bd9dc7a543b7fe4304a631f8a8a3b674e2bbfc49c2ae96200cdbe55df6b17", + "sha256:95c5d300c4e879ee69708c428ba566c59478fd653cc3a22243eeb8ed846950bb" + ], + "markers": "python_version >= '3.6' and python_full_version < '4.0.0'", + "version": "==4.8" }, "secretstorage": { "hashes": [ @@ -414,11 +456,11 @@ }, "setuptools": { "hashes": [ - "sha256:41aface2e85b517c3a466b4689b8055c02cd2e623461f09af7d93f3da65c4709", - "sha256:88fafba4abc2f047e08a188fd4bbc10b0e464592c37b514c19f8f8f88d94450b" + "sha256:26ead7d1f93efc0f8c804d9fafafbe4a44b179580a7105754b245155f9af05a8", + "sha256:47c7b0c0f8fc10eec4cf1e71c6fdadf8decaa74ffa087e68cd1c20db7ad6a592" ], "markers": "python_version >= '3.7'", - "version": "==61.3.1" + "version": "==62.1.0" }, "six": { "hashes": [ diff --git a/README.md b/README.md index 89ec09f..f5bbb2c 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,23 @@ -# template-python-types - -###(For the instructions below, the original packagename will be assumed to be `foo-bar`. Adapt this to your use case) - -Step-by-step instructions on using this template: - -- Create a new repository using this template. Name it `types-foo-bar`. - - Set up anything that may not carry over from the template (branch permissions, enabling the renovate bot, etc) - - You can use [this](https://app.gitbook.com/o/kE0i1aiE1u2yiaP5k3xM/s/B8iaOECpmPzLCKc8nF0p/development/github-repository-init-checklist) for a full list (although some steps do not apply, like the `next` branch or the `unit-tests` action) - - Set the repository to `public` access. Take a second to think through the implications of this. Extra care will be needed to avoid leaking any information -- Replace all instances of `changeme` strings as follows: - - Replace these: - - `changeme-package-name` => `foo-bar` (name of the original package) - - `changeme-types-package-name` => `types-foo-bar` (name of your stubs package; **must** start with `types-`) - - `changeme-package-name-stubs` => `foo-bar-stubs` (name of the stubs root folder; **must** end with `-stubs`) - - In the following files: - - `README.md` - - `.releaserc` - - `.pre-commit-config.yaml` - - `setup.py` -- Rename the folder `changeme-package-name-stubs` to `foo-bar-stubs`. This will be the root folder for all the stub files -- In `foo-bar-stubs/METADATA.toml`, change the version from `"X.Y.*"` to the version of the original package for which your stubs are meant for (usually the latest one) -- Update the package's information in `setup.py` - - Add/Update the [classifiers](https://pypi.org/classifiers/) to help people find the package - - Add some keywords (like the original package name, related frameworks, etc) to help people find the package - - Change the versions in `python_requires` if necessary. Make sure it matches the versions listed in the classifiers -- Add the dependencies: - - Add your dependencies to the `Pipfile` with an exact version - - Run `$ pipenv install -d` to update the `Pipfile.lock` - - Run `$ pipenv shell` to switch to a shell within the virtual environment - - Run `$ pipenv-setup sync --pipfile --dev` to sync the dependencies to the `setup.py` -- Install the pre-commit hook (see below, in the `Developing` section) -- Add your stubs - - [Optional] Mark the `foo-bar-stubs` directory as `Sources Root` and the `.mypy_cache` directory as `Excluded` - - The stubs can be generated with [stubgen](https://mypy.readthedocs.io/en/stable/stubgen.html#stubgen) with the command `$ stubgen -p foo-bar`, and will only need to be filled in - - The files need to use the root of the `foo-bar-stubs` as their root, and only have sub-folders as necessary to match the structure of the original package -- Test your stubs - - If you add the stubs root directory (`foo-bar-stubs`) to `mypy`'s path, it should pick up and use your stubs automatically. You can tell this is the case when it gives off a warning about the `type: ignore[import]` comment for that specific package being unused (doesn't complain about the package not having stubs available) -- Uncomment the action in `.github/workflows/on-push-to-main.yml` to allow the package to be released -- Remove these instructions from `README.md` (they will still be available in the template repo for the next steps) -- A search through the whole project (CTRL + Shift + F in PyCharm) should find no results for `changeme` -- Release the package - - Merge your changes into the `main` branch (preferably via PR) - - Wait for the GH Action to run, and the package to be released - - The package should be available at https://pypi.org/project/types-foo-bar/ - - Download your package and test it again as a final check - -# changeme-types-package-name +# types-python-jose This is a package containing type annotations -for [changeme-package-name](https://pypi.org/project/changeme-package-name/). +for [python-jose](https://pypi.org/project/python-jose/). ### Installing: Simply run the following in the environment in which you want to install this package: ```shell -# install changeme-types-package-name -$ python -m pip install changeme-types-package-name +# install types-python-jose +$ python -m pip install types-python-jose ``` or add it to your requirements file. ### Developing -This is a partial stub package, only covering a part of the functions and objects available in `changeme-package-name`. -Contributions (both in adding stubs for more functions, or keeping up to date with `changeme-package-name` itself) are +This is a partial stub package, only covering a part of the functions and objects available in `python-jose`. +Contributions (both in adding stubs for more functions, or keeping up to date with `python-jose` itself) are welcome. All the formatting is done using [pre-commit](https://pre-commit.com/). To use this, run the following: diff --git a/changeme-package-name-stubs/METADATA.toml b/changeme-package-name-stubs/METADATA.toml deleted file mode 100644 index 67b5606..0000000 --- a/changeme-package-name-stubs/METADATA.toml +++ /dev/null @@ -1 +0,0 @@ -version = "X.Y.*" diff --git a/jose-stubs/METADATA.toml b/jose-stubs/METADATA.toml new file mode 100644 index 0000000..b713bbf --- /dev/null +++ b/jose-stubs/METADATA.toml @@ -0,0 +1 @@ +version = "3.3.*" diff --git a/jose-stubs/__init__.pyi b/jose-stubs/__init__.pyi new file mode 100644 index 0000000..9a35197 --- /dev/null +++ b/jose-stubs/__init__.pyi @@ -0,0 +1,6 @@ +from .exceptions import ( + ExpiredSignatureError as ExpiredSignatureError, + JOSEError as JOSEError, + JWSError as JWSError, + JWTError as JWTError, +) diff --git a/jose-stubs/backends/__init__.pyi b/jose-stubs/backends/__init__.pyi new file mode 100644 index 0000000..02bb947 --- /dev/null +++ b/jose-stubs/backends/__init__.pyi @@ -0,0 +1,3 @@ +from .base import DIRKey as DIRKey +from jose.backends.native import HMACKey as HMACKey, get_random_bytes as get_random_bytes +from jose.backends.rsa_backend import RSAKey as RSAKey diff --git a/jose-stubs/backends/_asn1.pyi b/jose-stubs/backends/_asn1.pyi new file mode 100644 index 0000000..964e6fa --- /dev/null +++ b/jose-stubs/backends/_asn1.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/jose-stubs/backends/base.pyi b/jose-stubs/backends/base.pyi new file mode 100644 index 0000000..d91840a --- /dev/null +++ b/jose-stubs/backends/base.pyi @@ -0,0 +1,4 @@ +from ..utils import base64url_encode as base64url_encode, ensure_binary as ensure_binary +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/jose-stubs/backends/cryptography_backend.pyi b/jose-stubs/backends/cryptography_backend.pyi new file mode 100644 index 0000000..cb32a37 --- /dev/null +++ b/jose-stubs/backends/cryptography_backend.pyi @@ -0,0 +1,13 @@ +from ..constants import ALGORITHMS as ALGORITHMS +from ..exceptions import JWEError as JWEError, JWKError as JWKError +from ..utils import ( + base64_to_long as base64_to_long, + base64url_decode as base64url_decode, + base64url_encode as base64url_encode, + ensure_binary as ensure_binary, + long_to_base64 as long_to_base64, +) +from .base import Key as Key +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/jose-stubs/backends/ecdsa_backend.pyi b/jose-stubs/backends/ecdsa_backend.pyi new file mode 100644 index 0000000..5a15055 --- /dev/null +++ b/jose-stubs/backends/ecdsa_backend.pyi @@ -0,0 +1,7 @@ +from ..backends.base import Key as Key +from ..constants import ALGORITHMS as ALGORITHMS +from ..exceptions import JWKError as JWKError +from ..utils import base64_to_long as base64_to_long, long_to_base64 as long_to_base64 +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/jose-stubs/backends/native.pyi b/jose-stubs/backends/native.pyi new file mode 100644 index 0000000..240c2c0 --- /dev/null +++ b/jose-stubs/backends/native.pyi @@ -0,0 +1,7 @@ +from ..backends.base import Key as Key +from ..constants import ALGORITHMS as ALGORITHMS +from ..exceptions import JWKError as JWKError +from ..utils import base64url_decode as base64url_decode, base64url_encode as base64url_encode +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/jose-stubs/backends/rsa_backend.pyi b/jose-stubs/backends/rsa_backend.pyi new file mode 100644 index 0000000..8e0f564 --- /dev/null +++ b/jose-stubs/backends/rsa_backend.pyi @@ -0,0 +1,16 @@ +from ..backends._asn1 import ( + rsa_private_key_pkcs1_to_pkcs8 as rsa_private_key_pkcs1_to_pkcs8, + rsa_private_key_pkcs8_to_pkcs1 as rsa_private_key_pkcs8_to_pkcs1, + rsa_public_key_pkcs1_to_pkcs8 as rsa_public_key_pkcs1_to_pkcs8, +) +from ..backends.base import Key as Key +from ..constants import ALGORITHMS as ALGORITHMS +from ..exceptions import JWEError as JWEError, JWKError as JWKError +from ..utils import base64_to_long as base64_to_long, long_to_base64 as long_to_base64 +from typing import Any + +LEGACY_INVALID_PKCS8_RSA_HEADER: Any +ASN1_SEQUENCE_ID: Any +RSA_ENCRYPTION_ASN1_OID: str + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/jose-stubs/constants.pyi b/jose-stubs/constants.pyi new file mode 100644 index 0000000..1e56c50 --- /dev/null +++ b/jose-stubs/constants.pyi @@ -0,0 +1,72 @@ +from hashlib import _Hash +from typing import Optional + +from .backends.base import Key + +class Algorithms: + NONE: str + HS256: str + HS384: str + HS512: str + RS256: str + RS384: str + RS512: str + ES256: str + ES384: str + ES512: str + A128CBC_HS256: str + A192CBC_HS384: str + A256CBC_HS512: str + A128GCM: str + A192GCM: str + A256GCM: str + A128CBC: str + A192CBC: str + A256CBC: str + DIR: str + RSA1_5: str + RSA_OAEP: str + RSA_OAEP_256: str + A128KW: str + A192KW: str + A256KW: str + ECDH_ES: str + ECDH_ES_A128KW: str + ECDH_ES_A192KW: str + ECDH_ES_A256KW: str + A128GCMKW: str + A192GCMKW: str + A256GCMKW: str + PBES2_HS256_A128KW: str + PBES2_HS384_A192KW: str + PBES2_HS512_A256KW: str + DEF: str + HMAC: set[str] + RSA_DS: set[str] + RSA_KW: set[str] + RSA: set[str] + EC_DS: set[str] + EC_KW: set[str] + EC: set[str] + AES_PSEUDO: set[str] + AES_JWE_ENC: set[str] + AES_ENC: set[str] + AES_KW: set[str] + AEC_GCM_KW: set[str] + AES: set[str] + PBES2_KW: set[str] + HMAC_AUTH_TAG: set[str] + GCM: set[str] + SUPPORTED: set[str] + ALL: set[str] + HASHES: dict[str, _Hash] + KEYS: dict[str, Key] + +ALGORITHMS: Algorithms + +class Zips: + DEF: str + NONE: None + SUPPORTED: set[Optional[str]] + +ZIPS: Zips diff --git a/jose-stubs/exceptions.pyi b/jose-stubs/exceptions.pyi new file mode 100644 index 0000000..d7ab217 --- /dev/null +++ b/jose-stubs/exceptions.pyi @@ -0,0 +1,12 @@ +class JOSEError(Exception): ... +class JWSError(JOSEError): ... +class JWSSignatureError(JWSError): ... +class JWSAlgorithmError(JWSError): ... +class JWTError(JOSEError): ... +class JWTClaimsError(JWTError): ... +class ExpiredSignatureError(JWTError): ... +class JWKError(JOSEError): ... +class JWEError(JOSEError): ... +class JWEParseError(JWEError): ... +class JWEInvalidAuth(JWEError): ... +class JWEAlgorithmUnsupportedError(JWEError): ... diff --git a/jose-stubs/jwe.pyi b/jose-stubs/jwe.pyi new file mode 100644 index 0000000..05acdfb --- /dev/null +++ b/jose-stubs/jwe.pyi @@ -0,0 +1,12 @@ +from . import jwk as jwk +from .backends import get_random_bytes as get_random_bytes +from .constants import ALGORITHMS as ALGORITHMS, ZIPS as ZIPS +from .exceptions import JWEError as JWEError, JWEParseError as JWEParseError +from .utils import ( + base64url_decode as base64url_decode, + base64url_encode as base64url_encode, + ensure_binary as ensure_binary, +) +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/jose-stubs/jwk.pyi b/jose-stubs/jwk.pyi new file mode 100644 index 0000000..b23e224 --- /dev/null +++ b/jose-stubs/jwk.pyi @@ -0,0 +1,8 @@ +from .backends.base import Key as Key +from .constants import ALGORITHMS as ALGORITHMS +from .exceptions import JWKError as JWKError +from typing import Any, Optional, Literal + +def get_key(algorithm: str) -> Optional[Key]: ... +def register_key(algorithm: str, key_class: Key) -> Literal[True]: ... +def construct(key_data: dict[str, Any], algorithm: Optional[str] = ...) -> Key: ... diff --git a/jose-stubs/jws.pyi b/jose-stubs/jws.pyi new file mode 100644 index 0000000..28f627a --- /dev/null +++ b/jose-stubs/jws.pyi @@ -0,0 +1,7 @@ +from .backends.base import Key as Key +from .constants import ALGORITHMS as ALGORITHMS +from .exceptions import JWSError as JWSError, JWSSignatureError as JWSSignatureError +from .utils import base64url_decode as base64url_decode, base64url_encode as base64url_encode +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/jose-stubs/jwt.pyi b/jose-stubs/jwt.pyi new file mode 100644 index 0000000..3c1ec22 --- /dev/null +++ b/jose-stubs/jwt.pyi @@ -0,0 +1,23 @@ +from typing import Any, Union, Optional, Iterable +from .constants import ALGORITHMS as ALGORITHMS + +def encode( + claims: dict[str, Any], + key: Union[str, dict[str, str]], + algorithm: str = ..., + headers: Optional[dict[str, str]] = ..., + access_token: Optional[str] = ..., +) -> str: ... +def decode( + token: str, + key: Union[str, dict[str, str]], + algorithms: Union[str, list[str], None] = ..., + options: Optional[dict[str, Union[str, int]]] = ..., + audience: Optional[str] = ..., + issuer: Union[str, Iterable[str], None] = ..., + subject: Optional[str] = ..., + access_token: Optional[str] = ..., +) -> dict[str, Any]: ... +def get_unverified_header(token: str) -> dict[str, str]: ... +def get_unverified_headers(token: str) -> dict[str, str]: ... +def get_unverified_claims(token: str) -> dict[str, Any]: ... diff --git a/jose-stubs/utils.pyi b/jose-stubs/utils.pyi new file mode 100644 index 0000000..964e6fa --- /dev/null +++ b/jose-stubs/utils.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/setup.py b/setup.py index 4e8e2e1..60ffaca 100644 --- a/setup.py +++ b/setup.py @@ -18,11 +18,11 @@ long_description = f.read() setup( - name="changeme-types-package-name", - description="Type Stubs for changeme-package-name", + name="types-python-jose", + description="Type Stubs for python-jose", long_description=long_description, long_description_content_type="text/markdown", - url="https://github.com/cex-solutions/changeme-package-name", + url="https://github.com/cex-solutions/python-jose", author="Binovate Labs", author_email="cex-dev@binovate.com", classifiers=[ @@ -37,20 +37,18 @@ "Programming Language :: Python :: 3.10", ], license="GPLv3", - keywords="stubs", + keywords="stubs python-jose jose", package_data={ - "changeme-package-name-stubs": [ - item.split("changeme-package-name-stubs/")[-1] for item in glob.glob("**/*.pyi", recursive=True) - ] + "jose-stubs": [item.split("jose-stubs/")[-1] for item in glob.glob("**/*.pyi", recursive=True)] + ["METADATA.toml"] }, - packages=["changeme-package-name-stubs"], + packages=["jose-stubs"], python_requires=">=3.7, <4", install_requires=[], - extras_require={"dev": ["mypy==0.942", "pipenv-setup==3.2.0", "twine==4.0.0"]}, + extras_require={"dev": ["python-jose==3.3.0", "mypy==0.942", "pipenv-setup==3.2.0", "twine==4.0.0"]}, dependency_links=[], project_urls={ - "Bug Reports": "https://github.com/cex-solutions/changeme-types-package-name/issues", - "Source": "https://github.com/cex-solutions/changeme-types-package-name", + "Bug Reports": "https://github.com/cex-solutions/types-python-jose/issues", + "Source": "https://github.com/cex-solutions/types-python-jose", }, )