Skip to content

Commit

Permalink
Rel231 (#184)
Browse files Browse the repository at this point in the history
* prepare for new rel, py3.10+, pypy+, ..
* try out new py on CI
* fixes for py3.11
* fix GH actions warning
* fix copyright header
  • Loading branch information
oberstet authored Jan 15, 2023
1 parent e00e3f0 commit 91dace6
Show file tree
Hide file tree
Showing 37 changed files with 207 additions and 193 deletions.
37 changes: 14 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# GitHub actions for txaio CI/CD
# https://github.com/crossbario/txaio/actions
#
# See also:
#
# * https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# * https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml
#
name: main

on:
Expand All @@ -18,14 +10,14 @@ on:

jobs:
check:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.8'
python-version: '3.11'
architecture: 'x64'

- name: Install Python package dependencies
Expand All @@ -37,28 +29,27 @@ jobs:
run: tox -c tox.ini -e flake8

test:
# Test on Ubuntu, MacOS, Windows using CPython 3.6-3.9, PyPy 3.6-3.7
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
# os: [ubuntu-20.04, macos-latest, windows-latest]

# https://github.com/actions/setup-python#specifying-a-pypy-version
python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy-3.6', 'pypy-3.7']
python-version: ['3.7', '3.11', 'pypy-3.7', 'pypy-3.9']

# https://github.blog/changelog/2020-04-15-github-actions-new-workflow-features/
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
continue-on-error: false

steps:
# Checkout sources
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Use this Python
# https://github.com/actions/setup-python/blob/main/README.md
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -76,14 +67,14 @@ jobs:
tox -c tox.ini
docs:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.8'
python-version: '3.11'
architecture: 'x64'

- name: Install Python package dependencies
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Crossbar.io Technologies GmbH
Copyright (c) typedef int GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ upload: clean
publish: clean
python setup.py sdist bdist_wheel
twine upload dist/*

fix_copyright:
find . -type f -exec sed -i 's/Copyright (c) typedef int GmbH/Copyright (c) typedef int GmbH/g' {} \;
7 changes: 7 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
txio releases
=============

23.1.1
------

- fix: support for Python up to v3.11
- fix: update GitHub CI
- fix: copyright transferred to typedef int GmbH - no license change!

22.2.1
------

Expand Down
2 changes: 1 addition & 1 deletion examples/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion examples/log_interop_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion examples/log_interop_twisted.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion examples/multiloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -76,11 +76,11 @@
description='Compatibility API between asyncio/Twisted/Trollius',
long_description=docstr,
license='MIT License',
author='Crossbar.io Technologies GmbH',
author='typedef int GmbH',
author_email='[email protected]',
url='https://github.com/crossbario/txaio',
platforms=('Any'),
python_requires='>=3.6',
python_requires='>=3.7',
extras_require={
'twisted': extras_require_twisted,
'asyncio': extras_require_asyncio,
Expand Down Expand Up @@ -111,10 +111,11 @@
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
Expand Down
83 changes: 42 additions & 41 deletions test/_asyncio_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,47 +34,48 @@
from asyncio.log import logger
from test import support


def data_file(filename):
if hasattr(support, 'TEST_HOME_DIR'):
fullname = os.path.join(support.TEST_HOME_DIR, filename)
if os.path.isfile(fullname):
return fullname
fullname = os.path.join(os.path.dirname(__file__), filename)
if os.path.isfile(fullname):
return fullname
raise FileNotFoundError(filename)


ONLYCERT = data_file('ssl_cert.pem')
ONLYKEY = data_file('ssl_key.pem')
SIGNED_CERTFILE = data_file('keycert3.pem')
SIGNING_CA = data_file('pycacert.pem')
PEERCERT = {
'OCSP': ('http://testca.pythontest.net/testca/ocsp/',),
'caIssuers': ('http://testca.pythontest.net/testca/pycacert.cer',),
'crlDistributionPoints': ('http://testca.pythontest.net/testca/revocation.crl',),
'issuer': ((('countryName', 'XY'),),
(('organizationName', 'Python Software Foundation CA'),),
(('commonName', 'our-ca-server'),)),
'notAfter': 'Jul 7 14:23:16 2028 GMT',
'notBefore': 'Aug 29 14:23:16 2018 GMT',
'serialNumber': 'CB2D80995A69525C',
'subject': ((('countryName', 'XY'),),
(('localityName', 'Castle Anthrax'),),
(('organizationName', 'Python Software Foundation'),),
(('commonName', 'localhost'),)),
'subjectAltName': (('DNS', 'localhost'),),
'version': 3
}


def simple_server_sslcontext():
server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
server_context.load_cert_chain(ONLYCERT, ONLYKEY)
server_context.check_hostname = False
server_context.verify_mode = ssl.CERT_NONE
return server_context
# FIXME: "test/_asyncio_test_utils.py:46: FileNotFoundError"

# def data_file(filename):
# if hasattr(support, 'TEST_HOME_DIR'):
# fullname = os.path.join(support.TEST_HOME_DIR, filename)
# if os.path.isfile(fullname):
# return fullname
# fullname = os.path.join(os.path.dirname(__file__), filename)
# if os.path.isfile(fullname):
# return fullname
# raise FileNotFoundError(filename)
#
#
# ONLYCERT = data_file('ssl_cert.pem')
# ONLYKEY = data_file('ssl_key.pem')
# SIGNED_CERTFILE = data_file('keycert3.pem')
# SIGNING_CA = data_file('pycacert.pem')
# PEERCERT = {
# 'OCSP': ('http://testca.pythontest.net/testca/ocsp/',),
# 'caIssuers': ('http://testca.pythontest.net/testca/pycacert.cer',),
# 'crlDistributionPoints': ('http://testca.pythontest.net/testca/revocation.crl',),
# 'issuer': ((('countryName', 'XY'),),
# (('organizationName', 'Python Software Foundation CA'),),
# (('commonName', 'our-ca-server'),)),
# 'notAfter': 'Jul 7 14:23:16 2028 GMT',
# 'notBefore': 'Aug 29 14:23:16 2018 GMT',
# 'serialNumber': 'CB2D80995A69525C',
# 'subject': ((('countryName', 'XY'),),
# (('localityName', 'Castle Anthrax'),),
# (('organizationName', 'Python Software Foundation'),),
# (('commonName', 'localhost'),)),
# 'subjectAltName': (('DNS', 'localhost'),),
# 'version': 3
# }
#
#
# def simple_server_sslcontext():
# server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
# server_context.load_cert_chain(ONLYCERT, ONLYKEY)
# server_context.check_hostname = False
# server_context.verify_mode = ssl.CERT_NONE
# return server_context


def simple_client_sslcontext(*, disable_verify=True):
Expand Down
60 changes: 31 additions & 29 deletions test/test_as_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -97,34 +97,36 @@ def test_as_future_coroutine(framework):
# twisted
if not txaio.using_asyncio:
return

errors = []
results = []
calls = []

from asyncio import coroutine

@coroutine
def method(*args, **kw):
calls.append((args, kw))
return 42
f = txaio.as_future(method, 1, 2, 3, key='word')

def cb(x):
results.append(x)

def errback(f):
errors.append(f)

txaio.add_callbacks(f, cb, errback)

run_once()
run_once()

assert len(results) == 1
assert len(errors) == 0
assert results[0] == 42
assert calls[0] == ((1, 2, 3), dict(key='word'))
try:
from asyncio import coroutine
except ImportError:
pytest.skip('skipping test: @asyncio.coroutine decorator is removed since Python 3.11')
else:
errors = []
results = []
calls = []

@coroutine
def method(*args, **kw):
calls.append((args, kw))
return 42
f = txaio.as_future(method, 1, 2, 3, key='word')

def cb(x):
results.append(x)

def errback(f):
errors.append(f)

txaio.add_callbacks(f, cb, errback)

run_once()
run_once()

assert len(results) == 1
assert len(errors) == 0
assert results[0] == 42
assert calls[0] == ((1, 2, 3), dict(key='word'))


def test_as_future_exception(framework):
Expand Down
2 changes: 1 addition & 1 deletion test/test_batched_timers_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion test/test_batched_timers_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 91dace6

Please sign in to comment.