Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ansible/ansible-runner
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.3.2
Choose a base ref
...
head repository: ansible/ansible-runner
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.3.3
Choose a head ref
  • 3 commits
  • 6 files changed
  • 4 contributors

Commits on Mar 2, 2023

  1. [devel] Add python_requires = >= 3.8 (#1206) (#1212)

    (cherry picked from commit 69e8c1a)
    
    Co-authored-by: Wong Hoi Sing Edison <hswong3i@gmail.com>
    Shrews and hswong3i authored Mar 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3df9421 View commit details

Commits on Mar 6, 2023

  1. Add license and classifiers metadata (#1213) (#1214)

    * Add license and classifiers metadata
    
    Co-authored-by: Matt Martz <matt@sivel.net>
    (cherry picked from commit d1417e5)
    Shrews authored Mar 6, 2023
    Copy the full SHA
    ec560a7 View commit details

Commits on Apr 8, 2023

  1. Remove pkg_resources use (#1224) (#1230)

    * Remove pkg_resources use
    * pkg_resources is deprecated in favor of importlib.metadata
    * expand < 3.10 importlib-metadata polyfill version constraints
    
    Fixes: #1223
    
    Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
    Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
    (cherry picked from commit 3d6f66b)
    
    Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
    nitzmahone and Akasurde authored Apr 8, 2023
    Copy the full SHA
    0393c39 View commit details
Showing with 37 additions and 19 deletions.
  1. +2 −3 ansible_runner/__init__.py
  2. +2 −2 ansible_runner/__main__.py
  3. +6 −0 ansible_runner/utils/importlib_compat.py
  4. +1 −0 requirements.txt
  5. +21 −0 setup.cfg
  6. +5 −14 test/conftest.py
5 changes: 2 additions & 3 deletions ansible_runner/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pkg_resources

from .utils.importlib_compat import importlib_metadata
from .interface import run, run_async, \
run_command, run_command_async, \
get_plugin_docs, get_plugin_docs_async, get_plugin_list, \
@@ -13,5 +12,5 @@
plugins = {
entry_point.name: entry_point.load()
for entry_point
in pkg_resources.iter_entry_points('ansible_runner.plugins')
in importlib_metadata.entry_points(group='ansible_runner.plugins')
}
4 changes: 2 additions & 2 deletions ansible_runner/__main__.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@
# under the License.
#
import ast
import pkg_resources
import threading
import traceback
import argparse
@@ -42,10 +41,11 @@
from ansible_runner import cleanup
from ansible_runner.utils import dump_artifact, Bunch, register_for_cleanup
from ansible_runner.utils.capacity import get_cpu_count, get_mem_in_bytes, ensure_uuid
from ansible_runner.utils.importlib_compat import importlib_metadata
from ansible_runner.runner import Runner
from ansible_runner.exceptions import AnsibleRunnerException

VERSION = pkg_resources.require("ansible_runner")[0].version
VERSION = importlib_metadata.version("ansible_runner")

DEFAULT_ROLES_PATH = os.getenv('ANSIBLE_ROLES_PATH', None)
DEFAULT_RUNNER_BINARY = os.getenv('RUNNER_BINARY', None)
6 changes: 6 additions & 0 deletions ansible_runner/utils/importlib_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys

if sys.version_info < (3, 10):
import importlib_metadata # noqa: F401
else:
import importlib.metadata as importlib_metadata # noqa: F401
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@ packaging
python-daemon
pyyaml
six
importlib-metadata >= 4.6, < 6.3; python_version < '3.10' # enable `groups` arg to entry_points missing in 3.9 stdlib importlib.metadata
21 changes: 21 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -9,6 +9,27 @@ project_urls =
description_file = README.md
description_content_type = text/markdown
license_file = LICENSE.md
license = Apache Software License, Version 2.0
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Developers
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Natural Language :: English
Operating System :: POSIX
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3 :: Only
Topic :: Software Development :: Libraries :: Python Modules
Topic :: System :: Systems Administration
Topic :: Utilities

[options]
python_requires = >=3.8

[entry_points]
console_scripts =
19 changes: 5 additions & 14 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -2,11 +2,10 @@

from pathlib import Path
from packaging.version import Version
import subprocess

from ansible_runner import defaults
from ansible_runner.utils.importlib_compat import importlib_metadata

import pkg_resources
import pytest


@@ -35,9 +34,9 @@ def is_pre_ansible211():
"""

try:
if pkg_resources.get_distribution('ansible-core').version:
if importlib_metadata.version("ansible-core"):
return False
except pkg_resources.DistributionNotFound:
except importlib_metadata.PackageNotFoundError:
# Must be ansible-base or ansible
return True

@@ -51,18 +50,10 @@ def skipif_pre_ansible211(is_pre_ansible211):
@pytest.fixture(scope="session")
def is_pre_ansible212():
try:
base_version = (
subprocess.run(
"python -c 'import ansible; print(ansible.__version__)'",
capture_output=True,
shell=True,
)
.stdout.strip()
.decode()
)
base_version = importlib_metadata.version("ansible")
if Version(base_version) < Version("2.12"):
return True
except pkg_resources.DistributionNotFound:
except importlib_metadata.PackageNotFoundError:
pass