Skip to content

Commit

Permalink
bump version; update changelog (#150)
Browse files Browse the repository at this point in the history
* bump version; update changelog
* update CI scripts; update python version requirements
* add cpy3.8 to CI; fix twisted version
* bump pytest and coverage
* add tests for new helpers
  • Loading branch information
oberstet committed Jan 21, 2020
1 parent 6ae2da6 commit 735eb60
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 154 deletions.
121 changes: 31 additions & 90 deletions .travis.yml
Expand Up @@ -21,77 +21,13 @@ matrix:
include:
- env: TOX_ENV=flake8

- python: 2.7
env:
- TOX_ENV=py27-tw154

- python: 2.7
env:
- TOX_ENV=py27-tw187

- python: 2.7
env:
- TOX_ENV=py27-twtrunk

- python: 2.7
env:
- TOX_ENV=py27-asyncio


- python: pypy
env:
- TOX_ENV=pypy-tw154

- python: pypy
env:
- TOX_ENV=pypy-tw187

- python: pypy
env:
- TOX_ENV=pypy-twtrunk

- python: pypy
env:
- TOX_ENV=pypy-asyncio


- python: pypy3
env:
- TOX_ENV=pypy3-tw154

- python: pypy3
env:
- TOX_ENV=pypy3-tw187

- python: pypy3
env:
- TOX_ENV=pypy3-twtrunk

- python: pypy3
env:
- TOX_ENV=pypy3-asyncio


- python: 3.4
env:
- TOX_ENV=py34-tw154

- python: 3.4
env:
- TOX_ENV=py34-tw187

- python: 3.4
env:
- TOX_ENV=py34-asyncio


- python: 3.5
env:
- TOX_ENV=py35-tw154
- TOX_ENV=py35-tw187

- python: 3.5
env:
- TOX_ENV=py35-tw187
- TOX_ENV=py35-tw1910

- python: 3.5
env:
Expand All @@ -101,48 +37,53 @@ matrix:
env:
- TOX_ENV=py35-asyncio

- python: 3.7
env:
- TOX_ENV=py37-tw187

- python: 3.6
- python: 3.7
env:
- TOX_ENV=py36-tw154
- TOX_ENV=py37-tw1910

- python: 3.6
- python: 3.7
env:
- TOX_ENV=py36-tw187
- TOX_ENV=py37-twtrunk

- python: 3.6
- python: 3.7
env:
- TOX_ENV=py36-twtrunk
- TOX_ENV=py37-asyncio

- python: 3.6
- python: 3.8
env:
- TOX_ENV=py36-asyncio
- TOX_ENV=py38-tw187

- python: 3.8
env:
- TOX_ENV=py38-tw1910

- python: 3.7
dist: xenial
sudo: required
- python: 3.8
env:
- TOX_ENV=py37-tw154
- TOX_ENV=py38-twtrunk

- python: 3.7
dist: xenial
sudo: required
- python: 3.8
env:
- TOX_ENV=py37-tw187
- TOX_ENV=py38-asyncio

- python: 3.7
dist: xenial
sudo: required
- python: pypy3
env:
- TOX_ENV=py37-twtrunk
- TOX_ENV=pypy3-tw187

- python: 3.7
dist: xenial
sudo: required
- python: pypy3
env:
- TOX_ENV=py37-asyncio
- TOX_ENV=pypy3-tw1910

- python: pypy3
env:
- TOX_ENV=pypy3-twtrunk

- python: pypy3
env:
- TOX_ENV=pypy3-asyncio
# https://docs.travis-ci.com/user/build-stages/matrix-expansion/
- stage: deploy
python: "3.7"
Expand Down
15 changes: 4 additions & 11 deletions README.rst
Expand Up @@ -22,19 +22,12 @@ either one's event loop to the other using some event loop adapter.
Platform support
----------------

**txaio** runs on CPython 2.7/3.3+ and PyPy 2/3, on top of Twisted or asyncio. Specifically, **txaio** is tested on the following platforms:
**txaio** runs on CPython 3.5+ and PyPy 3, on top of *Twisted* or *asyncio*. Specifically, **txaio** is tested on the following platforms:

**Python 2:**
* CPython 3.5, 3.7 and 3.8 on Twisted 18.7, 19.10, trunk and on asyncio (stdlib)
* PyPy 3 on Twisted 18.7, 19.10, trunk and on asyncio (stdlib)

* CPython 2.7 on Twisted 12.1, 13.2, 15.4, 16.5, trunk and on Trollius 2.0
* PyPy 2 on Twisted 12.1, 13.2, 15.4, 16.5, trunk and on Trollius 2.0

**Python 3:**

* CPython 3.4 on Twisted 15.4, 16.5, trunk and on asyncio (stdlib)
* CPython 3.5 on Twisted 15.4, 16.5, trunk and on asyncio (stdlib)
* CPython 3.6 on Twisted 15.4, 16.5, trunk and on asyncio (stdlib)
* PyPy 3 on Twisted 15.4, 16.5, trunk and on asyncio (stdlib)
> Note: txaio up to version 18.8.1 also supported Python 2.7 and Python 3.4. Beginning with release v20.1.1, txaio only supports Python 3.5+.


How it works
Expand Down
7 changes: 4 additions & 3 deletions docs/releases.rst
@@ -1,15 +1,16 @@
txio releases
=============

master
20.1.1
------

- ...

- IMPORTANT: beginning release v20.1.1, we only support Python 3.5 or later
- new: moved ``time_ns`` and ``perf_counter_ns`` helper functions here

18.8.1
------

* IMPORTANT: release v18.8.1 is the last release supporting Python 2. We will support Python 3.5 and later beginning with release v20.1.1.
- add API to support cancellation; this means passing a 1-argument
callable to ``create_future`` and ``txaio.cancel`` to actually
cancel a future
Expand Down
24 changes: 4 additions & 20 deletions setup.py
Expand Up @@ -48,23 +48,9 @@
'twisted>=12.1.0', # MIT
]

