Skip to content

Commit

Permalink
feat: add 3.9 support and drop 3.5 (#167)
Browse files Browse the repository at this point in the history
- Drop 3.5 which is now EOL. https://www.python.org/downloads/release/python-3510/
- Add 3.9 tests and make them required. (Skipping 3.9 C++ tests as wheels are not yet published)
- Add a constraints file and use it to test lower bounds in the setup.py in one unit test session (3.6)
  • Loading branch information
busunkim96 authored Dec 4, 2020
1 parent 5c14cba commit 6d17195
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 31 deletions.
67 changes: 42 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ workflows:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+.*/
- unit-3.5:
filters:
tags:
only: /.*/
- unit-cpp-3.5:
filters:
tags:
only: /.*/
- unit-3.6:
filters:
tags:
Expand All @@ -48,30 +40,38 @@ workflows:
filters:
tags:
only: /.*/
- unit-3.9:
filters:
tags:
only: /.*/
# - unit-cpp-3.9:
# filters:
# tags:
# only: /.*/
- docs:
filters:
tags:
only: /.*/
- publish:
requires:
- unit-3.5
- unit-cpp-3.5
- unit-3.6
- unit-cpp-3.6
- unit-3.7
- unit-cpp-3.7
- unit-3.8
- unit-cpp-3.8
- unit-3.9
# - unit-cpp-3.9
- docs
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+((a|b|rc)\d+)?$/
jobs:
unit-3.5:
unit-3.6:
docker:
- image: python:3.5
- image: python:3.6
steps:
- checkout
- run:
Expand All @@ -81,14 +81,14 @@ jobs:
pip install codecov
- run:
name: Run unit tests.
command: nox -s unit-3.5
command: nox -s unit-3.6
- run:
name: Submit coverage data to codecov.
command: codecov
when: always
unit-3.6:
unit-3.7:
docker:
- image: python:3.6
- image: python:3.7
steps:
- checkout
- run:
Expand All @@ -98,14 +98,14 @@ jobs:
pip install codecov
- run:
name: Run unit tests.
command: nox -s unit-3.6
command: nox -s unit-3.7
- run:
name: Submit coverage data to codecov.
command: codecov
when: always
unit-3.7:
unit-3.8:
docker:
- image: python:3.7
- image: python:3.8
steps:
- checkout
- run:
Expand All @@ -115,14 +115,14 @@ jobs:
pip install codecov
- run:
name: Run unit tests.
command: nox -s unit-3.7
command: nox -s unit-3.8
- run:
name: Submit coverage data to codecov.
command: codecov
when: always
unit-3.8:
unit-3.9:
docker:
- image: python:3.8
- image: python:3.9
steps:
- checkout
- run:
Expand All @@ -132,14 +132,14 @@ jobs:
pip install codecov
- run:
name: Run unit tests.
command: nox -s unit-3.8
command: nox -s unit-3.9
- run:
name: Submit coverage data to codecov.
command: codecov
when: always
unit-cpp-3.5:
unit-3.10:
docker:
- image: python:3.5
- image: python:3.10-rc
steps:
- checkout
- run:
Expand All @@ -149,7 +149,7 @@ jobs:
pip install codecov
- run:
name: Run unit tests.
command: nox -s unitcpp-3.5
command: nox -s unit-3.10
- run:
name: Submit coverage data to codecov.
command: codecov
Expand Down Expand Up @@ -205,6 +205,23 @@ jobs:
name: Submit coverage data to codecov.
command: codecov
when: always
# unit-cpp-3.9:
# docker:
# - image: python:3.9
# steps:
# - checkout
# - run:
# name: Install nox and codecov.
# command: |
# pip install nox
# pip install codecov
# - run:
# name: Run unit tests.
# command: nox -s unitcpp-3.9
# - run:
# name: Submit coverage data to codecov.
# command: codecov
# when: always
docs:
docker:
- image: python:3.6
Expand Down
3 changes: 1 addition & 2 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ branchProtectionRules:
requiredStatusCheckContexts:
- 'ci/circleci: docs'
- 'ci/circleci: style-check'
- 'ci/circleci: unit-3.5'
- 'ci/circleci: unit-3.6'
- 'ci/circleci: unit-3.7'
- 'ci/circleci: unit-3.8'
- 'ci/circleci: unit-cpp-3.5'
- 'ci/circleci: unit-3.9'
- 'ci/circleci: unit-cpp-3.6'
- 'ci/circleci: unit-cpp-3.7'
- 'ci/circleci: unit-cpp-3.8'
Expand Down
17 changes: 14 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,25 @@

from __future__ import absolute_import
import os
import pathlib

import nox


@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()


@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
def unit(session, proto="python"):
"""Run the unit test suite."""

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)

session.env["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = proto
session.install("coverage", "pytest", "pytest-cov", "pytz")
session.install("-e", ".[testing]")
session.install("-e", ".[testing]", "-c", constraints_path)

session.run(
"py.test",
Expand All @@ -43,7 +51,10 @@ def unit(session, proto="python"):
)


@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
# Check if protobuf has released wheels for new python versions
# https://pypi.org/project/protobuf/#files
# This list will generally be shorter than 'unit'
@nox.session(python=["3.6", "3.7", "3.8"])
def unitcpp(session):
return unit(session, proto="cpp")

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@
include_package_data=True,
install_requires=("protobuf >= 3.12.0",),
extras_require={"testing": ["google-api-core[grpc] >= 1.22.2",],},
python_requires=">=3.6",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development :: Libraries :: Python Modules",
],
Expand Down
Empty file added testing/constraints-3.10.txt
Empty file.
Empty file added testing/constraints-3.11.txt
Empty file.
9 changes: 9 additions & 0 deletions testing/constraints-3.6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This constraints file is used to check that lower bounds
# are correct in setup.py
# List *all* library dependencies and extras in this file.
# Pin the version to the lower bound.
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
protobuf==3.12.0
google-api-core==1.22.2
Empty file added testing/constraints-3.7.txt
Empty file.
Empty file added testing/constraints-3.8.txt
Empty file.
Empty file added testing/constraints-3.9.txt
Empty file.

0 comments on commit 6d17195

Please sign in to comment.