Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored May 14, 2024
2 parents e39a0d3 + 994b7fc commit 8317fae
Show file tree
Hide file tree
Showing 18 changed files with 198 additions and 102 deletions.
41 changes: 41 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "pycognito dev",
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.8",
"postStartCommand": "python3 -m pip install -e .",
"postCreateCommand": "python3 -m pip install -r requirements_test.txt tox",
"containerUser": "vscode",
"containerEnv": {
"GIT_EDITOR": "code --wait"
},
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"ms-python.python",
"ms-python.vscode-pylance",
"visualstudioexptteam.vscodeintellicode"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.formatting.provider": "black",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.rulers": [
88
],
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh"
}
}
}
}
12 changes: 0 additions & 12 deletions .devcontainer/Dockerfile

This file was deleted.

25 changes: 0 additions & 25 deletions .devcontainer/devcontainer.json

This file was deleted.

43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Report a bug with pyCognito"
description: Report an issue with pyCognito
body:
- type: textarea
attributes:
label: The problem
placeholder: >-
Describe the issue you are experiencing here to communicate to the
maintainers. Tell us what you were trying to do and what happened.
validations:
required: true
- type: markdown
attributes:
value: |
## Environment
- type: input
attributes:
label: Operating system
validations:
required: true
- type: textarea
validations:
required: true
attributes:
label: Python version
render: txt
- type: textarea
validations:
required: true
attributes:
label: Problem-relevant code
description: >-
A minimal example to reproduce the bug
render: python
- type: textarea
attributes:
label: Traceback/Error logs
description: >-
If you come across any trace or error logs, please provide them.
render: txt
- type: textarea
attributes:
label: Additional information
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
7 changes: 6 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
interval: monthly
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
8 changes: 8 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
change-template: "- #$NUMBER $TITLE @$AUTHOR"
sort-direction: ascending

categories:
- title: "Dependency Updates"
label: "dependencies"
collapse-after: 1

template: |
## What’s Changed
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
tox:
runs-on: ubuntu-latest
name: Tox
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/[email protected]

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Install tox
run: python3 -m pip install tox

- name: Run Tox
run: tox
62 changes: 45 additions & 17 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,59 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [published]
types:
- published

jobs:
deploy:
permissions: {}

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/[email protected]

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5.1.0
with:
python-version: '3.x'
python-version: "3.x"

- name: Verify version
uses: home-assistant/actions/helpers/verify-version@master

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
pip install setuptools build
- name: Build
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python -m build
- name: Upload dists
uses: actions/[email protected]
with:
name: "dist"
path: "dist/"
if-no-files-found: error
retention-days: 5

publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: "build"
environment:
name: release
url: https://pypi.org/p/pycognito
permissions:
id-token: write
steps:
- name: Download dists
uses: actions/[email protected]
with:
name: "dist"
path: "dist/"

- name: Publish dists to PyPI
# Pinned to a commit for security purposes
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 0 additions & 31 deletions .github/workflows/test.yml

This file was deleted.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ Makes working with AWS Cognito easier for Python developers.

## Python Versions Supported

- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11
- 3.12

## Install

Expand Down
4 changes: 2 additions & 2 deletions pycognito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ def authenticate(self, password, client_metadata=None):
except MFAChallengeException as mfa_challenge:
self.mfa_tokens = mfa_challenge.get_tokens()
raise mfa_challenge
else:
self._set_tokens(tokens)

self._set_tokens(tokens)

def new_password_challenge(self, password, new_password):
"""
Expand Down
2 changes: 1 addition & 1 deletion pycognito/aws_srp.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def authenticate_user(self, client=None, client_metadata=None):
ClientId=self.client_id,
ChallengeName=self.PASSWORD_VERIFIER_CHALLENGE,
ChallengeResponses=challenge_response,
**dict(ClientMetadata=client_metadata) if client_metadata else {},
**({"ClientMetadata": client_metadata} if client_metadata else {}),
)
if tokens.get("ChallengeName") == self.DEVICE_SRP_CHALLENGE:
challenge_response = {
Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ disable=
too-many-branches

[EXCEPTIONS]
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception
13 changes: 6 additions & 7 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
mock==4.0.3
coverage==6.3.2
black==22.10.0
coverage==7.5.1
black==24.4.2
flake8==7.0.0
pylint==2.15.5
pytest==7.1.2
pylint==3.1.1
pytest==8.2.0
moto[cognitoidp]>=5.0.0
requests-mock==1.9.3
freezegun==1.2.1
requests-mock==1.12.1
freezegun==1.5.1
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ use_parentheses = true

[flake8]
max-line-length = 88
ignore = E501, W503, E203
ignore = E231, E501, W503, E203
2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import unittest
import os.path
from unittest.mock import patch
import uuid

import freezegun
Expand All @@ -9,7 +10,6 @@
import boto3
from botocore.exceptions import ParamValidationError
from botocore.stub import Stubber
from mock import patch
from envs import env
import requests
import requests_mock
Expand Down

0 comments on commit 8317fae

Please sign in to comment.