# asyncio dependencies
# asyncio dependencies: Python 3.5+ has asyncio builtin
#
if PY3:
if PY33:
# "Tulip"
extras_require_asyncio = [
"asyncio>=3.4.3" # Apache 2.0
]
else:
# Python 3.4+ has asyncio builtin
extras_require_asyncio = []
else:
# backport of asyncio for Python 2
extras_require_asyncio = [
"trollius>=2.0", # Apache 2.0
"futures>=3.0.3" # BSD license
]
extras_require_asyncio = []

# development dependencies
#
Expand Down Expand Up @@ -97,6 +83,7 @@
author_email='autobahnws@googlegroups.com',
url='https://github.com/crossbario/txaio',
platforms=('Any'),
python_requires='>=3.5',
install_requires=[
'six'
],
Expand Down Expand Up @@ -129,14 +116,11 @@
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.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 :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
Expand Down
17 changes: 7 additions & 10 deletions txaio/util.py → test/test_util.py
Expand Up @@ -24,17 +24,14 @@
#
###############################################################################

import sys
import time
import txaio


def time_ns():
if sys.version_info >= (3, 7):
return time.time_ns()
return int(time.time() * 1000000000.)
def test_time_ns(framework):
now = txaio.time_ns()
assert now > 0


def perf_counter_ns():
if sys.version_info >= (3, 7):
return time.perf_counter_ns()
return int(time.perf_counter() * 1000000000.)
def test_perf_counter_ns(framework):
now = txaio.perf_counter_ns()
assert now > 0
27 changes: 8 additions & 19 deletions tox.ini
Expand Up @@ -3,35 +3,25 @@ envlist =
flake8

# CPython
py27-{tw154,tw165,tw187,twtrunk,asyncio}
py34-{tw154,tw165,tw187,asyncio}
py35-{tw154,tw165,tw187,twtrunk,asyncio}
py36-{tw154,tw165,tw187,twtrunk,asyncio}
py37-{tw154,tw165,tw187,twtrunk,asyncio}
py35-{tw187,tw1910,twtrunk,asyncio}
py37-{tw165,tw187,tw1910,twtrunk,asyncio}
py38-{tw165,tw187,tw1910,twtrunk,asyncio}

# PyPy
pypy-{tw154,tw165,tw187,twtrunk,asyncio}
pypy3-{tw154,tw165,tw187,twtrunk,asyncio}
pypy3-{tw187,tw1910,twtrunk,asyncio}

[testenv]
deps =
six
mock
pytest==4.4.0
coverage==4.0
pytest==4.6.9
coverage==4.5.4

; twisted dependencies
tw154: twisted==15.4.0
tw165: twisted==16.5.0
tw187: twisted==18.7.0
tw1910: twisted==19.10.0
twtrunk: https://github.com/twisted/twisted/archive/trunk.zip
{tw154,tw165,tw187,twtrunk}: pytest-twisted==1.10

; asyncio dependencies
py26-asyncio: trollius>=2.0
py26-asyncio: ordereddict
py27-asyncio: trollius>=2.0
pypy-asyncio: trollius>=2.0
{tw187,tw1910,twtrunk}: pytest-twisted==1.10

changedir=test

Expand All @@ -44,7 +34,6 @@ commands =
# -s: show output immediately
# -v: one line per test, instead of one dot


[testenv:flake8]
deps =
flake8
Expand Down
2 changes: 2 additions & 0 deletions txaio/__init__.py
Expand Up @@ -97,6 +97,8 @@ class _Config(object):
'ILogger', # API for logging

'sleep', # little helper for inline sleeping
'time_ns', # helper: current time (UTC) in ns
'perf_counter_ns', # helper: current performance counter in ns
)


Expand Down
2 changes: 2 additions & 0 deletions txaio/_unframework.py
Expand Up @@ -79,3 +79,5 @@ def _throw_usage_error(*args, **kw):
ILogger = _throw_usage_error

sleep = _throw_usage_error
time_ns = _throw_usage_error
perf_counter_ns = _throw_usage_error
48 changes: 48 additions & 0 deletions txaio/_util.py
@@ -0,0 +1,48 @@
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies 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
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
###############################################################################

import sys
import time


if sys.version_info >= (3, 7):

time_ns = time.time_ns
perf_counter_ns = time.perf_counter_ns

else:

def time_ns():
"""
Shim for standard library time.time_ns for Python < 3.7.
"""
return int(time.time() * 1000000000.)

def perf_counter_ns():
"""
Shim for standard library time.perf_counter for Python < 3.7.
"""
return int(time.perf_counter() * 1000000000.)
2 changes: 1 addition & 1 deletion txaio/_version.py
@@ -1 +1 @@
__version__ = u'18.8.1'
__version__ = u'20.1.1'

0 comments on commit 735eb60

Please sign in to comment.