antsibull-fileutils is a Python library providing file utility functions primarily used by other community Ansible tools. It's an integral part of the broader antsibull ecosystem, which assists in building the Ansible Distribution. The library follows semantic versioning from version 1.0.0 onwards, aiming to avoid backward-incompatible changes within a major release cycle, though exceptions may occur for critical security fixes.
pip install antsibull-fileutilsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `write_file` to write content to a file and `ansible_mkdtemp` or `AnsibleTemporaryDirectory` to create and manage temporary directories, which are common file operations provided by the library. Note that `write_file` expects bytes for content.
Review existing code that relies on specific symlink handling when copying files or directories to ensure the new behavior aligns with expectations. Adjust logic if necessary, especially for external symlinks.
Consider updating code that interacts with `CollectionCopier.source_directory` to use `pathlib.Path` for better interoperability with modern Python path handling, especially if new `pathlib` features are desired.
Always check the `install_requires` or release notes of other `antsibull-*` libraries you are using to confirm compatible versions of `antsibull-fileutils` before updating.
Ensure the target directory exists before writing, or that the source file exists before reading/copying. Verify the Python process has the necessary read/write/execute permissions for the relevant paths. Use `os.makedirs(os.path.dirname(file_path), exist_ok=True)` to create parent directories if needed.
If your workflow depends on preserving external symlinks as actual links, you may need to implement custom logic to identify and handle these links separately, or adjust your process to expect the content to be copied. Always test your file copying operations after upgrading `antsibull-fileutils` to v1.5.0 or later if symlinks are involved.