Skip to content

Commit

Permalink
Merge pull request #33 from google/three
Browse files Browse the repository at this point in the history
Update to version 3.
  • Loading branch information
brianquinlan authored Feb 23, 2022
2 parents 5757edc + b1d299c commit f00944c
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 44 deletions.
72 changes: 51 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,86 @@ version: 2
jobs:
Unit Test:
docker:
- image: circleci/python:3.7.1

- image: cimg/python:3.10.2
steps:
- checkout
- run:
command: |
sudo pip install virtualenv
sudo pip install nox
pip install virtualenv
pip install nox
nox -f noxfile.py -s unit
Compatibility Test:
Compatibility Test 3.10:
docker:
- image: circleci/python:3.7.1

- image: cimg/python:3.10.2
steps:
- checkout
- run:
command: |
sudo pip install virtualenv
sudo pip install nox
pip install virtualenv
pip install nox
nox -f noxfile.py -s compatibility
Compatibility Test 3.9:
docker:
- image: cimg/python:3.9.10
steps:
- checkout
- run:
command: |
pip install virtualenv
pip install nox
nox -f noxfile.py -s compatibility
Compatibility Test 3.8:
docker:
- image: cimg/python:3.8.12
steps:
- checkout
- run:
command: |
pip install virtualenv
pip install nox
nox -f noxfile.py -s compatibility
Compatibility Test 3.7:
docker:
- image: cimg/python:3.7.12
steps:
- checkout
- run:
command: |
pip install virtualenv
pip install nox
nox -f noxfile.py -s compatibility
Lint:
docker:
- image: circleci/python:3.7.1

- image: cimg/python:3.10.2
steps:
- checkout
- run:
command: |
sudo pip install virtualenv
sudo pip install nox
pip install virtualenv
pip install nox
nox -f noxfile.py -s lint
Type Check:
docker:
- image: circleci/python:3.7.1
- image: cimg/python:3.7.12

steps:
- checkout
- run:
command: |
sudo pip install virtualenv
sudo pip install nox
pip install virtualenv
pip install nox
nox -f noxfile.py -s type_check
Release:
docker:
- image: circleci/python:3.7.1
- image: cimg/python:3.10.2

steps:
- checkout
- run:
command: |
sudo pip install --upgrade twine
sudo pip install --upgrade wheel
sudo pip install --upgrade setuptools
pip install --upgrade twine
pip install --upgrade wheel
pip install --upgrade setuptools
source twine_upload.sh
Expand All @@ -65,7 +92,10 @@ workflows:
- Lint
- Unit Test
- Type Check
- Compatibility Test
- Compatibility Test 3.10
- Compatibility Test 3.9
- Compatibility Test 3.8
- Compatibility Test 3.7
release:
jobs:
- Release:
Expand Down
24 changes: 16 additions & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Nox config for running lint and unit tests."""

import nox
import sys


def _run_tests(session):
Expand All @@ -28,34 +29,41 @@ def lint(session):
serious code quality issues.
"""
session.install('yapf')
session.run('python3', '-m', 'yapf', '--diff', '-r', '.')
session.run('yapf', '--diff', '-r', '.')


@nox.session
def unit(session):
"""Run the unit test suite."""
session.install('-e', '.[dev]')
session.install('-r', 'server-example/requirements-test.txt')
session.install('flask')
_run_tests(session)


@nox.session(python=['3.4', '3.5', '3.6', '3.7', '3.8'])
@nox.session
@nox.parametrize(
'install',
['Jinja2==2.9.0', 'Pillow==5.0.0', 'requests==2.9.0', 'xmldiff==2.4'])
[
'Jinja2==3.0.0',
'Pillow==8.3.2', # Oldest version that supports Python 3.7 to 3.10.
'requests==2.22.0',
'xmldiff==2.4'
])
def compatibility(session, install):
"""Run the unit test suite with each support library and Python version."""

session.install('-e', '.[dev]')
session.install('-r', 'server-example/requirements-test.txt')
session.install(install)
session.install('-r', 'server-example/requirements-test.txt')
session.install('-e', '.[dev]')
_run_tests(session)


@nox.session(python=['3.6'])
@nox.session(python=['3.7'])
def type_check(session):
"""Run type checking using pytype."""
if sys.platform.startswith('win'):
session.skip('pytype not supported on Windows')
session.install('-e', '.[dev]')
session.install('pytype')
session.run('pytype', '--python-version=3.6', '--disable=pyi-error',
session.run('pytype', '--python-version=3.7', '--disable=pyi-error',
'pybadges')
7 changes: 3 additions & 4 deletions pybadges/precalculate_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ def calculate_character_to_length_mapping(
return char_to_length


def calculate_pair_to_kern_mapping(
measurer: text_measurer.TextMeasurer, char_to_length: Mapping[str,
float],
characters: Iterable[str]) -> Mapping[str, float]:
def calculate_pair_to_kern_mapping(measurer: text_measurer.TextMeasurer,
char_to_length: Mapping[str, float],
characters: str) -> Mapping[str, float]:
"""Returns a mapping between each *pair* of characters and their kerning.
Args:
Expand Down
2 changes: 1 addition & 1 deletion pybadges/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '2.3.0' # Also change in setup.py.
__version__ = '3.0.0' # Also change in setup.py.
2 changes: 1 addition & 1 deletion server-example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Flask>1.1
Flask>=2.0
pybadges
1 change: 0 additions & 1 deletion server-example/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"Tests for app"

import pytest
Expand Down
14 changes: 6 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def replace_relative_with_absolute(match):

setup(
name='pybadges',
version='2.3.0', # Also change in version.py.
version='3.0.0', # Also change in version.py.
author='Brian Quinlan',
author_email='[email protected]',
classifiers=[
Expand All @@ -49,10 +49,10 @@ def replace_relative_with_absolute(match):
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'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',
'Programming Language :: Python :: 3.10',
'Operating System :: OS Independent',
],
description='A library and command-line tool for generating Github-style ' +
Expand All @@ -66,11 +66,9 @@ def replace_relative_with_absolute(match):
long_description=get_long_description(),
long_description_content_type='text/markdown',
python_requires='>=3.4',
install_requires=[
'Jinja2>=2.9.0,<3', 'MarkupSafe<2.1.0', 'requests>=2.9.0,<3'
],
install_requires=['Jinja2>=3,<4', 'requests>=2.22.0,<3'],
extras_require={
'pil-measurement': ['Pillow>=5,<6'],
'pil-measurement': ['Pillow>=6,<10'],
'dev': [
'fonttools>=3.26', 'nox', 'Pillow>=5', 'pytest>=3.6', 'xmldiff>=2.4'
],
Expand Down

0 comments on commit f00944c

Please sign in to comment.