visitor
A tiny pythonic visitor implementation.
What it is and what it does
visitor is a minimal library implementing the visitor design pattern for Python. It provides a base Visitor class that uses dynamic method dispatch to route calls to type-specific visit methods—for example, visit_str for strings, visit_int for integers. You subclass Visitor and define visit_* methods for each type you want to handle; calling visitor.visit(node) automatically dispatches to the appropriate handler based on the node's type.
The library is intentionally tiny and the author explicitly suggests copy-pasting the source into your project rather than adding a dependency. It has no runtime dependencies and supports both Python 2 and 3, but has been abandoned since 2016 with no maintenance or updates.
Use it for:
- Implement custom JSON encoders or formatters that traverse nested data structures by type
- Build AST walkers or code analysis tools that need type-based dispatch on syntax nodes
- Create domain-specific language interpreters that process typed expression trees
- Write tree traversal algorithms where behavior depends on the node type encountered
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a base Visitor class to implement the visitor design pattern in Python, dispatching method calls based on node type through dynamic method lookup.
No. The package is abandoned and unmaintained since 2016-05-18. The author's own documentation suggests copy-pasting the source instead of taking a dependency. High install friction combined with zero maintenance signal and no security updates makes this a poor choice—either inline the pattern or use a maintained alternative.
Install
visitor on PyPI
pip
pip install visitoruv
uv add visitorpoetry
poetry add visitorInstalling visitor
Before you install
High install friction with no runtime dependencies. Package is abandoned as of 2016-05-18 with no updates since its last commit on 2016-05-19. Supports both Python 2 and 3 but receives no maintenance.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it safe to adopt from a licensing standpoint.
Quickstart
from visitor import Visitor
class MyVisitor(Visitor):
def visit_str(self, node):
return node.upper()
def visit_int(self, node):
return node * 2
visitor = MyVisitor()
print(visitor.visit("hello")) # dispatches to visit_str
Verify before relying
- Whether the package works reliably with modern Python versions despite no maintenance since 2016
- Whether high install friction is due to build requirements or packaging issues
- Real-world adoption rate and whether the 444237 monthly downloads reflect active use or legacy dependencies
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,740 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 444,237/month — #6,623 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: visitor-0.1.3.tar.gz
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
cobbleCobble is a Python library for creating data…
permissive · top 5,000 on PyPI
overloadingProvides function and method overloading based…
permissive · top 15,000 on PyPI
simplegenericProvides a lightweight decorator-based system…
unclear · top 15,000 on PyPI
multimethodMultimethod provides a decorator for adding…
permissive · top 5,000 on PyPI
classesImplements typeclasses for Python, enabling…
permissive · top 15,000 on PyPI
json-streamStreams JSON data from files, URLs, or…
permissive · top 5,000 on PyPI
multipledispatchEnables functions to dispatch on the types of…
permissive · top 5,000 on PyPI
plum-dispatchPlum implements multiple dispatch in Python,…
permissive · top 5,000 on PyPI
ovldOvld provides fast multiple dispatch for Python…
permissive · top 15,000 on PyPI
sortedcollectionsProvides specialized sorted collection data…
permissive · top 15,000 on PyPI