6.0: dependency diet — tabulate, unidecode, textdistance, nest_asyncio
Why
Every dependency is install weight, a license question, and a supply-chain surface. Four earn their exit in the 6.0 program:
| Dependency | Problem | Plan |
|---|---|---|
tabulate |
No longer used | Drop |
unidecode |
GPL-licensed | Replace with anyascii (Apache-2.0, equivalent output for our usage) |
textdistance |
Overlaps rapidfuzz, which we already use |
Consolidate on rapidfuzz |
nest_asyncio |
Archived upstream | Retire; needs care for Jupyter re-entrancy (the reason it exists) |
(beautifulsoup4 is tracked separately in the bs4 → lxml migration program.)
Sequencing
The first three are behavior-preserving and land in 5.x as ready. nest_asyncio retirement can change behavior in notebook environments, so it lands in the 6.0 window with a documented replacement pattern for Jupyter users.
Acceptance
- Each swap verified output-compatible on real usage (e.g.,
anyasciivsunidecodeon the actual company-name normalization corpus). - Jupyter/notebook workflows verified working after
nest_asyncioremoval, with an upgrade-guide entry. - License audit of the remaining tree is clean.
Re-audited against main at 5.52.0 today. All four items still stand, and three of them can ship in 5.x without waiting for the breaking window.
| # | dependency | current usage in edgar/ |
ships in |
|---|---|---|---|
| 1 | tabulate |
zero imports | 5.x |
| 2 | unidecode |
2 files, 5 call sites — search/datasearch.py, bdc/search.py |
5.x |
| 3 | textdistance |
1 file, 1 call — search/textsearch.py:39 (textdistance.jaro) |
5.x |
| 4 | nest_asyncio |
2 files — core.py:369-375, storage/_local.py:33 |
needs care |
(1) tabulate is a one-line removal. It is declared in pyproject.toml and imported nowhere in the library. Every install of edgartools has been pulling it down for nothing.
(2) unidecode is a licensing problem, not a technical one. It is GPL-licensed inside an MIT library. anyascii (ISC) is a drop-in for what we use it for — lowercase-and-fold in two search paths. This is the item with the strongest reason to be done regardless of 6.0.
(3) textdistance duplicates a dependency we already have. One jaro call, and rapidfuzz is already a direct dependency and does the same thing faster.
(4) nest_asyncio is archived upstream and breaks on newer runtimes. It exists to make asyncio re-entrant inside Jupyter, so it is the one item that needs real care: replace the sync-over-async bridge with a thread-based asyncio.run pattern, and verify the notebook flows still work rather than assuming, since notebook re-entrancy is the entire reason it is there. This is the only one of the four where "it passes the test suite" is not sufficient evidence.
Taking one
Each is independently shippable and none blocks another, so these are four separate PRs, not one. (1) is genuinely trivial; (2) and (3) are small and mechanical; (4) is the interesting one. Comment here to claim one so two people don't do the same removal.
Retracting the invitation at the end of my comment above: I've removed the help wanted label, and these four are being handled in-house.
The reason is what happened on the bs4 ports (#931). Four files were filed as help wanted yesterday and all four were merged within hours, which would have wasted the time of anyone who took the invitation seriously. These four dependency changes are small enough to go the same way, so it is more honest to say now that they are not waiting for a contributor than to leave the label up and repeat that.
The audit in the comment above still stands and is still accurate — it is a description of work queued, not an offer.
The dependency diet has no changes that must land in the 6.0 window, so it moves to the 6.x milestone.
Three of the four are done, and the fourth turns out to be a dependency we need, so I'm closing this.
- unidecode → anyascii and textdistance → rapidfuzz landed in #1826 (6.0.0). The GPL dependency is gone, and name transliteration in search now uses anyascii (ISC).
- nest_asyncio was removed in #1641 (6.0.0). Coroutines now run on a private event loop instead of patching the running one, and that PR also fixed
Attachments.download()in Jupyter, which was the case nest_asyncio existed for. - tabulate stays. Nothing under
edgar/imports it directly, which is why the audit flagged it, but pandas'DataFrame.to_markdown()imports it at call time, and we call that inedgar/earnings.pyandedgar/ttm/statement.py. Dropping it would make those paths fail with an ImportError on a clean install. I'm adding a comment next to it inpyproject.tomlso it doesn't get flagged again.