Skip to content

Commit

Permalink
Merge pull request #756 from Backblaze/python-310
Browse files Browse the repository at this point in the history
Add support for Python 3.10
  • Loading branch information
mlech-reef authored Nov 2, 2021
2 parents 1261ec1 + fa1c8fc commit 4e2f5c7
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [master]

env:
PYTHON_DEFAULT_VERSION: 3.9
PYTHON_DEFAULT_VERSION: "3.10"

jobs:
lint:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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:

Expand All @@ -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

Expand Down
15 changes: 10 additions & 5 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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'
Expand Down
7 changes: 7 additions & 0 deletions requirements-doc.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 13 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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?
Expand All @@ -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,

Expand All @@ -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 '<sys.prefix>/my_data'
data_files=[
#('my_data', ['data/data_file'])
Expand Down

0 comments on commit 4e2f5c7

Please sign in to comment.