From 4c9471d08a39191ce15cbf401eede76c80b48ea1 Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Wed, 5 Apr 2023 17:17:51 -0400 Subject: [PATCH 1/5] Allow PyYAML 6.x ops>=2.1.0 depends on PyYAML-6.x[0], allowing the installation of that version in layer-basic and the charm using layer-basic can lockdown on a more specific version of PyYAML. It's important to keep reactive charms compatible with the ops framework, because there are compatibility layers to allow the use of interfaces in ops framework based charms[1] [0] https://github.com/canonical/operator/commit/9162c873592499f512b2ea3908cf9578c0fcc4b8 [1] https://github.com/openstack/charm-interface-hacluster/commit/34b12aa480bc7d6d44699461fa21cb358c5089b4 --- wheelhouse.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wheelhouse.txt b/wheelhouse.txt index 2437af5..6837552 100644 --- a/wheelhouse.txt +++ b/wheelhouse.txt @@ -11,7 +11,8 @@ Jinja2==2.11;python_version == '2.7' or python_version == '3.5' # py27, py35 Jinja2;python_version >= '3.6' # py36 and on PyYAML==5.2;python_version >= '3.0' and python_version <= '3.4' # py3 trusty -PyYAML<5.4;python_version == '2.7' or python_version >= '3.5' # all else +PyYAML<5.4;python_version == '2.7' or python_version <= '3.6' # xenial and bionic +PyYAML<7.0.0;python_version >= '3.7' # >= focal MarkupSafe<2.0.0;python_version < '3.6' MarkupSafe<2.1.0;python_version == '3.6' # Just for python 3.6 From 6266caceddd33ffbd9fcf7bb1b3387e72dfbec23 Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Thu, 6 Apr 2023 07:59:50 -0400 Subject: [PATCH 2/5] Fix CI Python 3.6 is not available on github's ubuntu-latest image, the last image with python 3.6 was ubuntu-20.04, so switch to that version to run the linting with older versions of python on ubuntu-20.04 --- .github/workflows/main.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f06c477..20dc0f3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,25 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [3.5, 3.6, 3.7, 3.8, 3.9] + python: [3.8, 3.9, "3.10"] + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install Dependencies + run: | + pip install tox + - name: Run lint + run: tox -e flake8 + lint-old-python: + name: Lint on older Python versions + runs-on: ubuntu-20.04 + strategy: + matrix: + python: [3.5, 3.6, 3.7] steps: - name: Check out code uses: actions/checkout@v2 From 9ac2329d987d90288051545fe1674f2fcc4211e1 Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Thu, 6 Apr 2023 08:03:04 -0400 Subject: [PATCH 3/5] Fix tox.ini [flake8].ignore Error: ValueError: Error code '#' supplied to 'ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$' --- tox.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index b6c5b72..e839864 100644 --- a/tox.ini +++ b/tox.ini @@ -32,6 +32,8 @@ commands = [flake8] +# E741: ambiguous variable name +# W504: # line break after binary operator (have to ignore either this or W503) ignore = - E741, # ambiguous variable name - W504 # line break after binary operator (have to ignore either this or W503) + E741, + W504 From dfd44170ebf7b8312dcae50f44f51c93305599f4 Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Thu, 6 Apr 2023 08:12:33 -0400 Subject: [PATCH 4/5] Tox 4 compatibility fixes Replace whitelist_externals with allowlist_externals and use the full path to the commands. --- tox.ini | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index e839864..b4057ae 100644 --- a/tox.ini +++ b/tox.ini @@ -4,10 +4,11 @@ envlist = flake8, py3 skip_missing_interpreters = True [testenv] -commands = /bin/bash -c 'py.test -v' - +allowlist_externals = + /bin/bash deps = -r{toxinidir}/requirements.txt +commands = /bin/bash -c 'py.test -v' [testenv:flake8] commands = flake8 reactive lib tests unit_tests @@ -15,9 +16,17 @@ commands = flake8 reactive lib tests unit_tests [testenv:func] basepython = python3 deps = -r{toxinidir}/test-requirements.txt -whitelist_externals = ln mkdir readlink rm juju -setenv = CHARM_LAYERS_DIR=/tmp/charm-builds/_tmp/layers -passenv = HOME +allowlist_externals = + /bin/bash + /bin/ln + /bin/mkdir + /bin/readlink + /bin/rm + /snap/bin/juju +setenv = + CHARM_LAYERS_DIR=/tmp/charm-builds/_tmp/layers +passenv = + HOME commands = /bin/rm -rf /tmp/charm-builds/_tmp /tmp/charm-builds/minimal /bin/rm -rf /tmp/charm-builds/_tmp /tmp/charm-builds/minimal-binary-wheels From 472b5e9554d42547810c70917a728edbb856604e Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Thu, 6 Apr 2023 09:10:56 -0400 Subject: [PATCH 5/5] Add Cython to wheelhouse.txt --- wheelhouse.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wheelhouse.txt b/wheelhouse.txt index 6837552..2a8335e 100644 --- a/wheelhouse.txt +++ b/wheelhouse.txt @@ -10,6 +10,10 @@ Jinja2==2.10;python_version >= '3.0' and python_version <= '3.4' # py3 trusty Jinja2==2.11;python_version == '2.7' or python_version == '3.5' # py27, py35 Jinja2;python_version >= '3.6' # py36 and on +# Cython is required to build PyYAML. To find out the supported versions check +# https://github.com/cython/cython/issues/2800 +Cython + PyYAML==5.2;python_version >= '3.0' and python_version <= '3.4' # py3 trusty PyYAML<5.4;python_version == '2.7' or python_version <= '3.6' # xenial and bionic PyYAML<7.0.0;python_version >= '3.7' # >= focal