From 77f6f338d690a826eb8d3257198f93a3fd3cfe03 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 27 Jul 2021 21:00:00 -0400 Subject: [PATCH 01/43] Remove Python 2 support (#68) * Remove trollius support. Signed-off-by: Chris Lalancette * Use modern asyncio keywords. Signed-off-by: Chris Lalancette * Remove support for Python < 3.5 Signed-off-by: Chris Lalancette * more changes to enforce use of python3 Signed-off-by: William Woodall * add note in readme Signed-off-by: William Woodall * fixups Signed-off-by: William Woodall Co-authored-by: William Woodall --- .travis.yml | 4 +- README.md | 4 +- docs/index.rst | 4 +- docs/process_utils.rst | 12 +- .../process_utils/async_execute_process.py | 69 ++------ .../async_execute_process_trollius.py | 148 ------------------ .../process_utils/execute_process_nopty.py | 2 +- osrf_pycommon/process_utils/impl.py | 5 - setup.py | 11 +- stdeb.cfg | 6 +- tests/test_code_format.py | 3 - .../test_process_utils/impl_aep_asyncio.py | 8 +- .../test_process_utils/impl_aep_trollius.py | 25 --- .../test_async_execute_process.py | 10 +- 14 files changed, 38 insertions(+), 273 deletions(-) delete mode 100644 osrf_pycommon/process_utils/async_execute_process_trollius.py delete mode 100644 tests/unit/test_process_utils/impl_aep_trollius.py diff --git a/.travis.yml b/.travis.yml index 5fb08a2..1f27d8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python python: - - "2.7" - "3.5" - "3.6" - "3.7" @@ -9,7 +8,6 @@ install: - pip install coverage nose flake8 mock - pip install git+https://github.com/PyCQA/flake8-import-order.git script: - - if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then COVER_INCLUSIVE=--cover-inclusive; fi - - PYTHONASYNCIODEBUG=1 python setup.py nosetests -s --with-coverage $COVER_INCLUSIVE + - PYTHONASYNCIODEBUG=1 python setup.py nosetests -s --with-coverage --cover-inclusive notifications: email: false diff --git a/README.md b/README.md index fd46c4c..9b034e8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ osrf_pycommon ============= -Commonly needed Python modules, used by Python software developed at OSRF +Commonly needed Python modules, used by Python software developed at OSRF. + +If you are using Python 2, then you should use the ``python2`` branch. diff --git a/docs/index.rst b/docs/index.rst index 3fc4db0..bd3878e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,8 +5,8 @@ Things like ansi terminal coloring, capturing colored output from programs using subprocess, or even a simple logging system which provides some nice functionality over the built-in Python logging system. The functionality provided here should be generic enough to be reused in arbitrary scenarios and should avoid bringing in dependencies which are not part of the standard Python library. -Where possible Windows and Linux/OS X should be supported, and where it cannot it should be gracefully degrading. -Code should be pure Python as well as Python 2 and Python 3 bilingual. +Where possible Windows, Linux, and macOS should be supported, and where it cannot it should be gracefully degrading. +Code should be pure Python 3. Contents: diff --git a/docs/process_utils.rst b/docs/process_utils.rst index 40b6edc..3ee9e8a 100644 --- a/docs/process_utils.rst +++ b/docs/process_utils.rst @@ -12,14 +12,14 @@ These are the main sections of this module: Asynchronous Process Utilities ------------------------------ -There is a function and class which can be used together with your custom `Tollius `_ or `asyncio `_ run loop. +There is a function and class which can be used together with your custom `asyncio `_ run loop. The :py:func:`osrf_pycommon.process_utils.async_execute_process` function is a `coroutine `_ which allows you to run a process and get the output back bit by bit in real-time, either with stdout and stderr separated or combined. This function also allows you to emulate the terminal using a pty simply by toggling a flag in the parameters. Along side this coroutine is a `Protocol `_ class, :py:class:`osrf_pycommon.process_utils.AsyncSubprocessProtocol`, from which you can inherit in order to customize how the yielded output is handled. -Because this coroutine is built on the ``trollius``/``asyncio`` framework's subprocess functions, it is portable and should behave the same on all major OS's. (including on Windows where an IOCP implementation is used) +Because this coroutine is built on the ``asyncio`` framework's subprocess functions, it is portable and should behave the same on all major OS's. (including on Windows where an IOCP implementation is used) .. autofunction:: osrf_pycommon.process_utils.async_execute_process @@ -33,9 +33,11 @@ In addtion to these functions, there is a utility function for getting the corre Treatment of File Descriptors ----------------------------- -Unlike ``subprocess.Popen``, all of the ``process_utils`` functions behave the same way on Python versions 2.7 through 3.4, and they do not close `inheritable `. file descriptors before starting subprocesses. This is equivalent to passing ``close_fds=False`` to ``subprocess.Popen`` on all Python versions. +Like Python 3.4's ``subprocess.Popen`` (and newer versions), all of the ``process_utils`` functions do not close `inheritable ` file descriptors before starting subprocesses. +This is equivalent to passing ``close_fds=False`` to ``subprocess.Popen`` on all Python versions. -In Python 3.2, the ``subprocess.Popen`` default for the ``close_fds`` option changed from ``False`` to ``True`` so that file descriptors opened by the parent process were closed before spawning the child process. In Python 3.4, `PEP 0446 `_ additionally made it so even when ``close_fds=False`` file descriptors which are `non-inheritable `_ are still closed before spawning the subprocess. +For historical context, in Python 3.2, the ``subprocess.Popen`` default for the ``close_fds`` option changed from ``False`` to ``True`` so that file descriptors opened by the parent process were closed before spawning the child process. +In Python 3.4, `PEP 0446 `_ additionally made it so even when ``close_fds=False`` file descriptors which are `non-inheritable `_ are still closed before spawning the subprocess. If you want to be able to pass file descriptors to subprocesses in Python 3.4 or higher, you will need to make sure they are `inheritable `. @@ -47,7 +49,7 @@ For synchronous execution and output capture of subprocess, there are two functi - :py:func:`osrf_pycommon.process_utils.execute_process` - :py:func:`osrf_pycommon.process_utils.execute_process_split` -These functions are not yet using the ``trollius``/``asyncio`` framework as a back-end and therefore on Windows will not stream the data from the subprocess as it does on Unix machines. +These functions are not yet using the ``asyncio`` framework as a back-end and therefore on Windows will not stream the data from the subprocess as it does on Unix machines. Instead data will not be yielded until the subprocess is finished and all output is buffered (the normal warnings about long running programs with lots of output apply). The streaming of output does not work on Windows because on Windows the :py:func:`select.select` method only works on sockets and not file-like objects which are used with subprocess pipes. diff --git a/osrf_pycommon/process_utils/async_execute_process.py b/osrf_pycommon/process_utils/async_execute_process.py index 072c718..07b5da9 100644 --- a/osrf_pycommon/process_utils/async_execute_process.py +++ b/osrf_pycommon/process_utils/async_execute_process.py @@ -16,18 +16,9 @@ import sys -if sys.version_info >= (3, 4) and 'trollius' not in sys.modules: - # If using Python 3.4 or greater, asyncio is always available. - # However, if trollius has already been imported, use that. - from .async_execute_process_asyncio import async_execute_process - from .async_execute_process_asyncio import get_loop - from .async_execute_process_asyncio import asyncio -else: - # If Python is < 3.3 then a SyntaxError will occur with asyncio - # so we will use Trollius on all platforms below Python 3.4. - from .async_execute_process_trollius import async_execute_process - from .async_execute_process_trollius import get_loop - from .async_execute_process_trollius import asyncio +from .async_execute_process_asyncio import async_execute_process +from .async_execute_process_asyncio import get_loop +from .async_execute_process_asyncio import asyncio __all__ = [ 'async_execute_process', @@ -39,9 +30,7 @@ Coroutine to execute a subprocess and yield the output back asynchronously. This function is meant to be used with the Python :py:mod:`asyncio` module, -which is available via pip with Python 3.3 and built-in to Python 3.4. -On Python >= 2.6 you can use the :py:mod:`trollius` module to get the same -functionality, but without using the new ``yield from`` syntax. +which is available in Python 3.5 or greater. Here is an example of how to use this function: @@ -53,40 +42,16 @@ from osrf_pycommon.process_utils import get_loop - @asyncio.coroutine - def setup(): - transport, protocol = yield from async_execute_process( + async def setup(): + transport, protocol = await async_execute_process( AsyncSubprocessProtocol, ['ls', '/usr']) - returncode = yield from protocol.complete + returncode = await protocol.complete return returncode retcode = get_loop().run_until_complete(setup()) get_loop().close() -That same example using :py:mod:`trollius` would look like this: - -.. code-block:: python - - import trollius as asyncio - from osrf_pycommon.process_utils import async_execute_process - from osrf_pycommon.process_utils import AsyncSubprocessProtocol - from osrf_pycommon.process_utils import get_loop - - - @asyncio.coroutine - def setup(): - transport, protocol = yield asyncio.From(async_execute_process( - AsyncSubprocessProtocol, ['ls', '/usr'])) - returncode = yield asyncio.From(protocol.complete) - raise asyncio.Return(returncode) - - retcode = get_loop().run_until_complete(setup()) - get_loop().close() - -This difference is required because in Python < 3.3 the ``yield from`` syntax -is not valid. - -In both examples, the first argument is the default +Tthe first argument is the default :py:class:`AsyncSubprocessProtocol` protocol class, which simply prints output from stdout to stdout and output from stderr to stderr. @@ -96,7 +61,7 @@ def setup(): ``on_process_exited`` functions. See the documentation for the :py:class:`AsyncSubprocessProtocol` class for -more details, but here is an example which uses asyncio from Python 3.4: +more details, but here is an example which uses asyncio from Python 3.5: .. code-block:: python @@ -123,15 +88,14 @@ def on_process_exited(self, returncode): self.fh.close() - @asyncio.coroutine - def log_command_to_file(cmd, file_name): + async def log_command_to_file(cmd, file_name): def create_protocol(**kwargs): return MyProtocol(file_name, **kwargs) - transport, protocol = yield from async_execute_process( + transport, protocol = await async_execute_process( create_protocol, cmd) - returncode = yield from protocol.complete + returncode = await protocol.complete return returncode get_loop().run_until_complete( @@ -179,7 +143,7 @@ def on_process_exited(self, returncode): stdout and stderr and does nothing when the process exits. Data received by the ``on_stdout_received`` and ``on_stderr_received`` - functions is always in bytes (``str`` in Python2 and ``bytes`` in Python3). + functions is always in ``bytes``. Therefore, it may be necessary to call ``.decode()`` on the data before printing to the screen. @@ -225,11 +189,10 @@ def on_stderr_close(self, exc): from osrf_pycommon.process_utils import get_loop - @asyncio.coroutine - def setup(): - transport, protocol = yield from async_execute_process( + async def setup(): + transport, protocol = await async_execute_process( AsyncSubprocessProtocol, ['ls', '-G', '/usr']) - retcode = yield from protocol.complete + retcode = await protocol.complete print("Exited with", retcode) # This will block until the protocol.complete Future is done. diff --git a/osrf_pycommon/process_utils/async_execute_process_trollius.py b/osrf_pycommon/process_utils/async_execute_process_trollius.py deleted file mode 100644 index 2b243a2..0000000 --- a/osrf_pycommon/process_utils/async_execute_process_trollius.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright 2014 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -import os -import sys - -# Conditionally import so that nosetest --with-coverge --cover-inclusive works. -if sys.version_info < (3, 4) or 'trollius' in sys.modules: - import trollius as asyncio - - from trollius import From - from trollius import Return - - try: - import pty - has_pty = True - except ImportError: - has_pty = False - - from .get_loop_impl import get_loop_impl - - def get_loop(): - return get_loop_impl(asyncio) - - @asyncio.coroutine - def _async_execute_process_nopty( - protocol_class, cmd, cwd, env, shell, - stderr_to_stdout=True - ): - loop = get_loop() - stderr = asyncio.subprocess.PIPE - if stderr_to_stdout is True: - stderr = asyncio.subprocess.STDOUT - # Start the subprocess - if shell is True: - transport, protocol = yield From(loop.subprocess_shell( - protocol_class, " ".join(cmd), cwd=cwd, env=env, - stderr=stderr, close_fds=False)) - else: - transport, protocol = yield From(loop.subprocess_exec( - protocol_class, *cmd, cwd=cwd, env=env, - stderr=stderr, close_fds=False)) - raise Return(transport, protocol) - - if has_pty: - # If pty is availabe, use them to emulate the tty - @asyncio.coroutine - def _async_execute_process_pty( - protocol_class, cmd, cwd, env, shell, - stderr_to_stdout=True - ): - loop = get_loop() - # Create the PTY's - stdout_master, stdout_slave = pty.openpty() - if stderr_to_stdout: - stderr_master, stderr_slave = stdout_master, stdout_slave - else: - stderr_master, stderr_slave = pty.openpty() - - def protocol_factory(): - return protocol_class( - stdin=None, - stdout=stdout_master, - stderr=stderr_master - ) - - # Start the subprocess - if shell is True: - transport, protocol = yield From(loop.subprocess_shell( - protocol_factory, " ".join(cmd), cwd=cwd, env=env, - stdout=stdout_slave, stderr=stderr_slave, close_fds=False)) - else: - transport, protocol = yield From(loop.subprocess_exec( - protocol_factory, *cmd, cwd=cwd, env=env, - stdout=stdout_slave, stderr=stderr_slave, close_fds=False)) - - # Close our copies of the slaves, - # the child's copy of the slave remain open until it terminates - os.close(stdout_slave) - if not stderr_to_stdout: - os.close(stderr_slave) - - # Create Protocol classes - class PtyStdoutProtocol(asyncio.Protocol): - def connection_made(self, transport): - if hasattr(protocol, 'on_stdout_open'): - protocol.on_stdout_open() - - def data_received(self, data): - if hasattr(protocol, 'on_stdout_received'): - protocol.on_stdout_received(data) - - def connection_lost(self, exc): - if hasattr(protocol, 'on_stdout_close'): - protocol.on_stdout_close(exc) - - class PtyStderrProtocol(asyncio.Protocol): - def connection_made(self, transport): - if hasattr(protocol, 'on_stderr_open'): - protocol.on_stderr_open() - - def data_received(self, data): - if hasattr(protocol, 'on_stderr_received'): - protocol.on_stderr_received(data) - - def connection_lost(self, exc): - if hasattr(protocol, 'on_stderr_close'): - protocol.on_stderr_close(exc) - - # Add the pty's to the read loop - # Also store the transport, protocol tuple for each call to - # connect_read_pipe, to prevent the destruction of the protocol - # class instance, otherwise no data is received. - protocol.stdout_tuple = yield From(loop.connect_read_pipe( - PtyStdoutProtocol, os.fdopen(stdout_master, 'rb', 0))) - if not stderr_to_stdout: - protocol.stderr_tuple = yield From(loop.connect_read_pipe( - PtyStderrProtocol, os.fdopen(stderr_master, 'rb', 0))) - # Return the protocol and transport - raise Return(transport, protocol) - else: - _async_execute_process_pty = _async_execute_process_nopty - - @asyncio.coroutine - def async_execute_process( - protocol_class, cmd=None, cwd=None, env=None, shell=False, - emulate_tty=False, stderr_to_stdout=True - ): - if emulate_tty: - transport, protocol = yield From(_async_execute_process_pty( - protocol_class, cmd, cwd, env, shell, - stderr_to_stdout)) - else: - transport, protocol = yield From(_async_execute_process_nopty( - protocol_class, cmd, cwd, env, shell, - stderr_to_stdout)) - raise Return(transport, protocol) diff --git a/osrf_pycommon/process_utils/execute_process_nopty.py b/osrf_pycommon/process_utils/execute_process_nopty.py index 57c9a6d..fd22aee 100644 --- a/osrf_pycommon/process_utils/execute_process_nopty.py +++ b/osrf_pycommon/process_utils/execute_process_nopty.py @@ -30,7 +30,7 @@ def _process_incoming_lines(incoming, left_over): # This function takes the new data, the left over data from last time # and returns a list of complete lines (separated by sep) as well as # any sep trailing data for the next iteration - # This function takes and returns bytes only (str in Python2) + # This function takes and returns bytes only combined = (left_over + incoming) lines = combined.splitlines(True) if not lines: diff --git a/osrf_pycommon/process_utils/impl.py b/osrf_pycommon/process_utils/impl.py index 6965079..bff835c 100644 --- a/osrf_pycommon/process_utils/impl.py +++ b/osrf_pycommon/process_utils/impl.py @@ -23,11 +23,6 @@ # so fallback to non pty implementation _execute_process_pty = None -try: - _basestring = basestring # Python 2 -except NameError: - _basestring = str # Python 3 - def execute_process(cmd, cwd=None, env=None, shell=False, emulate_tty=False): """Executes a command with arguments and returns output line by line. diff --git a/setup.py b/setup.py index 881f96c..b6c3971 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -import sys - from setuptools import find_packages from setuptools import setup @@ -7,15 +5,7 @@ install_requires = [ 'setuptools', ] -if sys.version_info < (3, 4): - install_requires.append('trollius') package_excludes = ['tests*', 'docs*'] -if sys.version_info < (3, ): - # On non-Python3 installs, avoid installing the asyncio files - # which contain Python3 specific syntax. - package_excludes.append( - 'osrf_pycommon.process_utils.async_execute_process_asyncio' - ) packages = find_packages(exclude=package_excludes) package_name = 'osrf_pycommon' @@ -30,6 +20,7 @@ ['resource/' + package_name]), ], install_requires=install_requires, + python_requires='>=3.5', zip_safe=True, author='William Woodall', author_email='william@osrfoundation.org', diff --git a/stdeb.cfg b/stdeb.cfg index 16bd367..4477cac 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,8 +1,6 @@ [DEFAULT] -Depends: python-setuptools, python-trollius Depends3: python3-setuptools -Conflicts: python3-osrf-pycommon Conflicts3: python-osrf-pycommon -Suite: xenial yakkety zesty artful bionic cosmic disco eoan stretch buster Suite3: xenial yakkety zesty artful bionic cosmic disco eoan focal stretch buster -X-Python3-Version: >= 3.2 +X-Python3-Version: >= 3.5 +No-Python2: diff --git a/tests/test_code_format.py b/tests/test_code_format.py index d048c94..2a2e25b 100644 --- a/tests/test_code_format.py +++ b/tests/test_code_format.py @@ -18,9 +18,6 @@ def test_flake8(): cmd.extend(['--ignore=C,D,Q,I']) # work around for https://gitlab.com/pycqa/flake8/issues/179 cmd.extend(['--jobs', '1']) - if sys.version_info < (3, 4): - # Unless Python3, skip files with new syntax, like `yield from` - cmd.append('--exclude={0}/*async_execute_process_asyncio/impl.py'.format(source_dir)) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout, stderr = p.communicate() print(stdout) diff --git a/tests/unit/test_process_utils/impl_aep_asyncio.py b/tests/unit/test_process_utils/impl_aep_asyncio.py index 316a3fb..a478304 100644 --- a/tests/unit/test_process_utils/impl_aep_asyncio.py +++ b/tests/unit/test_process_utils/impl_aep_asyncio.py @@ -1,4 +1,3 @@ -from osrf_pycommon.process_utils import asyncio from osrf_pycommon.process_utils.async_execute_process import async_execute_process from osrf_pycommon.process_utils import get_loop @@ -7,9 +6,8 @@ loop = get_loop() -@asyncio.coroutine -def run(cmd, **kwargs): - transport, protocol = yield from async_execute_process( +async def run(cmd, **kwargs): + transport, protocol = await async_execute_process( create_protocol(), cmd, **kwargs) - retcode = yield from protocol.complete + retcode = await protocol.complete return protocol.stdout_buffer, protocol.stderr_buffer, retcode diff --git a/tests/unit/test_process_utils/impl_aep_trollius.py b/tests/unit/test_process_utils/impl_aep_trollius.py deleted file mode 100644 index 7b9cf0e..0000000 --- a/tests/unit/test_process_utils/impl_aep_trollius.py +++ /dev/null @@ -1,25 +0,0 @@ -from osrf_pycommon.process_utils import asyncio -from osrf_pycommon.process_utils.async_execute_process import async_execute_process -from osrf_pycommon.process_utils import get_loop - -# allow module to be importable for --cover-inclusive -try: - from osrf_pycommon.process_utils.async_execute_process_trollius import From -except ImportError: - TROLLIUS_FOUND = False -else: - TROLLIUS_FOUND = True - - from osrf_pycommon.process_utils.async_execute_process_trollius import Return - - from .impl_aep_protocol import create_protocol - - loop = get_loop() - - @asyncio.coroutine - def run(cmd, **kwargs): - transport, protocol = yield From(async_execute_process( - create_protocol(), cmd, **kwargs)) - retcode = yield asyncio.From(protocol.complete) - raise Return(protocol.stdout_buffer, protocol.stderr_buffer, - retcode) diff --git a/tests/unit/test_process_utils/test_async_execute_process.py b/tests/unit/test_process_utils/test_async_execute_process.py index 4c920e0..736f014 100644 --- a/tests/unit/test_process_utils/test_async_execute_process.py +++ b/tests/unit/test_process_utils/test_async_execute_process.py @@ -3,14 +3,8 @@ import sys import unittest -if sys.version_info >= (3, 4): - from .impl_aep_asyncio import run - from .impl_aep_asyncio import loop - print("Using asyncio") -else: - from .impl_aep_trollius import run - from .impl_aep_trollius import loop - print("Using Trollius") +from .impl_aep_asyncio import run +from .impl_aep_asyncio import loop this_dir = os.path.dirname(os.path.abspath(__file__)) From 9d638c27312c104142ea00af3d9be997cf32ebaf Mon Sep 17 00:00:00 2001 From: William Woodall Date: Tue, 27 Jul 2021 19:29:57 -0700 Subject: [PATCH 02/43] fixup dependencies now that python2 no longer needed (#76) Signed-off-by: William Woodall --- package.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.xml b/package.xml index 5fea581..9f6524b 100644 --- a/package.xml +++ b/package.xml @@ -10,8 +10,7 @@ Apache License 2.0 - python-mock - python3-mock + python3-mock ament_python From 06aa090c476b3eeb8562b8b35da552ab954acb1b Mon Sep 17 00:00:00 2001 From: William Woodall Date: Tue, 27 Jul 2021 19:30:33 -0700 Subject: [PATCH 03/43] 1.0.0 Signed-off-by: William Woodall --- CHANGELOG.rst | 6 ++++++ package.xml | 2 +- setup.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fcab3ec..ec46df6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,9 @@ +1.0.0 (2021-01-25) +------------------ +* Added missing conflict rules in stdeb.cfg. +* Removed Python 2 support. +* Contributors: Chris Lalancette, Timon Engelke + 0.2.1 (2021-01-25) ------------------ * Fix osrf.py_common.process_utils.get_loop() implementation (`#70 `_) diff --git a/package.xml b/package.xml index 9f6524b..605b7f4 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 0.2.1 + 1.0.0 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index b6c3971..ef27a87 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='0.2.1', + version='1.0.0', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From d3d988fcf692595ba82614e4f78010684e9b0d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Thu, 2 Dec 2021 22:38:03 -0800 Subject: [PATCH 04/43] Update release distributions. (#78) * Drop Ubuntu Xenial and surrounding non-LTS distributions * Drop Debian Stretch which is no longer supported upstream * Add Debian Bullseye * Add Ubuntu Jammy --- stdeb.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdeb.cfg b/stdeb.cfg index 4477cac..d0bbc3e 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,6 +1,6 @@ [DEFAULT] Depends3: python3-setuptools Conflicts3: python-osrf-pycommon -Suite3: xenial yakkety zesty artful bionic cosmic disco eoan focal stretch buster +Suite3: bionic cosmic disco eoan focal jammy buster bullseye X-Python3-Version: >= 3.5 No-Python2: From d5fb7c9ef04a5c9b028f74e345894fb3055f5a75 Mon Sep 17 00:00:00 2001 From: Audrow Nash Date: Thu, 20 Jan 2022 11:38:13 -0800 Subject: [PATCH 05/43] 1.0.1 Signed-off-by: Audrow Nash --- CHANGELOG.rst | 5 +++++ package.xml | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ec46df6..0bbd435 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,8 @@ +1.0.1 (2022-01-20) +------------------ +* Update release distributions. (`#78 `_) +* Contributors: Steven! Ragnarök + 1.0.0 (2021-01-25) ------------------ * Added missing conflict rules in stdeb.cfg. diff --git a/package.xml b/package.xml index 605b7f4..944b549 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 1.0.0 + 1.0.1 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index ef27a87..c0017bc 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='1.0.0', + version='1.0.1', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From 6eaa13c404df62dae0827709cce6a0dd2a9d52f7 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 1 Feb 2022 18:19:42 -0500 Subject: [PATCH 06/43] Remove use of pkg_resources from osrf_pycommon. (#66) * Remove use of pkg_resources from osrf_pycommon. Replace it with the use of the more modern importlib* libraries. There are a couple of reasons to do this: 1. pkg_resources is quite slow to import; on my machine, just firing up the python interpreter takes ~35ms, while firing up the python interpreter and importing pkg_resources takes ~175ms. Firing up the python interpreter and importing importlib_metadata takes ~70ms. Removing 100ms per invocation of the command-line both makes it speedier for users, and will speed up our tests (which call out to the command-line quite a lot). 2. pkg_resources is somewhat deprecated and being replaced by importlib. https://importlib-metadata.readthedocs.io/en/latest/using.html describes some of it Signed-off-by: Chris Lalancette * depend on importlib-metadata everywhere Signed-off-by: William Woodall * Fixes from review. Signed-off-by: Chris Lalancette * restrict suites to only include ones that have python3-importlib-metadata Signed-off-by: William Woodall * add note to README about release changes Signed-off-by: William Woodall Co-authored-by: William Woodall --- .travis.yml | 2 +- README.md | 5 +++++ osrf_pycommon/cli_utils/verb_pattern.py | 9 ++++++--- package.xml | 1 + setup.py | 4 ++++ stdeb.cfg | 6 +++--- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f27d8a..c988426 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ python: - "3.7" - "3.8" install: - - pip install coverage nose flake8 mock + - pip install coverage nose flake8 mock importlib-metadata - pip install git+https://github.com/PyCQA/flake8-import-order.git script: - PYTHONASYNCIODEBUG=1 python setup.py nosetests -s --with-coverage --cover-inclusive diff --git a/README.md b/README.md index 9b034e8..20f1695 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,9 @@ osrf_pycommon Commonly needed Python modules, used by Python software developed at OSRF. +Branches +======== + +If you are releasing (using ``stdeb`` or on the ROS buildfarm) for any Ubuntu < ``focal``, or for any OS that doesn't have a key for ``python3-importlib-metadata``, then you need to use the ``1.0.x`` branch, or the latest ``1.`` branch, because starting with ``2.0.0``, that dependency will be required. + If you are using Python 2, then you should use the ``python2`` branch. diff --git a/osrf_pycommon/cli_utils/verb_pattern.py b/osrf_pycommon/cli_utils/verb_pattern.py index 8259db9..a992388 100644 --- a/osrf_pycommon/cli_utils/verb_pattern.py +++ b/osrf_pycommon/cli_utils/verb_pattern.py @@ -17,7 +17,10 @@ import sys import inspect -import pkg_resources +try: + import importlib.metadata as importlib_metadata +except ModuleNotFoundError: + import importlib_metadata def call_prepare_arguments(func, parser, sysargs=None): @@ -149,7 +152,7 @@ def list_verbs(group): :rtype: list of str """ verbs = [] - for entry_point in pkg_resources.iter_entry_points(group=group): + for entry_point in importlib_metadata.entry_points().get(group, []): verbs.append(entry_point.name) return verbs @@ -162,7 +165,7 @@ def load_verb_description(verb_name, group): :returns: verb description :rtype: dict """ - for entry_point in pkg_resources.iter_entry_points(group=group): + for entry_point in importlib_metadata.entry_points().get(group, []): if entry_point.name == verb_name: return entry_point.load() diff --git a/package.xml b/package.xml index 944b549..c792728 100644 --- a/package.xml +++ b/package.xml @@ -10,6 +10,7 @@ Apache License 2.0 + python3-importlib-metadata python3-mock diff --git a/setup.py b/setup.py index c0017bc..055691d 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +import sys + from setuptools import find_packages from setuptools import setup @@ -5,6 +7,8 @@ install_requires = [ 'setuptools', ] +if sys.version_info < (3, 8): + install_requires.append('importlib-metadata') package_excludes = ['tests*', 'docs*'] packages = find_packages(exclude=package_excludes) diff --git a/stdeb.cfg b/stdeb.cfg index d0bbc3e..8bb9ed1 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,6 +1,6 @@ [DEFAULT] -Depends3: python3-setuptools +Depends3: python3-setuptools, python3-importlib-metadata Conflicts3: python-osrf-pycommon -Suite3: bionic cosmic disco eoan focal jammy buster bullseye -X-Python3-Version: >= 3.5 +Suite3: focal jammy buster bullseye +X-Python3-Version: >= 3.8 No-Python2: From cebfdee92225cb922d7ae6bf1c4a87f89919ba7d Mon Sep 17 00:00:00 2001 From: William Woodall Date: Tue, 1 Feb 2022 15:52:35 -0800 Subject: [PATCH 07/43] changelogs Signed-off-by: William Woodall --- CHANGELOG.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0bbd435..850ce4e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,11 @@ +Forthcoming +----------- +* Replace the use of ``pkg_resources`` with the more modern ``importlib-metadata``. (`#66 `_) + * Note this means that from now on you can only release on >= Ubuntu focal as that was when ``python3-importlib-metadata`` was introduced. + * Used the ``1.0.x`` branch if you need an ealier version that still uses ``pkg_resources``. + Co-authored-by: William Woodall +* Contributors: Chris Lalancette + 1.0.1 (2022-01-20) ------------------ * Update release distributions. (`#78 `_) From 89f525e698770da0916c0f567f2ea8676f4cfe1d Mon Sep 17 00:00:00 2001 From: William Woodall Date: Tue, 1 Feb 2022 16:06:22 -0800 Subject: [PATCH 08/43] 2.0.0 Signed-off-by: William Woodall --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 850ce4e..06f5dbb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -Forthcoming ------------ +2.0.0 (2022-01-20) +------------------- * Replace the use of ``pkg_resources`` with the more modern ``importlib-metadata``. (`#66 `_) * Note this means that from now on you can only release on >= Ubuntu focal as that was when ``python3-importlib-metadata`` was introduced. * Used the ``1.0.x`` branch if you need an ealier version that still uses ``pkg_resources``. diff --git a/package.xml b/package.xml index c792728..25957a1 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 1.0.1 + 2.0.0 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index 055691d..c35a489 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name=package_name, - version='1.0.1', + version='2.0.0', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From 7682dd795943025f6133c74f2b7104adc1b80107 Mon Sep 17 00:00:00 2001 From: William Woodall Date: Tue, 1 Feb 2022 16:08:07 -0800 Subject: [PATCH 09/43] fix whitespace and date in changelog heading Signed-off-by: William Woodall --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 06f5dbb..ec9ddc9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -2.0.0 (2022-01-20) -------------------- +2.0.0 (2022-02-01) +------------------ * Replace the use of ``pkg_resources`` with the more modern ``importlib-metadata``. (`#66 `_) * Note this means that from now on you can only release on >= Ubuntu focal as that was when ``python3-importlib-metadata`` was introduced. * Used the ``1.0.x`` branch if you need an ealier version that still uses ``pkg_resources``. From 4b2f3a8e4969f33dced1dc2db2296230e7a55b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 3 Feb 2022 02:47:52 +0100 Subject: [PATCH 10/43] Fix dependencies (#81) * Remove obsolete setuptools from install_requires Now that pkg_resources are no longer used, there is no need to depend on setuptools at runtime. * Fix version-conditional dependency on importlib-metadata Use version markers to depend on importlib-metadata correctly. Explicit conditions mean that wheels built with setup.py will either have the dep or not depending on what Python version they're built with, rather than what version they're installed on. --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index c35a489..d7ecebf 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,8 @@ install_requires = [ - 'setuptools', + 'importlib-metadata;python_version<"3.8"', ] -if sys.version_info < (3, 8): - install_requires.append('importlib-metadata') package_excludes = ['tests*', 'docs*'] packages = find_packages(exclude=package_excludes) From fbc095301f50a0c1675093dc7f31a40712d07625 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Wed, 2 Feb 2022 21:34:02 -0500 Subject: [PATCH 11/43] Stop using mock in favor of unittest.mock. (#74) Mock has been deprecated since Python 3.3; see https://pypi.org/project/mock/ . The recommended replacement is unittest.mock, which seems to be a drop-in replacement. Signed-off-by: Chris Lalancette Co-authored-by: William Woodall --- docs/index.rst | 6 +++--- package.xml | 1 - tests/unit/test_terminal_utils.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index bd3878e..86b0ddb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -64,13 +64,13 @@ That will "uninstall" the hooks into the ``PYTHONPATH`` which point to your sour Testing ------- -In order to run the tests you will need to install `nosetests `_, `flake8 `_, and `Mock `_. +In order to run the tests you will need to install `flake8 `_. -Once you have installed those, then run ``nosetest`` in the root of the ``osrf_pycommon`` source directory: +Once you have installed those, then run ``unittest``: .. code-block:: bash - $ nosetests + $ python3 -m unittest discover -v tests Building the Documentation -------------------------- diff --git a/package.xml b/package.xml index 25957a1..1937fd5 100644 --- a/package.xml +++ b/package.xml @@ -11,7 +11,6 @@ Apache License 2.0 python3-importlib-metadata - python3-mock ament_python diff --git a/tests/unit/test_terminal_utils.py b/tests/unit/test_terminal_utils.py index 6590281..49abfba 100644 --- a/tests/unit/test_terminal_utils.py +++ b/tests/unit/test_terminal_utils.py @@ -1,5 +1,5 @@ -import mock import unittest +from unittest import mock from osrf_pycommon.terminal_utils import is_tty From 8210b6266229a14f29a0672316511257f9d282b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Mon, 14 Feb 2022 17:48:13 -0500 Subject: [PATCH 12/43] Don't release 2.x / master on Debian Buster. (#83) Debian Buster is on Python 3.7: https://packages.debian.org/buster/python3 --- stdeb.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdeb.cfg b/stdeb.cfg index 8bb9ed1..276596f 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,6 +1,6 @@ [DEFAULT] Depends3: python3-setuptools, python3-importlib-metadata Conflicts3: python-osrf-pycommon -Suite3: focal jammy buster bullseye +Suite3: focal jammy bullseye X-Python3-Version: >= 3.8 No-Python2: From 25ffa07baf09320dbecdca331be5fdffab0f6f34 Mon Sep 17 00:00:00 2001 From: William Woodall Date: Mon, 14 Feb 2022 14:57:40 -0800 Subject: [PATCH 13/43] changelogs Signed-off-by: William Woodall --- CHANGELOG.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ec9ddc9..87d6ce9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,24 @@ +Forthcoming +----------- +* Don't release 2.x / master on Debian Buster. (`#83 `_) + Debian Buster is on Python 3.7: https://packages.debian.org/buster/python3 +* Stop using mock in favor of unittest.mock. (`#74 `_) + Mock has been deprecated since Python 3.3; see + https://pypi.org/project/mock/ . The recommended replacement + is unittest.mock, which seems to be a drop-in replacement. + Co-authored-by: William Woodall +* Fix dependencies (`#81 `_) + * Remove obsolete setuptools from install_requires + Now that pkg_resources are no longer used, there is no need to depend + on setuptools at runtime. + * Fix version-conditional dependency on importlib-metadata + Use version markers to depend on importlib-metadata correctly. Explicit + conditions mean that wheels built with setup.py will either have the dep + or not depending on what Python version they're built with, rather than + what version they're installed on. +* fix whitespace and date in changelog heading +* Contributors: Chris Lalancette, Michał Górny, Steven! Ragnarök, William Woodall + 2.0.0 (2022-02-01) ------------------ * Replace the use of ``pkg_resources`` with the more modern ``importlib-metadata``. (`#66 `_) From f9beb2f97e1a15f63da1ac816ce1233c70eb970f Mon Sep 17 00:00:00 2001 From: William Woodall Date: Mon, 14 Feb 2022 15:00:30 -0800 Subject: [PATCH 14/43] 2.0.1 Signed-off-by: William Woodall --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- setup.py | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 87d6ce9..4423f66 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -Forthcoming ------------ +2.0.1 (2022-02-14) +------------------ * Don't release 2.x / master on Debian Buster. (`#83 `_) Debian Buster is on Python 3.7: https://packages.debian.org/buster/python3 * Stop using mock in favor of unittest.mock. (`#74 `_) diff --git a/package.xml b/package.xml index 1937fd5..417e9db 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.0.0 + 2.0.1 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index d7ecebf..c42d546 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -import sys - from setuptools import find_packages from setuptools import setup @@ -14,7 +12,7 @@ setup( name=package_name, - version='2.0.0', + version='2.0.1', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From d330cfd5321a51c1ba9a53acc5c461e2bf68003c Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Thu, 7 Apr 2022 13:26:33 -0400 Subject: [PATCH 15/43] Fix an importlib_metadata warning with Python 3.10. (#84) Use the newer select interface where available, but fallback to the dict interface as needed. Signed-off-by: Chris Lalancette --- osrf_pycommon/cli_utils/verb_pattern.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osrf_pycommon/cli_utils/verb_pattern.py b/osrf_pycommon/cli_utils/verb_pattern.py index a992388..d6b546f 100644 --- a/osrf_pycommon/cli_utils/verb_pattern.py +++ b/osrf_pycommon/cli_utils/verb_pattern.py @@ -152,7 +152,12 @@ def list_verbs(group): :rtype: list of str """ verbs = [] - for entry_point in importlib_metadata.entry_points().get(group, []): + entry_points = importlib_metadata.entry_points() + if hasattr(entry_points, 'select'): + groups = entry_points.select(group=group) + else: + groups = entry_points.get(group, []) + for entry_point in groups: verbs.append(entry_point.name) return verbs @@ -165,7 +170,12 @@ def load_verb_description(verb_name, group): :returns: verb description :rtype: dict """ - for entry_point in importlib_metadata.entry_points().get(group, []): + entry_points = importlib_metadata.entry_points() + if hasattr(entry_points, 'select'): + groups = entry_points.select(group=group) + else: + groups = entry_points.get(group, []) + for entry_point in groups: if entry_point.name == verb_name: return entry_point.load() From d70a3bd3c8aa23bc9c2fff267a5b12d674516646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Fri, 8 Apr 2022 14:47:00 -0700 Subject: [PATCH 16/43] 2.0.2 --- CHANGELOG.rst | 5 +++++ package.xml | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4423f66..5e27dd7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,8 @@ +2.0.2 (2022-04-08) +------------------ +* Fix an importlib_metadata warning with Python 3.10. (`#84 `_) +* Contributors: Chris Lalancette + 2.0.1 (2022-02-14) ------------------ * Don't release 2.x / master on Debian Buster. (`#83 `_) diff --git a/package.xml b/package.xml index 417e9db..b5605ad 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.0.1 + 2.0.2 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index c42d546..73ecf8a 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='2.0.1', + version='2.0.2', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From d03cf0319c1110f0fa6fa66586e884ab87f5a516 Mon Sep 17 00:00:00 2001 From: Audrow Nash Date: Tue, 10 May 2022 18:00:41 -0700 Subject: [PATCH 17/43] 2.1.0 Signed-off-by: Audrow Nash --- CHANGELOG.rst | 3 +++ package.xml | 2 +- setup.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5e27dd7..b739ae4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,6 @@ +2.1.0 (2022-05-10) +------------------ + 2.0.2 (2022-04-08) ------------------ * Fix an importlib_metadata warning with Python 3.10. (`#84 `_) diff --git a/package.xml b/package.xml index b5605ad..5e84728 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.0.2 + 2.1.0 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index 73ecf8a..4a70dcc 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='2.0.2', + version='2.1.0', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From 77cf537c71d3b8e30fca38ae47b9bd7bd1c9d552 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Wed, 19 Oct 2022 11:09:31 +0900 Subject: [PATCH 18/43] Declare test dependencies in [test] extra (#86) Adding a test dependency on 'pytest' will cause colcon to use pytest when running the package's tests, which yields a better experience than the existing fallback to unittest. --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.py b/setup.py index 4a70dcc..c8218ec 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,13 @@ ['resource/' + package_name]), ], install_requires=install_requires, + extras_require={ + 'test': [ + 'flake8', + 'flake8_import_order', + 'pytest', + ], + }, python_requires='>=3.5', zip_safe=True, author='William Woodall', From 2a629acb4340b1383f839109956a07db6e9c8c12 Mon Sep 17 00:00:00 2001 From: Audrow Nash Date: Mon, 7 Nov 2022 08:13:55 -0600 Subject: [PATCH 19/43] 2.1.1 Signed-off-by: Audrow Nash --- CHANGELOG.rst | 5 +++++ package.xml | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b739ae4..72bf0c2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,8 @@ +2.1.1 (2022-11-07) +------------------ +* Declare test dependencies in [test] extra (`#86 `_) +* Contributors: Scott K Logan + 2.1.0 (2022-05-10) ------------------ diff --git a/package.xml b/package.xml index 5e84728..bedd456 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.1.0 + 2.1.1 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index c8218ec..1ed8237 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='2.1.0', + version='2.1.1', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From 709f8312b71b6d2f732afebae2605bf964fe9596 Mon Sep 17 00:00:00 2001 From: Audrow Nash Date: Thu, 17 Nov 2022 10:29:11 -0600 Subject: [PATCH 20/43] [master] Update maintainers - 2022-11-07 (#89) --- CODEOWNERS | 2 ++ package.xml | 5 ++++- setup.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..bbfd6e0 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,2 @@ +# This file was generated by https://github.com/audrow/update-ros2-repos +* @wjwwood diff --git a/package.xml b/package.xml index bedd456..d6057f7 100644 --- a/package.xml +++ b/package.xml @@ -6,10 +6,13 @@ osrf_pycommon 2.1.1 Commonly needed Python modules, used by Python software developed at OSRF. - William Woodall + + William Woodall Apache License 2.0 + William Woodall + python3-importlib-metadata diff --git a/setup.py b/setup.py index 1ed8237..cb17b7c 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ author='William Woodall', author_email='william@osrfoundation.org', maintainer='William Woodall', - maintainer_email='william@osrfoundation.org', + maintainer_email='william@openrobotics.org', url='http://osrf-pycommon.readthedocs.org/', keywords=['osrf', 'utilities'], classifiers=[ From 63d093af885e799aedd7961f9be5bc41b165c194 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 14 Feb 2023 16:28:38 +0000 Subject: [PATCH 21/43] Changelog. Signed-off-by: Chris Lalancette --- CHANGELOG.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 72bf0c2..6fc0aa9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,8 @@ +Forthcoming +----------- +* [master] Update maintainers - 2022-11-07 (`#89 `_) +* Contributors: Audrow Nash + 2.1.1 (2022-11-07) ------------------ * Declare test dependencies in [test] extra (`#86 `_) From 815073ebe4eb892cf1f5bb5fa064ffb1dd45b170 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 14 Feb 2023 16:28:43 +0000 Subject: [PATCH 22/43] 2.1.2 --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6fc0aa9..bbe6bf4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -Forthcoming ------------ +2.1.2 (2023-02-14) +------------------ * [master] Update maintainers - 2022-11-07 (`#89 `_) * Contributors: Audrow Nash diff --git a/package.xml b/package.xml index d6057f7..fc601b1 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.1.1 + 2.1.2 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index cb17b7c..4400f11 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='2.1.1', + version='2.1.2', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From 944277347f91843d4684bc310d42f6f14fab3c83 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 13 Mar 2023 09:28:23 -0700 Subject: [PATCH 23/43] Add GitHub Actions CI workflow (#88) This workflow is based on the one used in the ros-infrastructure org. --- .github/workflows/ci.yaml | 31 +++++++++++++++++++++++++++++++ .travis.yml | 13 ------------- 2 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..8e3f05d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,31 @@ +name: osrf_pycommon-ci + +on: + push: + branches: [master] + pull_request: + +jobs: + build: + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + python: ['3.7', '3.8', '3.9', '3.10'] + include: + - os: ubuntu-18.04 + python: '3.6' + name: osrf_pycommon tests + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{matrix.python}} + uses: actions/setup-python@v4 + with: + python-version: ${{matrix.python}} + - name: Install dependencies + run: | + python -m pip install -U -e .[test] pytest-cov + - name: Run tests + run: | + python -m pytest tests --cov diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c988426..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: python -python: - - "3.5" - - "3.6" - - "3.7" - - "3.8" -install: - - pip install coverage nose flake8 mock importlib-metadata - - pip install git+https://github.com/PyCQA/flake8-import-order.git -script: - - PYTHONASYNCIODEBUG=1 python setup.py nosetests -s --with-coverage --cover-inclusive -notifications: - email: false From 342349f6f48a69fae66b81325b212a9e5920b431 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 23 Jun 2023 09:52:33 -0700 Subject: [PATCH 24/43] Update supported platforms (#93) --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8e3f05d..da4b6ed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,10 +9,10 @@ jobs: build: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [macos-latest, ubuntu-22.04, windows-latest] python: ['3.7', '3.8', '3.9', '3.10'] include: - - os: ubuntu-18.04 + - os: ubuntu-20.04 python: '3.6' name: osrf_pycommon tests runs-on: ${{matrix.os}} From 1a6a6ef63a263a901d44ef10bef181e53bc2392e Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 23 Jun 2023 13:49:33 -0700 Subject: [PATCH 25/43] Suppress warning for specifically handled behavior (#87) In Python 3.10, there is a deprecation warning raised when calling get_event_loop when there is no running loop. --- osrf_pycommon/process_utils/get_loop_impl.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osrf_pycommon/process_utils/get_loop_impl.py b/osrf_pycommon/process_utils/get_loop_impl.py index a9d6349..195219a 100644 --- a/osrf_pycommon/process_utils/get_loop_impl.py +++ b/osrf_pycommon/process_utils/get_loop_impl.py @@ -14,6 +14,7 @@ import os import threading +import warnings _thread_local = threading.local() @@ -39,7 +40,20 @@ def get_loop_impl(asyncio): asyncio.set_event_loop(loop) else: try: - loop = asyncio.get_event_loop() + # See the note in + # https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop # noqa + # In short, between Python 3.10.0 and 3.10.8, this unconditionally + # raises a DeprecationWarning. But after 3.10.8, it only raises a + # the warning if there is no current loop set in the policy. + # Since we are setting a loop in the policy, this warning is + # spurious, and will go away once we get away from Python 3.10.6 + # (verified with Python 3.11.3). + with warnings.catch_warnings(): + warnings.filterwarnings( + 'ignore', + 'There is no current event loop', + DeprecationWarning) + loop = asyncio.get_event_loop() except (RuntimeError, AssertionError): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) From 00ee0a4ec73476d37e8bf5bf729d40e12a99cc45 Mon Sep 17 00:00:00 2001 From: Tully Foote Date: Mon, 26 Jun 2023 16:01:54 -0700 Subject: [PATCH 26/43] Add bookworm as a python3 target (#91) This will need a release or manual flood to deploy. Co-authored-by: Scott K Logan --- stdeb.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdeb.cfg b/stdeb.cfg index 276596f..e1a8554 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,6 +1,6 @@ [DEFAULT] Depends3: python3-setuptools, python3-importlib-metadata Conflicts3: python-osrf-pycommon -Suite3: focal jammy bullseye +Suite3: focal jammy bullseye bookworm X-Python3-Version: >= 3.8 No-Python2: From 9939d8817220efb99ccb2fa6eddb975c1576a223 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 11 Jul 2023 19:28:45 +0000 Subject: [PATCH 27/43] Changelog. Signed-off-by: Chris Lalancette --- CHANGELOG.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bbe6bf4..ce2e2b4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,11 @@ +Forthcoming +----------- +* Add bookworm as a python3 target (`#91 `_) +* Suppress warning for specifically handled behavior (`#87 `_) +* Update supported platforms (`#93 `_) +* Add GitHub Actions CI workflow (`#88 `_) +* Contributors: Scott K Logan, Tully Foote + 2.1.2 (2023-02-14) ------------------ * [master] Update maintainers - 2022-11-07 (`#89 `_) From 92ccb227e67a22628a484b6639ae85c9701e5a1e Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 11 Jul 2023 19:29:10 +0000 Subject: [PATCH 28/43] 2.1.3 --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ce2e2b4..5664f35 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -Forthcoming ------------ +2.1.3 (2023-07-11) +------------------ * Add bookworm as a python3 target (`#91 `_) * Suppress warning for specifically handled behavior (`#87 `_) * Update supported platforms (`#93 `_) diff --git a/package.xml b/package.xml index fc601b1..a18dade 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.1.2 + 2.1.3 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index 4400f11..2fb404d 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='2.1.2', + version='2.1.3', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From 945c866b93d54aa72a93da6d34547340982ab201 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Sat, 22 Jul 2023 09:23:09 -0400 Subject: [PATCH 29/43] Catch all of the spurious warnings from get_event_loop. (#94) The previous patch that did this only did it for one of the cases, but we actually need to catch this warning for all cases of get_event_loop(). Do that here by wrapping the entire block in catch_warnings(). With this in place, other spurious warnings from downstream packages (like launch) are also quieted. Signed-off-by: Chris Lalancette --- osrf_pycommon/process_utils/get_loop_impl.py | 71 ++++++++++---------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/osrf_pycommon/process_utils/get_loop_impl.py b/osrf_pycommon/process_utils/get_loop_impl.py index 195219a..a798f47 100644 --- a/osrf_pycommon/process_utils/get_loop_impl.py +++ b/osrf_pycommon/process_utils/get_loop_impl.py @@ -20,42 +20,43 @@ def get_loop_impl(asyncio): - global _thread_local - if getattr(_thread_local, 'loop_has_been_setup', False): - return asyncio.get_event_loop() - # Setup this thread's loop and return it - if os.name == 'nt': - try: - loop = asyncio.get_event_loop() - if not isinstance(loop, asyncio.ProactorEventLoop): - # Before replacing the existing loop, explicitly - # close it to prevent an implicit close during - # garbage collection, which may or may not be a - # problem depending on the loop implementation. - loop.close() + # See the note in + # https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop # noqa + # In short, between Python 3.10.0 and 3.10.8, this unconditionally raises a + # DeprecationWarning. But after 3.10.8, it only raises the warning if + # ther eis no current loop set in the policy. Since we are setting a loop + # in the policy, this warning is spurious, and will go away once we get + # away from Python 3.10.6 (verified with Python 3.11.3). + with warnings.catch_warnings(): + warnings.filterwarnings( + 'ignore', + 'There is no current event loop', + DeprecationWarning) + + global _thread_local + if getattr(_thread_local, 'loop_has_been_setup', False): + return asyncio.get_event_loop() + # Setup this thread's loop and return it + if os.name == 'nt': + try: + loop = asyncio.get_event_loop() + if not isinstance(loop, asyncio.ProactorEventLoop): + # Before replacing the existing loop, explicitly + # close it to prevent an implicit close during + # garbage collection, which may or may not be a + # problem depending on the loop implementation. + loop.close() + loop = asyncio.ProactorEventLoop() + asyncio.set_event_loop(loop) + except (RuntimeError, AssertionError): loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) - except (RuntimeError, AssertionError): - loop = asyncio.ProactorEventLoop() - asyncio.set_event_loop(loop) - else: - try: - # See the note in - # https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop # noqa - # In short, between Python 3.10.0 and 3.10.8, this unconditionally - # raises a DeprecationWarning. But after 3.10.8, it only raises a - # the warning if there is no current loop set in the policy. - # Since we are setting a loop in the policy, this warning is - # spurious, and will go away once we get away from Python 3.10.6 - # (verified with Python 3.11.3). - with warnings.catch_warnings(): - warnings.filterwarnings( - 'ignore', - 'There is no current event loop', - DeprecationWarning) + else: + try: loop = asyncio.get_event_loop() - except (RuntimeError, AssertionError): - loop = asyncio.new_event_loop() - asyncio.set_event_loop(loop) - _thread_local.loop_has_been_setup = True + except (RuntimeError, AssertionError): + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + _thread_local.loop_has_been_setup = True + return loop From ecd85c93f5a1fb7b67a140db1ef57216274cc6c9 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Mon, 21 Aug 2023 15:21:34 +0000 Subject: [PATCH 30/43] Changelog. Signed-off-by: Chris Lalancette --- CHANGELOG.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5664f35..94cc880 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,8 @@ +Forthcoming +----------- +* Catch all of the spurious warnings from get_event_loop. (`#94 `_) +* Contributors: Chris Lalancette + 2.1.3 (2023-07-11) ------------------ * Add bookworm as a python3 target (`#91 `_) From f65f8594161dcff276813d59d3c1145ce767bb75 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Mon, 21 Aug 2023 15:21:39 +0000 Subject: [PATCH 31/43] 2.1.4 --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 94cc880..624a445 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -Forthcoming ------------ +2.1.4 (2023-08-21) +------------------ * Catch all of the spurious warnings from get_event_loop. (`#94 `_) * Contributors: Chris Lalancette diff --git a/package.xml b/package.xml index a18dade..c35f10a 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.1.3 + 2.1.4 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index 2fb404d..155dbc0 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='2.1.3', + version='2.1.4', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From 7c0320e76c8e356c9e19aba2ebd8a7222afc06b2 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Sun, 1 Dec 2024 18:00:55 -0500 Subject: [PATCH 32/43] Remove CODEOWNERS. (#98) It is out of date and no longer serving its intended purpose. Signed-off-by: Chris Lalancette --- CODEOWNERS | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index bbfd6e0..0000000 --- a/CODEOWNERS +++ /dev/null @@ -1,2 +0,0 @@ -# This file was generated by https://github.com/audrow/update-ros2-repos -* @wjwwood From 66ffe9c61c16c1334ab0b3b3419dd2956df7424a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Mon, 2 Dec 2024 14:51:53 -0800 Subject: [PATCH 33/43] Update deb platforms for release (#95) Added: * Ubuntu Noble (24.04 LTS pre-release) * Debian Trixie (testing) Dropped: * Debian Bullseye (oldstable) Retained: * Debian Bookworm (stable) * Ubuntu Focal (20.04 LTS) * Ubuntu Jammy (22.04 LTS) --- stdeb.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdeb.cfg b/stdeb.cfg index e1a8554..8aca44d 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,6 +1,6 @@ [DEFAULT] Depends3: python3-setuptools, python3-importlib-metadata Conflicts3: python-osrf-pycommon -Suite3: focal jammy bullseye bookworm +Suite3: focal jammy noble bookworm trixie X-Python3-Version: >= 3.8 No-Python2: From 8fbffef05f4530ee375cd53f66342513a248c2d7 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Tue, 3 Dec 2024 07:20:39 -0600 Subject: [PATCH 34/43] Resolve outstanding resource warnings when running tests (#99) --- .../process_utils/execute_process_nopty.py | 22 ++++++++----------- .../test_process_utils/impl_aep_asyncio.py | 1 + 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/osrf_pycommon/process_utils/execute_process_nopty.py b/osrf_pycommon/process_utils/execute_process_nopty.py index fd22aee..65a7ec1 100644 --- a/osrf_pycommon/process_utils/execute_process_nopty.py +++ b/osrf_pycommon/process_utils/execute_process_nopty.py @@ -130,18 +130,14 @@ def yield_to_stream(data, stream): def _execute_process_nopty(cmd, cwd, env, shell, stderr_to_stdout=True): - if stderr_to_stdout: - p = Popen(cmd, - stdin=PIPE, stdout=PIPE, stderr=STDOUT, - cwd=cwd, env=env, shell=shell, close_fds=False) - else: - p = Popen(cmd, - stdin=PIPE, stdout=PIPE, stderr=PIPE, - cwd=cwd, env=env, shell=shell, close_fds=False) - - # Left over data from read which isn't a complete line yet - left_overs = {p.stdout: b'', p.stderr: b''} + stderr = STDOUT if stderr_to_stdout else PIPE + with Popen( + cmd, stdin=PIPE, stdout=PIPE, stderr=stderr, + cwd=cwd, env=env, shell=shell, close_fds=False + ) as p: + # Left over data from read which isn't a complete line yet + left_overs = {p.stdout: b'', p.stderr: b''} - fds = list(filter(None, [p.stdout, p.stderr])) + fds = list(filter(None, [p.stdout, p.stderr])) - return _yield_data(p, fds, left_overs, os.linesep) + yield from _yield_data(p, fds, left_overs, os.linesep) diff --git a/tests/unit/test_process_utils/impl_aep_asyncio.py b/tests/unit/test_process_utils/impl_aep_asyncio.py index a478304..b3ab108 100644 --- a/tests/unit/test_process_utils/impl_aep_asyncio.py +++ b/tests/unit/test_process_utils/impl_aep_asyncio.py @@ -10,4 +10,5 @@ async def run(cmd, **kwargs): transport, protocol = await async_execute_process( create_protocol(), cmd, **kwargs) retcode = await protocol.complete + transport.close() return protocol.stdout_buffer, protocol.stderr_buffer, retcode From 4eb6cec3793adb3bfe61a84b9c1eea00605c2eed Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Tue, 3 Dec 2024 17:10:03 +0100 Subject: [PATCH 35/43] Updated python version (#97) Python version 3.7 is no longer supported as of June 27, 2023 Co-authored-by: Scott K Logan --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index da4b6ed..2f40ab8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-22.04, windows-latest] - python: ['3.7', '3.8', '3.9', '3.10'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] include: - os: ubuntu-20.04 python: '3.6' From 33e1c6a52499d3bc0c8e12193d8edc0cc155c1ee Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Tue, 3 Dec 2024 18:01:53 +0100 Subject: [PATCH 36/43] Update ci.yaml (#96) fix node.js <20 deprecation Co-authored-by: Scott K Logan --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2f40ab8..1ea56e3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,9 +18,9 @@ jobs: runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{matrix.python}} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{matrix.python}} - name: Install dependencies From d2757108163af745bdd2dd39e2113b0bbc1d34d6 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Tue, 3 Dec 2024 11:42:34 -0600 Subject: [PATCH 37/43] Upload coverage results to codecov (#100) --- .github/workflows/ci.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1ea56e3..800d486 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,4 +28,8 @@ jobs: python -m pip install -U -e .[test] pytest-cov - name: Run tests run: | - python -m pytest tests --cov + python -m pytest tests --cov=osrf_pycommon + - name: Upload coverage + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} From 1f171d3b1ef2d433d31634d1262cf6b1ca8538a1 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 6 Dec 2024 13:31:00 -0600 Subject: [PATCH 38/43] Add '+upstream' suffix to published deb version (#102) Using a debian version suffix which falls late alphabetically appears to give our packages preference by apt. If a user enables a repository which distributes packages created by OSRF or ROS, it is likely that they wish to use these packages instead of the ones packaged by their platform. --- stdeb.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/stdeb.cfg b/stdeb.cfg index 8aca44d..a516e76 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -4,3 +4,4 @@ Conflicts3: python-osrf-pycommon Suite3: focal jammy noble bookworm trixie X-Python3-Version: >= 3.8 No-Python2: +Upstream-Version-Suffix: +upstream From 36bdb31c54b4a4a2969b9c2626b762d7fd03ab94 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 6 Dec 2024 13:33:39 -0600 Subject: [PATCH 39/43] Align stdeb dependencies with setup.py (#101) Follow-up to 4b2f3a8e4969f33dced1dc2db2296230e7a55b1d --- stdeb.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdeb.cfg b/stdeb.cfg index a516e76..f13a409 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,7 +1,7 @@ [DEFAULT] -Depends3: python3-setuptools, python3-importlib-metadata +Depends3: python3 (>= 3.8) | python3-importlib-metadata Conflicts3: python-osrf-pycommon Suite3: focal jammy noble bookworm trixie -X-Python3-Version: >= 3.8 +X-Python3-Version: >= 3.5 No-Python2: Upstream-Version-Suffix: +upstream From 850c357c9cba4dfae9371a107dd8ce4fbabcfa1e Mon Sep 17 00:00:00 2001 From: "Marco A. Gutierrez" Date: Wed, 18 Dec 2024 03:39:27 +0000 Subject: [PATCH 40/43] Changelog. Signed-off-by: Marco A. Gutierrez --- CHANGELOG.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 624a445..1035a8e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,35 @@ +Forthcoming +----------- +* Align stdeb dependencies with setup.py (`#101 `_) + Follow-up to 4b2f3a8e4969f33dced1dc2db2296230e7a55b1d +* Add '+upstream' suffix to published deb version (`#102 `_) + Using a debian version suffix which falls late alphabetically appears to + give our packages preference by apt. If a user enables a repository + which distributes packages created by OSRF or ROS, it is likely that + they wish to use these packages instead of the ones packaged by their + platform. +* Upload coverage results to codecov (`#100 `_) +* Update ci.yaml (`#96 `_) + fix node.js <20 deprecation + Co-authored-by: Scott K Logan +* Updated python version (`#97 `_) + Python version 3.7 is no longer supported as of June 27, 2023 + Co-authored-by: Scott K Logan +* Resolve outstanding resource warnings when running tests (`#99 `_) +* Update deb platforms for release (`#95 `_) + Added: + * Ubuntu Noble (24.04 LTS pre-release) + * Debian Trixie (testing) + Dropped: + * Debian Bullseye (oldstable) + Retained: + * Debian Bookworm (stable) + * Ubuntu Focal (20.04 LTS) + * Ubuntu Jammy (22.04 LTS) +* Remove CODEOWNERS. (`#98 `_) + It is out of date and no longer serving its intended purpose. +* Contributors: Chris Lalancette, Scott K Logan, Steven! Ragnarök, mosfet80 + 2.1.4 (2023-08-21) ------------------ * Catch all of the spurious warnings from get_event_loop. (`#94 `_) From 94b0d8e89a4000db8bee7b1c70dd8772a20b6229 Mon Sep 17 00:00:00 2001 From: "Marco A. Gutierrez" Date: Wed, 18 Dec 2024 03:40:26 +0000 Subject: [PATCH 41/43] 2.1.5 Signed-off-by: Marco A. Gutierrez --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1035a8e..2535895 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -Forthcoming ------------ +2.1.5 (2024-12-18) +------------------ * Align stdeb dependencies with setup.py (`#101 `_) Follow-up to 4b2f3a8e4969f33dced1dc2db2296230e7a55b1d * Add '+upstream' suffix to published deb version (`#102 `_) diff --git a/package.xml b/package.xml index c35f10a..d903340 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.1.4 + 2.1.5 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index 155dbc0..389a0a5 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='2.1.4', + version='2.1.5', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']), From f5ab4ff4674658821b237aeaa7e18e604e31c81c Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Mon, 24 Feb 2025 01:41:05 -0800 Subject: [PATCH 42/43] Merge pull request #103 from christophebedard/christophebedard/fix-typo-on-each-verb Fix typo in verbs help output --- osrf_pycommon/cli_utils/verb_pattern.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osrf_pycommon/cli_utils/verb_pattern.py b/osrf_pycommon/cli_utils/verb_pattern.py index d6b546f..549364c 100644 --- a/osrf_pycommon/cli_utils/verb_pattern.py +++ b/osrf_pycommon/cli_utils/verb_pattern.py @@ -109,7 +109,7 @@ def create_subparsers(parser, cmd_name, verbs, group, sysargs, title=None): subparser = parser.add_subparsers( title=title or '{0} command'.format(cmd_name), metavar=metavar, - description='Call `{0} {1} -h` for help on a each verb.'.format( + description='Call `{0} {1} -h` for help on each verb.'.format( cmd_name, metavar), dest='verb' ) From d3acec6fa61ee078b583a38ecfc41f4075454544 Mon Sep 17 00:00:00 2001 From: Audrow Nash Date: Tue, 25 Mar 2025 08:09:11 -0500 Subject: [PATCH 43/43] 2.1.6 Signed-off-by: Audrow Nash --- CHANGELOG.rst | 5 +++++ package.xml | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2535895..07e4259 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,8 @@ +2.1.6 (2025-03-25) +------------------ +* Merge pull request `#103 `_ from christophebedard/christophebedard/fix-typo-on-each-verb +* Contributors: Christophe Bedard + 2.1.5 (2024-12-18) ------------------ * Align stdeb dependencies with setup.py (`#101 `_) diff --git a/package.xml b/package.xml index d903340..0c5be13 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> osrf_pycommon - 2.1.5 + 2.1.6 Commonly needed Python modules, used by Python software developed at OSRF. William Woodall diff --git a/setup.py b/setup.py index 389a0a5..63c8426 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name=package_name, - version='2.1.5', + version='2.1.6', packages=packages, data_files=[ ('share/' + package_name, ['package.xml']),