ansible/ansible
Dependencies
ansible-core is deliberately spare in its dependency footprint. Per AGENTS.md: prefer Python stdlib, prefer in-tree code, only add a dependency when there's no clean alternative.
Runtime dependencies
From requirements.txt:
| Package | Constraint | Why it's required |
|---|---|---|
jinja2 |
>= 3.1.0 |
Templating engine. The 3.1.0 floor is for native macro support |
PyYAML |
>= 5.1 |
YAML parsing — 5.1+ for Python 3.8+ support |
cryptography |
(any) | Vault AES, password hashing, hashing helpers |
packaging |
(any) | PEP 440 version parsing and specifier evaluation |
resolvelib |
>= 0.8.0, < 2.0.0 |
Galaxy collection dependency resolver |
That's it for runtime. ansible-core deliberately keeps the surface tight — no requests, no boto3, no kubernetes-client. Modules that need those things ship in collections that declare their own optional dependencies.
Optional runtime dependencies
Several features have optional dependencies that aren't installed by default:
pywinrm— for thewinrmconnection plugin.pypsrp— for thepsrpconnection plugin.pexpect— for theexpectmodule's interactive command handling.passlib— for thepassword_hashfilter's bcrypt/sha512_crypt support.python-libxml2/lxml— only used in thexmlmodule (now incommunity.general).
Optional deps are declared in the relevant module/plugin documentation. The plugin loader emits an AnsibleError if a feature requiring an unmet optional dep is invoked.
Build dependencies
From pyproject.toml:
[build-system]
requires = ["setuptools >= 77.0.3, <= 80.3.1"]
build-backend = "setuptools.build_meta"The lower bound is for PEP 639 license metadata support; the upper bound is the version actually tested in this release. Setuptools is the only build dep.
Test dependencies
ansible-test brings its own test-time dependencies, declared per environment under test/lib/ansible_test/_data/requirements/. These vary by Python version and test type:
sanity.<python_version>.txt— pylint, pep8, pyyaml, pylint plugins, mypy stubs.units.txt— pytest, pytest-mock, coverage.integration.txt— minimal; integration tests run real playbooks against containers.- Per-target requirements under
test/integration/targets/<name>/files/requirements.txt.
hacking/update-sanity-requirements.py regenerates the pinned test requirements.
Python version support
| Code area | Minimum Python |
|---|---|
Controller (lib/ansible/cli/, lib/ansible/executor/, lib/ansible/plugins/, etc.) |
3.12 — enforced by _PY_MIN = (3, 12) in lib/ansible/cli/__init__.py |
Modules + module_utils |
Wider range, declared by _PY_MIN in lib/ansible/module_utils/basic.py |
The wider module range is necessary because modules ship to remote targets, which may run older OS images with older Pythons. The controller is on the user's workstation or CI runner and can require newer Python.
pyproject.toml advertises requires-python = ">=3.12" — that's the controller minimum.
Vendored / embedded code
Some third-party code is included in the tree rather than imported as a dep:
lib/ansible/_vendor/— has only an__init__.py; reserved for future vendoring.lib/ansible/module_utils/six/— Python 2/3 compatibility shim. Largely unused on the controller (Python 3.12+) but ships with modules to support older Python on targets.lib/ansible/module_utils/distro/— embeds thedistropackage for Linux distribution detection on targets.lib/ansible/module_utils/compat/— small compatibility helpers for the wider Python range modules support.lib/ansible/_internal/_wrapt.py(1,015 lines) — vendored pieces ofwrapt's ObjectProxy primitives, used by the datatag system.
License compatibility
Per AGENTS.md, all dependencies must be compatible with:
- GPL-3.0-or-later for
lib/ansible/(excludingmodule_utils/). - BSD-2-Clause for
lib/ansible/module_utils/.
The current dependency set complies: Jinja2 (BSD), PyYAML (MIT), cryptography (Apache 2.0 / BSD), packaging (Apache 2.0 / BSD), resolvelib (ISC).
Package metadata
pyproject.toml declares the PyPI package as ansible-core:
[project]
requires-python = ">=3.12"
name = "ansible-core"
license = "GPL-3.0-or-later"
license-files = ["COPYING", "licenses/*.txt"]The CLIs are exported as console scripts so pip install ansible-core puts ansible, ansible-playbook, ansible-galaxy, ansible-vault, ansible-doc, ansible-inventory, ansible-config, ansible-console, ansible-pull, and ansible-test on $PATH.
Cross-links
- Getting started — install and dev shell.
- Patterns and conventions — when (not) to add a dep.
- Tooling — the test runner.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.