Repository: victorskl/yawsso (language: python)

Issue:
Fix distutils packaging warning
> DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future




Discussion / hints:

Fix patch:
diff --git a/.codacy.yml b/.codacy.yml
deleted file mode 100644
index 52f2828..0000000
--- a/.codacy.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-exclude_paths:
-  - '.github/**'
-  - '.travis.yml'
-  - 'README.md'
-  - 'cdk.py'
-  - 'main.tf'
-  - 'Makefile'
diff --git a/.github/workflows/prbuild.yml b/.github/workflows/prbuild.yml
index 193fda0..e4abd68 100644
--- a/.github/workflows/prbuild.yml
+++ b/.github/workflows/prbuild.yml
@@ -4,43 +4,82 @@ on:
   push:
     branches:
       - main
-      - dev
+
   pull_request:
     branches:
       - main
-      - dev
+
+# Actions Used:
+#  https://github.com/actions/setup-python#usage
+#  https://github.com/marketplace/actions/codecov
+#  https://github.com/marketplace/actions/code-climate-coverage-action
+#  https://docs.codeclimate.com/docs/github-actions-test-coverage
+#  https://github.com/marketplace/actions/trufflehog-oss
 
 jobs:
   build:
 
+    # Default access (restricted) - https://docs.github.com/en/actions/security-guides/automatic-token-authentication
+    permissions:
+      contents: read
+
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: [3.6, 3.7, 3.8, 3.9]
+        python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10' ]
 
     steps:
