strip-hints
Function and command-line program to strip Python type hints.
Decision gist · record as of 2026-08-14
Yes, if you need to strip type hints from Python code. The package is stable, has no known vulnerabilities, and carries a permissive MIT license. Install friction is minimal. The aging maintenance status (539 days since last release) is a minor concern but not a blocker, as the tool's scope is narrow and the repository remains active. Suitable for build pipelines, compatibility layers, or one-off code transformations.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with only wheel as a runtime dependency.
- Maintenance is aging—last release was 539 days ago, though the repository remains active with a recent commit on 2025-02-21.
License · maintenance · safety
(unclear) — MIT license grants broad permission to use, modify, and distribute. No notable restrictions for most use cases.
last release 2025-02-21 (539 days) · last repo commit 2025-02-21 · 49 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,267,977 downloads/mo, #3,179 on PyPI
Alternatives
Verify before relying
pip install strip-hints
strip-hints your_file_with_hints.py
Or programmatically:
from strip_hints import strip_file_to_string
code_string = strip_file_to_string(filename)- Whether the package still works reliably with modern Python 3 versions (classifiers list 3.3–3.5 but latest release is recent)
- Whether the TokenList class and token-level API are documented or stable for external use
What it is and what it does
strip-hints is a command-line tool and Python library that removes type annotations from Python source files while attempting to preserve the syntactic structure and line/column correspondence of the original code. It was originally designed to allow Python 2 code to be developed with type hints on Python 3 but executed on Python 2; though Python 2 is no longer maintained, the tool remains useful for stripping hints from any codebase that needs to run on interpreters without type-hint support.
The package provides both a console command and importable functions for programmatic use. It includes a general-purpose TokenList class that operates on Python tokens using a string-like interface, which can be useful for other token-level code transformations. The tool handles edge cases like line breaks within type hints in annotated assignments and return type specifications, with configurable options to control how strictly line numbers are preserved.
Use it for
- Maintain a single codebase with type hints that must also run on older Python versions without type-hint support
- Automatically strip hints from imported modules in the same directory to enable runtime compatibility
- Preprocess Python code before execution on interpreters that do not support type annotations
- Build custom code transformation tools using the TokenList class for token-level operations
- Test or verify that code remains syntactically valid after type-hint removal
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to strip type hints from Python code.
The package is stable, has no known vulnerabilities, and carries a permissive MIT license. Install friction is minimal. The aging maintenance status (539 days since last release) is a minor concern but not a blocker, as the tool's scope is narrow and the repository remains active. Suitable for build pipelines, compatibility layers, or one-off code transformations.
Install
strip-hints on PyPI
Before you install
Low friction: pure Python wheel with only wheel as a runtime dependency. Maintenance is aging—last release was 539 days ago, though the repository remains active with a recent commit on 2025-02-21.
License in practice
MIT license grants broad permission to use, modify, and distribute. No notable restrictions for most use cases.
Quickstart
pip install strip-hints
strip-hints your_file_with_hints.py
Or programmatically:
from strip_hints import strip_file_to_string
code_string = strip_file_to_string(filename)
Verify before relying
- Whether the package still works reliably with modern Python 3 versions (classifiers list 3.3–3.5 but latest release is recent)
- Whether the TokenList class and token-level API are documented or stable for external use
Package facts
| License | Not declared unclear |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagewheel |
| Maintenance | Aging 539 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,267,977 / month, #3,179 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Utilities |
Evidence: strip_hints-0.1.13-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “remove type hints from python”
- strip-hintsStrips type hints from Python source code while preserving line and…
- djangorestframework-typesProvides type stubs for Django Rest Framework, enabling static type…
- django-typesProvides type stubs for Django to enable static type checking with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also strip-markdown · ansi2txt · typed-ast · strip-ansi · mdit-plain · jaraco.text · untokenize · striprtf · cleanco · ast-decompiler