formic2
An implementation of Apache Ant FileSet and Globs
What it is and what it does
Formic is a Python port of Apache Ant's FileSet and glob pattern system, letting you specify sets of files using include and exclude patterns rather than enumerating them individually. It adds support for the ** wildcard (matching any number of directory levels) and can recursively scan directory trees, which Python's built-in glob and fnmatch modules do not handle as flexibly.
You can use formic2 from the command line to find files matching complex patterns, or import it into Python code to iterate over matching file paths. It automatically excludes common VCS directories and Python cache directories by default. The package has no external runtime dependencies and supports Python 2.6+ and 3.4+, but has not been maintained since 2018-05-25.
Use it for:
- Build scripts that need to find all Python source files while excluding test directories and __init__.py files
- Command-line file discovery with complex patterns to pipe into other tools
- Batch operations on files matching Ant-style glob patterns in a large directory tree
- Migrating build logic from Apache Ant or Maven projects to Python while preserving glob semantics
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Formic implements Apache Ant FileSet and glob patterns to find files recursively using include/exclude rules, including the ** wildcard for matching arbitrary directory levels.
No. While formic2 has no runtime dependencies and low install friction, it has been abandoned since 2018-05-25 with no maintenance. The GPLv3+ copyleft license also restricts use in proprietary code. For modern Python projects, consider using standard library alternatives or actively maintained packages.
Install
formic2 on PyPI
pip
pip install formic2uv
uv add formic2poetry
poetry add formic2Installing formic2
Before you install
Installation is straightforward with no runtime dependencies. However, the project has been abandoned since 2018-06-01 with no releases since 2018-05-25, so maintenance and bug fixes are not forthcoming.
License in practice
Licensed under GPLv3+, a copyleft license. Any code that imports and uses formic2 must be compatible with GPLv3+ terms, including potential source code disclosure obligations.
Quickstart
pip install formic2
import formic
fileset = formic.FileSet(include="**.py",
exclude=["**/*test*/**", "test_*"],
directory="./")
for file_name in fileset:
print(file_name)
Verify before relying
- Whether the package works reliably on Python versions released after 2018-05-25
- Current status of reported issues on GitHub given the abandoned maintenance status
- Whether default excludes still match modern Python directory structures
Package facts
| License | GPLv3+ (copyleft) |
| Python support | supports the current Python release (>=2.6, <4) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,003 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 890,716/month — #4,803 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: formic2-1.0.3-py2-none-any.whl; formic2-1.0.3-py3-none-any.whl
Keywords: Apache Ant, glob, recurse, FileSet, file utilities, find, fnmatcher
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
globmatchMatches file paths against glob patterns…
permissive · top 15,000 on PyPI
wcmatchwcmatch provides enhanced file pattern matching…
permissive · top 1,000 on PyPI
glob2glob2 extends Python's built-in glob module…
permissive · top 5,000 on PyPI
mkdocs-excludeA mkdocs plugin that excludes files and…
permissive · top 15,000 on PyPI
ignore-pythonProvides fast recursive directory traversal…
unclear · top 15,000 on PyPI
colcon-recursive-crawlA colcon-core extension that recursively crawls…
permissive · top 15,000 on PyPI
gitmatchGitmatch implements gitignore-style pattern…
permissive · top 15,000 on PyPI
gitignorefileParses `.gitignore` files according to Git's…
permissive · top 15,000 on PyPI
mkdocs-auto-tag-pluginAutomatically assigns tags to MkDocs pages…
permissive · top 5,000 on PyPI
py-walkFilters filesystem paths using gitignore-style…
permissive · top 5,000 on PyPI