--- id: fastnumbers version: "5.2.0" license: MIT license_treatment: permissive maintenance: active --- # fastnumbers — Super-fast and clean conversions to numbers. License: permissive · Maintenance: active · Downloads: 240.7K/mo ## What it is and what it does fastnumbers is a Python module that wraps and accelerates conversions from strings and other types to int, float, or real numbers. It provides three categories of functions: error-handling functions (try_float, try_int, try_real, try_forceint) that return a fallback value or original input on failure, checking functions (check_float, check_int, etc.) to validate whether input could be converted, and drop-in replacements for Python's built-in int() and float() that aim for speed parity or better. The module handles edge cases like unicode numerals, inf/nan substitution, and batch operations on iterables via a map option. The package is built as a compiled extension (wheels for Python 3.9–3.14 on common platforms) with no runtime dependencies, making it lightweight to install. It targets use cases where numeric parsing is a bottleneck—data processing pipelines, financial calculations, scientific computing, and bulk string-to-number conversions where the speed gains (claimed up to 5x for floats, 10x for error handling) justify the added dependency. Use it for: - Parsing CSV or JSON data with numeric fields where conversion speed or robust error handling is critical - Validating user input or API payloads for numeric types before processing - Batch converting lists of strings to floats or ints with a single call and 2x speedup over list comprehensions - Handling unicode numerals (e.g., Roman numerals, circled digits) in text-to-number pipelines - Replacing Python's built-in int/float in performance-sensitive numeric parsing loops ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts strings and other inputs to numbers (int, float, or real) with fast, flexible error handling and type-checking functions that outperform Python's built-in int() and float(). Yes, if numeric parsing is a measurable bottleneck in your application. The package is stable (Production/Stable status, active maintenance, no known vulnerabilities), has zero runtime dependencies, and offers genuine performance gains for string-to-number conversions and batch operations. Install with caution if you rely on undocumented corner-case behavior of Python's int/float, as the documentation warns of specific differences; otherwise, it is a safe, low-friction upgrade. ## Install pip install fastnumbers uv add fastnumbers poetry add fastnumbers ## Installing fastnumbers Before you install: Medium install friction due to compiled wheels for multiple platforms and Python versions (3.9–3.14). Active maintenance with recent release (48 days old) and steady repository activity (112 stars) suggests reliable ongoing support. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations. Quickstart: from fastnumbers import try_float, try_int # Convert string to float, return original on failure result = try_float('56.07') # Convert with fallback value result = try_float('bad input', on_fail=0) # Batch convert with map option items = try_float(['5', '4.5', '34567.6'], map=list) Requires Python >= 3.9; compiled wheels available for common platforms but source build may require a C compiler on unsupported architectures. Verify before relying: - Whether the claimed 2x–10x speedups hold for typical real-world workloads in your use case - Exact behavior differences from built-in int/float in corner cases mentioned in documentation - Performance of numpy array conversion (try_array) relative to alternatives in your data pipeline ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 240.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags fast string to number conversion, int float parsing performance, numeric type checking, error handling number conversion, batch convert strings to numbers, unicode numeral support, type validation for numbers, performance-optimization, numeric-parsing, type-validation [View on SkillFed](https://skillfed.io/packages/fastnumbers) · [View on PyPI](https://pypi.org/project/fastnumbers/)