From fa1c8fcc7719e789d9290a97cadacb7b45c6d8ad Mon Sep 17 00:00:00 2001 From: Maciej Lech Date: Mon, 11 Oct 2021 16:02:32 +0200 Subject: [PATCH] Add support for Python 3.10 --- .github/workflows/cd.yml | 4 ++-- .github/workflows/ci.yml | 16 ++++++++-------- CHANGELOG.md | 1 + CONTRIBUTING.md | 14 +++++++------- noxfile.py | 15 ++++++++++----- requirements-doc.txt | 7 +++++++ requirements.txt | 1 + setup.cfg | 2 ++ setup.py | 29 +++++++++++++---------------- 9 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 requirements-doc.txt diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 014be5ed1..569ab33bb 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -7,7 +7,7 @@ on: env: ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PYTHON_DEFAULT_VERSION: 3.9 + PYTHON_DEFAULT_VERSION: "3.10" jobs: deploy: @@ -53,7 +53,7 @@ jobs: needs: deploy runs-on: ubuntu-latest container: - image: python:3.9 # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here + image: "python:3.10" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here env: DEBIAN_FRONTEND: noninteractive steps: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f29060707..7500f2cb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [master] env: - PYTHON_DEFAULT_VERSION: 3.9 + PYTHON_DEFAULT_VERSION: "3.10" jobs: lint: @@ -56,13 +56,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.5, 3.6, 3.7, 3.8, 3.9, pypy-3.7] + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-3.7"] exclude: - - os: macos-latest - python-version: pypy-3.7 - - os: windows-latest - python-version: pypy-3.7 + - os: "macos-latest" + python-version: "pypy-3.7" + - os: "windows-latest" + python-version: "pypy-3.7" steps: - uses: actions/checkout@v2 with: @@ -85,7 +85,7 @@ jobs: B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} runs-on: ubuntu-latest container: - image: python:3.9 # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here + image: "python:3.10" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here env: DEBIAN_FRONTEND: noninteractive steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 826012cf7..640d616ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Add `--allCapabilities` to `create-key` +* Add support for Python 3.10 ### Fixed * Fix testing bundle in CI for a new `staticx` version diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb5677710..a85750c68 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ With `nox`, you can run different sessions (default are `lint` and `test`): * `format` -> Format the code. * `lint` -> Run linters. -* `test` (`test-3.5`, `test-3.6`, `test-3.7`, `test-3.8`, `test-3.9`) -> Run test suite. +* `test` (`test-3.5`, `test-3.6`, `test-3.7`, `test-3.8`, `test-3.9`, `test-3.10`) -> Run test suite. * `cover` -> Perform coverage analysis. * `build` -> Build the distribution. * `deploy` -> Deploy the distribution to the PyPi. @@ -38,7 +38,7 @@ For example: $ nox -s format nox > Running session format - nox > Creating virtual environment (virtualenv) using python3.9 in .nox/format + nox > Creating virtual environment (virtualenv) using python3.10 in .nox/format ... $ nox -s format @@ -50,9 +50,9 @@ For example: nox > Running session format ... -Sessions `test` ,`unit`, and `integration` can run on many Python versions, 3.5-3.9 by default. +Sessions `test` ,`unit`, and `integration` can run on many Python versions, 3.5-3.10 by default. -Sessions other than than use the last given Python version, 3.9 by default. +Sessions other than than use the last given Python version, 3.10 by default. You can change it: @@ -76,17 +76,17 @@ To run all tests on every available Python version: To run all tests on a specific version: - nox -s test-3.9 + nox -s test-3.10 To run just unit tests: - nox -s unit-3.9 + nox -s unit-3.10 To run just integration tests: export B2_TEST_APPLICATION_KEY=your_app_key export B2_TEST_APPLICATION_KEY_ID=your_app_key_id - nox -s integration-3.9 + nox -s integration-3.10 ## Documentation diff --git a/noxfile.py b/noxfile.py index 8ff27076b..01e177aed 100644 --- a/noxfile.py +++ b/noxfile.py @@ -19,7 +19,7 @@ INSTALL_SDK_FROM = os.environ.get('INSTALL_SDK_FROM') NOX_PYTHONS = os.environ.get('NOX_PYTHONS') -PYTHON_VERSIONS = ['3.5', '3.6', '3.7', '3.8', '3.9' +PYTHON_VERSIONS = ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10' ] if NOX_PYTHONS is None else NOX_PYTHONS.split(',') PYTHON_DEFAULT_VERSION = PYTHON_VERSIONS[-1] @@ -28,13 +28,18 @@ SYSTEM = platform.system().lower() REQUIREMENTS_FORMAT = ['yapf==0.27'] -REQUIREMENTS_LINT = ['yapf==0.27', 'pyflakes==2.2.0', 'pytest==6.1.1', 'liccheck==0.4.7'] -REQUIREMENTS_TEST = ['pytest==6.1.1', 'pytest-cov==2.10.1'] +REQUIREMENTS_LINT = ['yapf==0.27', 'pyflakes==2.4.0', 'pytest==6.2.5', 'liccheck==0.6.2'] +REQUIREMENTS_TEST = [ + "pytest==6.2.5;python_version>'3.5'", + "pytest==6.1.1;python_version=='3.5'", + "pytest-cov==3.0.0;python_version>'3.5'", + "pytest-cov==2.10.1;python_version=='3.5'", +] REQUIREMENTS_BUILD = ['setuptools>=20.2'] REQUIREMENTS_BUNDLE = [ - 'pyinstaller==4.5.1', + 'pyinstaller==4.6.0', "patchelf-wrapper==1.2.0;platform_system=='Linux'", - "staticx==0.13.4;platform_system=='Linux'", + "staticx==0.13.5;platform_system=='Linux'", ] OSX_BUNDLE_IDENTIFIER = 'com.backblaze.b2' diff --git a/requirements-doc.txt b/requirements-doc.txt new file mode 100644 index 000000000..c23baebad --- /dev/null +++ b/requirements-doc.txt @@ -0,0 +1,7 @@ +sadisplay +sphinx<4.0; python_version <= '3.5' # sphinx>=4.0 doesn't support Python 3.5 +sphinx<5.0; python_version > '3.5' +sphinx-argparse +sphinx-autobuild +sphinx-rtd-theme +sphinxcontrib-plantuml diff --git a/requirements.txt b/requirements.txt index b4584499b..47e974efb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ arrow>=0.8.0,<1.0.0 b2sdk>=1.13.0,<2.0.0 docutils==0.16 +idna>=2.2.0; platform_system == 'Java' importlib-metadata>=2.1.1,<3.0.0; python_version <= '3.5' importlib-metadata>=3.3.0; python_version > '3.5' and python_version < '3.8' phx-class-registry==3.0.5 diff --git a/setup.cfg b/setup.cfg index 189359abe..b926bbea9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,11 +39,13 @@ authorized_licenses: apache software license lgpl gnu lgpl + gnu library or lesser general public license (lgpl) lgpl with exceptions or zpl isc license isc license (iscl) mit mit license + mozilla public license 2.0 (mpl 2.0) mpl-2.0 psf python software foundation diff --git a/setup.py b/setup.py index f9c1bbe33..962da8e46 100644 --- a/setup.py +++ b/setup.py @@ -37,14 +37,16 @@ with open('README.md', encoding='utf-8') as f: long_description = f.read() -with open('requirements.txt', encoding='utf-8') as f: - requirements = f.read().splitlines() -# Jython cannot handle extremely large blocks of code. -# requests 2.12.x that we rely on, relied on idna, which until 2.2.0 contained such block. -# https://github.com/kennethreitz/requests/issues/3711#issuecomment-268522266 -if platform.system().lower().startswith('java'): - requirements.append('idna>=2.2.0') +def read_requirements(extra=None): + if extra is not None: + file = 'requirements-{}.txt'.format(extra) + else: + file = 'requirements.txt' + + with open(file, encoding='utf-8') as f: + return f.read().splitlines() + setup( name='b2', @@ -85,6 +87,7 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', ], # What does your project relate to? @@ -103,19 +106,13 @@ # requirements files see: # https://packaging.python.org/en/latest/requirements.html dependency_links=[], - install_requires=requirements, + install_requires=read_requirements(), # List additional groups of dependencies here (e.g. development # dependencies). You can install these using the following syntax, # for example: # $ pip install -e .[dev,test] - extras_require={ - 'doc': - [ - 'sphinx', 'sphinx-autobuild', 'sphinx_rtd_theme', 'sphinx-argparse', - 'sphinxcontrib-plantuml', 'sadisplay' - ], - }, + extras_require={'doc': read_requirements('doc')}, setup_requires=['setuptools_scm<6.0'], # setuptools_scm>=6.0 doesn't support Python 3.5 use_scm_version=True, @@ -125,7 +122,7 @@ # Although 'package_data' is the preferred approach, in some case you may # need to place data files outside of your packages. See: - # http://docs.python.org/3.9/distutils/setupscript.html#installing-additional-files # noqa + # http://docs.python.org/3.10/distutils/setupscript.html#installing-additional-files # noqa # In this case, 'data_file' will be installed into '/my_data' data_files=[ #('my_data', ['data/data_file'])