Repository: dynatrace-oss/dt-cli (language: python)

Issue:
Bump `cryptography` version and remove pinned restriction
**Describe the bug**
Currently we are restricted to <= 39

**Additional context**
Encountered during latest builds of Python based extensions built using `dt-extensions-sdk[cli]` package.



Discussion / hints:

Fix patch:
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 6ac673d..7673259 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -7,14 +7,6 @@ tag_name = v{new_version}
 commit = True
 tag = True
 
-[bumpversion:part:release]
-optional_value = ga
-values = 
-	alpha
-	beta
-	rc
-	ga
-
 [bumpversion:file:pyproject.toml]
 
 [bumpversion:file:dtcli/version.py]
diff --git a/.dockerignore b/.dockerignore
deleted file mode 100644
index 208dd72..0000000
--- a/.dockerignore
+++ /dev/null
@@ -1,173 +0,0 @@
-# IDE
-.vscode/
-
-# Integration tests
-extension/
-*.zip
-*.sig
-*.key
-*.crt
-
-# Downloaded files
-alerts/
-schemas/
-
-# Secrets
-secrets/
-
-# Git
-.gitconfig
-
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
-*$py.class
-
-# C extensions
-*.so
-
-# Distribution / packaging
-.Python
-build/
-develop-eggs/
-dist/
-downloads/
-eggs/
-.eggs/
-lib/
-lib64/
-parts/
-sdist/
-var/
-wheels/
-share/python-wheels/
-*.egg-info/
-.installed.cfg
-*.egg
-MANIFEST
-
-# PyInstaller
-#  Usually these files are written by a python script from a template
-#  before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
-
-# Installer logs
-pip-log.txt
-pip-delete-this-directory.txt
-
-# Unit test / coverage reports
-htmlcov/
-.tox/
-.nox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*.cover
-*.py,cover
-.hypothesis/
-.pytest_cache/
-cover/
-
-# Translations
-*.mo
-*.pot
-
-# Django stuff:
-*.log
-local_settings.py
-db.sqlite3
-db.sqlite3-journal
-
-# Flask stuff:
-instance/
-.webassets-cache
-
-# Scrapy stuff:
-.scrapy
-
-# Sphinx documentation
-docs/_build/
-
-# PyBuilder
-.pybuilder/
-target/
-
-# Jupyter Notebook
-.ipynb_checkpoints
-
-# IPython
-profile_default/
-ipython_config.py
-
-# pyenv
-#   For a library or package, you might want to ignore these files since the code is
-#   intended to run in multiple environments; otherwise, check them in:
-.python-version
-
-# pipenv
-#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
-#   However, in case of collaboration, if having platform-specific dependencies or dependencies
-#   having no cross-platform support, pipenv may install dependencies that don't work, or not
-#   install all needed dependencies.
-#Pipfile.lock
-
-# poetry
-#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
-#   This is especially recommended for binary packages to ensure reproducibility, and is more
-#   commonly ignored for libraries.
-#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
-poetry.lock
-
-# pdm
-#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
-#pdm.lock
-#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
-#   in version control.
-#   https://pdm.fming.dev/#use-with-ide
-.pdm.toml
-
-# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
-__pypackages__/
-
-# Celery stuff
-celerybeat-schedule
-celerybeat.pid
-
-# SageMath parsed files
-*.sage.py
-
-# Environments
-.env
-.venv
-env/
-venv/
-ENV/
-env.bak/
-venv.bak/
-
-# Spyder project settings
-.spyderproject
-.spyproject
-
-# Rope project settings
-.ropeproject
-
-# mkdocs documentation
-/site
-
-# mypy
-.mypy_cache/
-.dmypy.json
-dmypy.json
-
-# Pyre type checker
-.pyre/
-
-# pytype static type analyzer
-.pytype/
-
-# Cython debug symbols
-cython_debug/
diff --git a/.envrc b/.envrc
deleted file mode 100644
index 796d9f2..0000000
--- a/.envrc
+++ /dev/null
@@ -1,2 +0,0 @@
-use_nix
-PATH_add .
diff --git a/.readthedocs.yml b/.readthedocs.yml
deleted file mode 100644
index ed109ee..0000000
--- a/.readthedocs.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-# .readthedocs.yml
-# Read the Docs configuration file
-# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
-
-version: 2
-
-sphinx:
-  configuration: docs/conf.py
-
-python:
-  version: 3.9
-  install:
-    - requirements: docs/requirements.txt
-    - method: pip
-      path: .
-      extra_requirements:
-        - console
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index ba8a2ce..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,72 +0,0 @@
-FROM python:3.10-slim
-
-RUN set -ex; \
-	apt-get update; \
-	apt-get install -y --no-install-recommends \
-		autoconf \
-		automake \
-		bzip2 \
-		dpkg-dev \
-		file \
-		g++ \
-		gcc \
-		imagemagick \
-		libbz2-dev \
-		libc6-dev \
-		libcurl4-openssl-dev \
-		libdb-dev \
-		libevent-dev \
-		libffi-dev \
-		libgdbm-dev \
-		libglib2.0-dev \
-		libgmp-dev \
-		libjpeg-dev \
-		libkrb5-dev \
-		liblzma-dev \
-		libmagickcore-dev \
-		libmagickwand-dev \
-		libmaxminddb-dev \
-		libncurses5-dev \
-		libncursesw5-dev \
-		libpng-dev \
-		libpq-dev \
-		libreadline-dev \
-		libsqlite3-dev \
-		libssl-dev \
-		libtool \
-		libwebp-dev \
-		libxml2-dev \
-		libxslt-dev \
-		libyaml-dev \
-		make \
-		patch \
-		unzip \
-		xz-utils \
-		zlib1g-dev \
-        binutils \
-        patchelf \
-		\
-# https://lists.debian.org/debian-devel-announce/2016/09/msg00000.html
-		$( \
-# if we use just "apt-cache show" here, it returns zero because "Can't select versions from package 'libmysqlclient-dev' as it is purely virtual", hence the pipe to grep
-			if apt-cache show 'default-libmysqlclient-dev' 2>/dev/null | grep -q '^Version:'; then \
-				echo 'default-libmysqlclient-dev'; \
-			else \
-				echo 'libmysqlclient-dev'; \
-			fi \
-		) \
-	; \
-	rm -rf /var/lib/apt/lists/*
-
-# Install package build system
-RUN pip install poetry
-
-# Project directory must be mounted in /app
-WORKDIR /app
-
-COPY ./pyproject.toml ./pyproject.toml
-RUN poetry config virtualenvs.create false && poetry install --no-root
-
-COPY . .
-
-CMD [ "tail", "-f", "/dev/null" ]
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 3ec193c..0000000
--- a/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-setup: .venv ## prepare the environment
-
-lint: setup
-	poetry run flake8 dtcli
-	# TODO: reenable those pesky warnings in .flake8
-	# TODO: bump CI for entire source code
-
-.venv: poetry.lock
-	python -m venv .venv
-	poetry install
-	touch .venv
-
-type-check: setup
-	#poetry run mypy --strict dtcli/scripts/dt.py
-	# TODO: enable all errors
-	! poetry run mypy --strict dtcli | grep 'Module has no attribute'
-	#poetry run mypy --strict dtcli
-	# TODO: enable all error all files
-	# TODO: bump CI
-	# TODO: fix colors!
-
-test: setup
-	poetry run pytest -x
-
-ble: setup
-	poetry run pyinstaller \
-		dtcli/__main__.py \
-		--name dt \
-		--clean \
-		-p "$(poetry env info -p)/lib/python3.9/site-packages" \
-		--onefile
-
-ci: lint type-check test
-
-bump-version: setup ## bumps version (sepecified into VERSION)
-	poetry run bump2version --no-tag --no-commit --new-version $(VERSION) whatever
-
-.PHONY: help init
-init: ## one time setup
-	direnv allow .
-
-help: ## print this message
-	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
-.DEFAULT_GOAL := help
diff --git a/default.nix b/default.nix
deleted file mode 100644
index 20295d5..0000000
--- a/default.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-let
-  nixpkgs = builtins.fetchGit {
-    url = "https://github.com/nixos/nixpkgs/";
-    ref = "refs/heads/nixos-unstable";
-    rev = "f677051b8dc0b5e2a9348941c99eea8c4b0ff28f"; # 21-09-2022
-    # obtain via `git ls-remote https://github.com/nixos/nixpkgs nixos-unstable`
-  };
-  pkgs = import nixpkgs { config = {}; };
-  pythonCore = pkgs.python39;
-  myPython = pythonCore.withPackages pythonPkgs;
-  pythonPkgs = python-packages: with python-packages; [
-      poetry
-      python-lsp-server
-    ];
-  env = pkgs.buildEnv {
-    name = "dtcli-dev-env";
-    paths =
-    with pkgs;
-    [
-      git
-      gnumake
-      myPython
-      entr
-      rnix-lsp
-    ];
-  };
-in
-{
-  shell = pkgs.mkShell {
-    buildInputs = [ env ];
-  };
-}
diff --git a/dt b/dt
deleted file mode 100755
index 30a1810..0000000
--- a/dt
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env bash
-make setup
-poetry run dt "$@"
diff --git a/pyproject.toml b/pyproject.toml
index c1f7286..0ea126f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,11 +1,11 @@
 [tool.poetry]
-authors = ["Wiktor Bachnik <wiktor.bachnik@dynatrace.com>", "Vagiz Duseev <vagiz.duseev@dynatrace.com>"]
+authors = ["Vagiz Duseev <vagiz.duseev@dynatrace.com>"]
 description = "Dynatrace CLI"
 documentation = "https://dt-cli.readthedocs.io"
 homepage = "https://github.com/dynatrace-oss/dt-cli"
 keywords = ["dynatrace", "cli", "extensions"]
 license = "Apache-2.0"
-maintainers = ["Wiktor Bachnik <wiktor.bachnik@dynatrace.com>", "Vagiz Duseev <vagiz.duseev@dynatrace.com>"]
+maintainers = ["Vagiz Duseev <vagiz.duseev@dynatrace.com>"]
 name = "dt-cli"
 packages = [
   {include = "dtcli"},
@@ -14,21 +14,20 @@ readme = "README.md"
 repository = "https://github.com/dynatrace-oss/dt-cli"
 version = "1.6.13"
 
-
 [tool.poetry.dependencies]
 PyYAML = "^6.0"
 asn1crypto = "^1.4"
 click-aliases = "^1.0"
-cryptography = ">=3.4,<40"
+cryptography = ">3"
 python = "^3.8"
-wheel = "^0.37.1"
+wheel = "^0.37"
 requests = "^2.26"
-jsonschema = "^4.7.2"
-typer = "^0.6.1"
+jsonschema = "^4.7"
+typer = "^0.6"
 
 [tool.poetry.group.dev.dependencies]
 Sphinx = ">=3.5"
-black = {version = ">=20.8b1", allow-prereleases = true}
+black = {version = ">=20", allow-prereleases = true}
 bump2version = ">=1.0"
 flake8 = ">=3.9"
 flake8-blind-except = ">=0.2"


Test patch:
diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml
index 18ceb7a..001beb9 100644
--- a/.github/workflows/build-test-release.yml
+++ b/.github/workflows/build-test-release.yml
@@ -12,102 +12,53 @@ on:
   workflow_dispatch:
 
 jobs:
-  # This docker image is essential for all other steps
-  build-dev-docker-image:
-    name: Build development docker image
-    runs-on: ubuntu-latest
-    # should be <1 in most cases, but full no-cache rebuilt
-    # can take a little bit more than 2
-    timeout-minutes: 4
-    steps:
-      - uses: actions/checkout@v2
-
-      - name: Acquire cache
-        run: |
-          echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
-          docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:latest
-
-      - name: Ensure cachability
-        run: |
-          # otherwise the first layer changes and invalidates the cache
-          # even though the dependencies have not changed at all
-          sed -i 's/^version = ".*"$/version = "0.0.1"/' pyproject.toml 
-
-      - name: Build docker image
-        run: |
-          docker build \
-            --tag docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-            --cache-from docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:latest \
-            .
-
-      - name: Deploy
-        run: |
-          docker push docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6}
-
-  deploy-image-for-cache:
-    name: Deploy :latest env container
-    if: ${{ github.ref == 'refs/heads/main' }}
-    needs: build-dev-docker-image
-    runs-on: ubuntu-latest
-    timeout-minutes: 2
-    steps:
-      - name: Acquire docker environment image
-        run: |
-          echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
-          docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6}
-
-      - name: Deploy image with latest tag
-        run: |
-          docker tag docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:latest
-          docker push docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:latest
-
   check-line-endings:
     name: Check CRLF line endings
     runs-on: ubuntu-latest
     timeout-minutes: 2
-    needs: build-dev-docker-image
     steps:
       - name: Checkout repository contents
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
 
       - name: Use action to check for CRLF endings
         uses: erclu/check-crlf@v1
     
   run-tests:
-    name: Verify code
+    name: Run tests
     runs-on: ubuntu-latest
-    timeout-minutes: 2
-    needs: build-dev-docker-image
+    timeout-minutes: 5
+    needs: check-line-endings
     steps:
-      - name: Acquire docker environment image
+      - name: Checkout repository contents
+        uses: actions/checkout@v4
+
+      - name: Set up Python 3.10
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.10'
+
+      - name: Install poetry
         run: |
-          echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
-          docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6}
+          pip install poetry
+          poetry install
 
       - name: Run pytest tests
         run: |
-          docker run \
-            docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-            poetry run pytest
+          poetry run pytest
 
-      - name: Run mypy tests
-        run: |
-          docker run \
-            docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-            bash -c '! poetry run mypy --strict dtcli | grep "Module has no attribute"'
+      # Disabled by vduseev on 2024-02-21
+      # because it's clear we are not using mypy here
+      #- name: Run mypy tests
+      #  run: |
+      #    bash -c '! poetry run mypy --strict dtcli | grep "Module has no attribute"'
 
       - name: Run flake8 lint checker
         run: |
-          docker run \
-            docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-            poetry run flake8 dtcli
-            # TODO: change above to make
+          poetry run flake8 dtcli
 
       - name: Run test coverage report
         run: |
-          docker run \
-            docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-            poetry run pytest --cov . --cov-report html || true
+          poetry run pytest --cov . --cov-report html || true
 
   build-package:
     name: Build package
@@ -115,92 +66,33 @@ jobs:
     # Builds python package using poetry.
     #
     runs-on: ubuntu-latest
-    timeout-minutes: 2
-    needs: build-dev-docker-image
+    timeout-minutes: 5
+    needs: run-tests
     steps:
-      - uses: actions/checkout@v2
+      - name: Checkout repository contents
+        uses: actions/checkout@v4
 
-      - name: Acquire docker environment image
+      - name: Set up Python 3.10
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.10'
+
+      - name: Install poetry
         run: |
-          echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
-          docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6}
+          pip install poetry
+          poetry install
 
       - name: Build package
         run: |
-          mkdir -p dist
-          docker run \
-            -v "$(pwd)/dist:/app/dist" \
-            -v "$(pwd):/src" \
-            docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-            bash -c 'cp -f /src/pyproject.toml /app/pyproject.toml && poetry build'
+          poetry build
 
       - name: Cache built package artifacts
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v4
         with:
           name: package
           path: |
             dist/*
 
-  # Disabled 2023-07-18
-  # vduseev:
-  #   Couldn't make pyinstaller work with the other packages.
-  #   Had to install at least 4.6 and limit Python to <3.13 but even that
-  #   didn't help and the built binary produces:
-  #     FileNotFoundError: [Errno 2] No such file or directory:
-  #     '/tmp/_MEI1dmuMP/jsonschema_specifications/schemas'
-  #     [504] Failed to execute script '__main__' due to unhandled exception!
-  # build-linux-binary:
-  #   name: Build linux binary
-  #   runs-on: ubuntu-latest
-  #   timeout-minutes: 1
-  #   needs: build-dev-docker-image
-  #   steps:
-  #     - name: Acquire docker environment image
-  #       run: |
-  #         echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
-  #         docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6}
-
-  #     - name: Build binary distribution
-  #       run: |
-  #         mkdir -p dist
-  #         docker run \
-  #           -v $(pwd)/dist:/app/dist \
-  #           docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-  #           poetry run pyinstaller \
-  #               dtcli/__main__.py \
-  #               --name dt \
-  #               --clean \
-  #               -p "$(poetry env info -p)/lib/python3.10/site-packages" \
-  #               --onefile
-
-  #     - name: Actually run it
-  #       run: |
-  #         ./dist/dt
-
-  #     - name: Make the binary static
-  #       run: |
-  #         docker run \
-  #           -v $(pwd)/dist:/app/dist \
-  #           docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-  #           poetry run staticx --strip dist/dt dist/dt-static
-
-  #         docker run \
-  #           -v $(pwd)/dist:/app/dist \
-  #           docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-  #           chown $(id -u):$(id -g) dist/dt-static
-
-  #     - name: Sanity
-  #       run: |
-  #         ./dist/dt-static
-  #         mv dist/dt-static dist/dt
-
-  #     - name: Cache built linux binary artifact
-  #       uses: actions/upload-artifact@v2
-  #       with:
-  #         name: linux-binary
-  #         path: |
-  #           dist/dt
-
   github-release:
     name: Create GitHub release
     #
@@ -212,32 +104,33 @@ jobs:
     runs-on: ubuntu-latest
     needs:
       - build-package
-      - run-tests
     steps:
       - uses: actions/checkout@v2
 
-      - name: Download cached build artifacts
-        uses: actions/download-artifact@v2
-        with:
-          path: artifacts
-
       - name: Generate changelog
         run: |
           cat > CHANGELOG.md <<EOT
-          ## CHANGELOG
+          # CHANGELOG
 
           **Release**: dt-cli (${GITHUB_REF#refs/tags/})
 
-          ### Changes
+          # Changes
 
           EOT
-          git log --format=format:"%s" >> CHANGELOG.md
+          
+          git log --format=format:"%ad: %s" --date=short >> CHANGELOG.md
+
+      - name: Download cached built package
+        uses: actions/download-artifact@v4
+        with:
+          name: package
+          path: dist
 
       - name: Create GitHub release
         uses: softprops/action-gh-release@v1
         with:
           files: |
-            artifacts/package/*
+            dist/*
             LICENSE
           body_path: CHANGELOG.md
         env:
@@ -251,24 +144,26 @@ jobs:
       - build-package
       - run-tests
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v4
 
-      - name: Acquire docker environment image
+      - name: Set up Python 3.10
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.10'
+
+      - name: Install poetry
         run: |
-          echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
-          docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6}
+          pip install poetry
+          poetry install
 
       - name: Download cached built package
-        uses: actions/download-artifact@v2
+        uses: actions/download-artifact@v4
         with:
-          path: artifacts
+          name: package
+          path: dist
 
       - name: Publish to PyPI
         env:
-          PYPI_TOKEN: "${{ secrets.PYPI_TOKEN }}"
+          PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
         run: |
-          docker run \
-            -v "$(pwd)/artifacts/package:/app/dist" \
-            -v "$(pwd):/src" \
-            docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
-            bash -c "cp -f /src/pyproject.toml /app/pyproject.toml && poetry publish --username __token__ --password $PYPI_TOKEN"
+          poetry publish --username __token__ --password $PYPI_TOKEN