Skip to content

Commit

Permalink
Remove runtime usage of pkg_resources.
Browse files Browse the repository at this point in the history
This should provide a startup time speed boost at the expense of making
it harder to get ansible to use newer versions of packages than are
provided by the platform.
  • Loading branch information
abadger committed Oct 18, 2018
1 parent 65bb6a5 commit 4d9504e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
10 changes: 1 addition & 9 deletions bin/ansible
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

__requires__ = ['ansible']
try:
import pkg_resources
except Exception:
# Use pkg_resources to find the correct versions of libraries and set
# sys.path appropriately when there are multiversion installs. But we
# have code that better expresses the errors in the places where the code
# is actually used (the deps are optional for many code paths) so we don't
# want to fail here.
pass


import os
import shutil
Expand Down
4 changes: 0 additions & 4 deletions bin/ansible-connection
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__requires__ = ['ansible']

try:
import pkg_resources
except Exception:
pass

import fcntl
import hashlib
Expand Down
8 changes: 8 additions & 0 deletions changelogs/fragments/drop-pkg_resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
minor_changes:
- Drop the use of pkg_resources. Importing pkg_resources was the costliest
part of startup time for Ansible. pkg_resources was used so that platforms
with old versions of PyCrypto and Jinja2 could use parallel installed,
updated versions. Since we no longer support Python-2.6 on the controller
side, we no longer have to support parallel installation to work around
those old stacks.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ jinja2
PyYAML
paramiko
cryptography
setuptools

0 comments on commit 4d9504e

Please sign in to comment.