--- id: strip-hints version: "0.1.13" license: The MIT License (MIT) Copyright (c) 2017 Allen Barker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) license_treatment: unclear maintenance: aging --- # strip-hints — Function and command-line program to strip Python type hints. License: unclear · Maintenance: aging · Downloads: 2.3M/mo ## 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 above — verify before relying. Strips type hints from Python source code while preserving line and column numbers, leaving syntactically valid code that can run on interpreters without type-hint support. 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 pip install strip-hints uv add strip-hints poetry add strip-hints ## Installing strip-hints 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: The MIT License (MIT) Copyright (c) 2017 Allen Barker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (unclear) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 2.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags remove type hints from python, strip annotations from code, python type hint removal, convert typed code to untyped, python 2 compatibility tool, type annotation stripper, python code transformation, code-transformation, python-compatibility [View on SkillFed](https://skillfed.io/packages/strip-hints) · [View on PyPI](https://pypi.org/project/strip-hints/)