-    - uses: actions/checkout@v2
-    - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v1
-      with:
-        python-version: ${{ matrix.python-version }}
-    - name: Install dependencies
-      run: |
-        sudo apt-get install xclip xvfb
-        python -m pip install --upgrade pip
-        pip install '.[test]' .
-    - name: Lint with flake8
-      run: |
-        # stop the build if there are Python syntax errors or undefined names
-        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
-        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
-        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
-    - name: Test with pytest
-      run: |
-        xvfb-run pytest --cov-report xml --cov=yawsso tests/
-    - name: Upload coverage to Codecov
-      uses: codecov/codecov-action@v1
-      with:
-        file: ./coverage.xml
-        flags: unittests
-        name: yawsso
+      - name: Checkout code
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: TruffleHog OSS
+        uses: trufflesecurity/trufflehog@v3.4.3
+        with:
+          path: ./
+          base: ${{ github.event.repository.default_branch }}
+          head: HEAD
+
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+
+      - name: Install dependencies
+        run: |
+          sudo apt-get install xclip xvfb
+          python -m pip install --upgrade pip
+          pip install '.[test]' .
+
+      - name: Lint with flake8
+        run: |
+          # stop the build if there are Python syntax errors or undefined names
+          flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
+          # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
+          flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+
+      - name: Test with pytest
+        run: |
+          xvfb-run pytest --cov-report xml --cov=yawsso tests/
+
+      - name: Publish coverage to to Codecov
+        uses: codecov/codecov-action@v2
+        with:
+          file: ./coverage.xml
+          flags: unittests
+          name: yawsso
+
+      - name: Publish coverage to CodeClimate
+        uses: paambaati/codeclimate-action@v3.0.0
+        env:
+          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
+        with:
+          coverageLocations: |
+            ${{ github.workspace }}/coverage.xml:coverage.py
+
+      - name: Publish coverage to Coveralls
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
+        run: coveralls
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..adc3d53
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,42 @@
+repos:
+
+  - repo: https://github.com/Yelp/detect-secrets
+    rev: v1.2.0
+    hooks:
+      - id: detect-secrets
+        name: detect secrets
+        args: [ '--baseline', '.secrets.baseline' ]
+        exclude: yarn.lock
+
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.1.0
+    hooks:
+      - id: check-added-large-files
+      - id: check-json
+      - id: check-yaml
+#      - id: detect-aws-credentials
+      - id: detect-private-key
+#      - id: no-commit-to-branch
+#        args: [ --branch, main, --branch, master, --pattern, release/.* ]
+
+#  - repo: local
+#    hooks:
+#      - id: yarn-audit
+#        name: yarn audit
+#        entry: npx yarn audit --groups dependencies
+#        language: system
+#        pass_filenames: false
+
+#  - repo: local
+#    hooks:
+#      - id: trufflehog-git
+#        name: trufflehog git
+#        entry: trufflehog --debug git file://.
+#        language: system
+#        pass_filenames: false
+
+#  - repo: https://github.com/psf/black
+#    rev: 22.1.0
+#    hooks:
+#      - id: black
+#        language_version: python3.9
diff --git a/.secrets.baseline b/.secrets.baseline
new file mode 100644
index 0000000..a383279
--- /dev/null
+++ b/.secrets.baseline
@@ -0,0 +1,109 @@
+{
+  "version": "1.2.0",
+  "plugins_used": [
+    {
+      "name": "ArtifactoryDetector"
+    },
+    {
+      "name": "AWSKeyDetector"
+    },
+    {
+      "name": "AzureStorageKeyDetector"
+    },
+    {
+      "name": "Base64HighEntropyString",
+      "limit": 4.5
+    },
+    {
+      "name": "BasicAuthDetector"
+    },
+    {
+      "name": "CloudantDetector"
+    },
+    {
+      "name": "GitHubTokenDetector"
+    },
+    {
+      "name": "HexHighEntropyString",
+      "limit": 3.0
+    },
+    {
+      "name": "IbmCloudIamDetector"
+    },
+    {
+      "name": "IbmCosHmacDetector"
+    },
+    {
+      "name": "JwtTokenDetector"
+    },
+    {
+      "name": "KeywordDetector",
+      "keyword_exclude": ""
+    },
+    {
+      "name": "MailchimpDetector"
+    },
+    {
+      "name": "NpmDetector"
+    },
+    {
+      "name": "PrivateKeyDetector"
+    },
+    {
+      "name": "SendGridDetector"
+    },
+    {
+      "name": "SlackDetector"
+    },
+    {
+      "name": "SoftlayerDetector"
+    },
+    {
+      "name": "SquareOAuthDetector"
+    },
+    {
+      "name": "StripeDetector"
+    },
+    {
+      "name": "TwilioKeyDetector"
+    }
+  ],
+  "filters_used": [
+    {
+      "path": "detect_secrets.filters.allowlist.is_line_allowlisted"
+    },
+    {
+      "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
+      "min_level": 2
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_indirect_reference"
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_likely_id_string"
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_lock_file"
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_potential_uuid"
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_sequential_string"
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_swagger_file"
+    },
+    {
+      "path": "detect_secrets.filters.heuristic.is_templated_secret"
+    }
+  ],
+  "results": {},
+  "generated_at": "2022-06-26T08:44:37Z"
+}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index c520bbe..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-language: python
-addons:
-  apt:
-    packages:
-      - xclip
-      - xvfb
-python:
-  - "3.6"
-  - "3.7"
-  - "3.8"
-  - "3.9"
-install:
-  # Install awscli v2 if not available
-  #- if ! [ -x "$(command -v aws)" ]; then curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" ; unzip awscliv2.zip ; sudo ./aws/install ; fi
-  # v1 should be fine for testing purpose
-  - pip install awscli
-  - pip install tox
-  - pip install '.[test]' .
-script:
-  - which aws
-# https://github.com/travis-ci/travis-ci/issues/4387
-# https://stackoverflow.com/questions/57743427/accessing-clipboard-on-travis-ci
-  - xvfb-run pytest
-#  - xvfb-run tox
-after_success:
-  - coveralls
diff --git a/Makefile b/Makefile
index 883bc6b..5488887 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,10 @@
 install:
 	@pip install '.[dev,test]' .
+	@pre-commit install
+
+check:
+	@trufflehog --debug --only-verified git file://./ --since-commit main --branch HEAD --fail
+	@pre-commit run --all-files
 
 test:
 	@py.test
@@ -8,7 +13,10 @@ unit:
 	@python -m unittest
 
 coverage:
-	@coverage run --source=yawsso -m pytest tests/
+	@coverage run --source=yawsso -m pytest --cov-report xml tests/
+
+coveralls: coverage
+	@coveralls
 
 tox:
 	@tox -vv
@@ -29,16 +37,22 @@ doc:
 	@py.test --cov-report html:local/coverage --cov=yawsso tests/
 	@py.test --cov-report xml:local/coverage.xml --cov=yawsso tests/
 
+clean:
+	@rm -rf build/
+	@rm -rf yawsso.egg-info/
+
 .PHONY: dist
-dist:
-	@python setup.py sdist bdist_wheel
+dist: clean
+	@python3 -m build
 
 # Usage: make ver version=0.1.0
 ver: dist/yawsso-$(version).tar.gz
 	@echo $(version)
 
 testpypi: dist/yawsso-$(version).tar.gz
-	@twine upload --repository testpypi --sign dist/yawsso-$(version)*
+	@python3 -m twine upload --repository testpypi --sign dist/yawsso-$(version).*
+	@python3 -m twine upload --repository testpypi --sign dist/yawsso-$(version)-*
 
 pypi: dist/yawsso-$(version).tar.gz
-	@twine upload --sign dist/yawsso-$(version)*
+	@python3 -m twine upload --sign dist/yawsso-$(version).*
+	@python3 -m twine upload --sign dist/yawsso-$(version)-*
diff --git a/README.md b/README.md
index 74b3d8b..efa738b 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,20 @@
 # yawsso
 
-[![Pull Request Build Status](https://github.com/victorskl/yawsso/workflows/Pull%20Request%20Build/badge.svg)](https://github.com/victorskl/yawsso/actions) [![Build Status](https://travis-ci.org/victorskl/yawsso.svg?branch=main)](https://travis-ci.org/victorskl/yawsso) [![codecov.io](https://codecov.io/gh/victorskl/yawsso/coverage.svg?branch=main)](https://codecov.io/gh/victorskl/yawsso?branch=main) [![Coverage Status](https://coveralls.io/repos/github/victorskl/yawsso/badge.svg?branch=main)](https://coveralls.io/github/victorskl/yawsso?branch=main) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/e02d74942ed143a381603cd60ba4f64b)](https://app.codacy.com/manual/victorskl/yawsso?utm_source=github.com&utm_medium=referral&utm_content=victorskl/yawsso&utm_campaign=Badge_Grade_Dashboard) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/victorskl/yawsso.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/victorskl/yawsso/context:python) [![Total alerts](https://img.shields.io/lgtm/alerts/g/victorskl/yawsso.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/victorskl/yawsso/alerts/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/yawsso?style=flat)](https://pypistats.org/packages/yawsso) [![PyPI](https://img.shields.io/pypi/v/yawsso?style=flat)](https://pypi.org/project/yawsso) 
+[![Pull Request Build Status](https://github.com/victorskl/yawsso/workflows/Pull%20Request%20Build/badge.svg)](https://github.com/victorskl/yawsso/actions/workflows/prbuild.yml) 
+[![CodeQL](https://github.com/victorskl/yawsso/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/victorskl/yawsso/actions/workflows/codeql-analysis.yml) 
+[![codecov.io](https://codecov.io/gh/victorskl/yawsso/coverage.svg?branch=main)](https://codecov.io/gh/victorskl/yawsso?branch=main)
+[![coveralls.io](https://coveralls.io/repos/github/victorskl/yawsso/badge.svg?branch=main)](https://coveralls.io/github/victorskl/yawsso?branch=main)
+[![codeclimate - Test Coverage](https://api.codeclimate.com/v1/badges/44dd1cbae44465118742/test_coverage)](https://codeclimate.com/github/victorskl/yawsso/test_coverage)
+[![codeclimate - Maintainability](https://api.codeclimate.com/v1/badges/44dd1cbae44465118742/maintainability)](https://codeclimate.com/github/victorskl/yawsso/maintainability)
+[![lgtm - Language grade: Python](https://img.shields.io/lgtm/grade/python/g/victorskl/yawsso.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/victorskl/yawsso/context:python) 
+[![lgtm - Total alerts](https://img.shields.io/lgtm/alerts/g/victorskl/yawsso.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/victorskl/yawsso/alerts/) 
+[![snyk](https://snyk.io/advisor/python/yawsso/badge.svg)](https://snyk.io/advisor/python/yawsso) 
+[![kandi](https://img.shields.io/badge/kandi-X--Ray%20Report-ff69b4)](https://kandi.openweaver.com/python/victorskl/yawsso) 
+[![PyPI - Downloads](https://img.shields.io/pypi/dm/yawsso?style=flat)](https://pypistats.org/packages/yawsso) 
+[![PyPI](https://img.shields.io/pypi/v/yawsso?style=flat)](https://pypi.org/project/yawsso)
 [![PyPI - License](https://img.shields.io/pypi/l/yawsso?style=flat)](https://opensource.org/licenses/MIT)
 
+
 Yet Another AWS SSO - sync up AWS CLI v2 SSO login session to legacy CLI v1 credentials.
 
 ## Prerequisite
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..8d91941
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,6 @@
+[build-system]
+requires = [
+    "setuptools",
+    "wheel"
+]
+build-backend = "setuptools.build_meta"
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..c9de602
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,3 @@
+; As per guide https://packaging.python.org/en/latest/guides/single-sourcing-package-version/
+[metadata]
+version = attr: yawsso.__version__
diff --git a/setup.py b/setup.py
index a1fb810..dfe8ab3 100644
--- a/setup.py
+++ b/setup.py
@@ -1,13 +1,11 @@
 from setuptools import setup
 
-from yawsso import __version__
-
 with open("README.md", "r") as f:
     long_description = f.read()
 
 setup(
     name="yawsso",
-    version=__version__,
+    # version="MOVE TO setup.cfg",
     description="Yet Another AWS SSO - sync up AWS CLI v2 SSO login session to legacy CLI v1 credentials",
     long_description=long_description,
     long_description_content_type="text/markdown",
@@ -20,6 +18,15 @@
     entry_points={
         "console_scripts": ["yawsso=yawsso.cli:main"],
     },
+    project_urls={
+        "Bug Tracker": "https://github.com/victorskl/yawsso/issues",
+    },
+    classifiers=[
+        "Development Status :: 5 - Production/Stable",
+        "Programming Language :: Python :: 3",
+        "License :: OSI Approved :: MIT License",
+        "Operating System :: OS Independent",
+    ],
     extras_require={
         "all": [
             "pyperclip",
@@ -31,15 +38,18 @@
             "mockito",
             "cli-test-helpers",
             "coveralls",
-            "pyperclip==1.7.0",
+            "pyperclip",
         ],
         "dev": [
             "twine",
             "setuptools",
             "wheel",
+            "build",
             "aws-cdk.aws-ec2",
             "tox",
             "nose2",
+            "pre-commit",
+            "detect-secrets",
         ],
     },
     python_requires=">=3.6",
diff --git a/tox.ini b/tox.ini
index c73d8b4..64bd76c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,9 +1,9 @@
 [tox]
-envlist = py{36,37,38,39}
+envlist = py{36,37,38,39,310}
 skip_missing_interpreters=True
 
 [testenv]
-passenv = GITHUB_* TRAVIS TRAVIS_* COVERALLS_*
+passenv = GITHUB_* COVERALLS_*
 deps =
     .[test]
 commands =
diff --git a/yawsso/__init__.py b/yawsso/__init__.py
index 7ddd042..05b0c12 100644
--- a/yawsso/__init__.py
+++ b/yawsso/__init__.py
@@ -1,2 +1,2 @@
 """yawsso cli package, version follow PEP440."""
-__version__ = VERSION = '0.7.2'  # pragma: no cover
+__version__ = VERSION = '1.0.0rc1'  # pragma: no cover


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
index d256965..77b24e6 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -125,7 +125,7 @@ def setUp(self) -> None:
             'roleCredentials':
                 {
                     'accessKeyId': 'does-not-matter',
-                    'secretAccessKey': 'does-not-matter',
+                    'secretAccessKey': '',
                     'sessionToken': 'VeryLongBase664String==',
                     'expiration': datetime.utcnow().timestamp()
                 }
@@ -134,7 +134,7 @@ def setUp(self) -> None:
         mock_assume_role = {
             "Credentials": {
                 "AccessKeyId": "does-not-matter",
-                "SecretAccessKey": "does-not-matter",
+                "SecretAccessKey": "",
                 "SessionToken": "VeryLongBase664String==",
                 "Expiration": "2020-06-13T17:15:23+00:00"
             },
@@ -172,7 +172,7 @@ def setUp(self) -> None:
         }
 
         mock_success = True
-        mock_cli_v2 = 'aws-cli/2.0.9 Python/3.8.2 Darwin/19.4.0 botocore/2.0.0dev13 (MOCK)'
+        mock_cli_v2 = 'aws-cli/2.7.10 Python/3.9.13 Darwin/21.5.0 source/x86_64 prompt/off (MOCK)'
         when(cli).invoke(contains('aws --version')).thenReturn((mock_success, mock_cli_v2))
         when(cli).invoke(contains('aws sts get-caller-identity')).thenReturn((mock_success, 'does-not-matter'))
         when(cli).invoke(contains('aws sso get-role-credentials')).thenReturn((mock_success, json.dumps(mock_output)))