{"id":34027690,"url":"https://github.com/evgenyigumnov/fastpy-rs","last_synced_at":"2026-04-07T06:31:21.466Z","repository":{"id":300526150,"uuid":"1006395900","full_name":"evgenyigumnov/fastpy-rs","owner":"evgenyigumnov","description":"FastPy-RS is a high-performance Python library that provides optimized implementations of common functions using Rust.","archived":false,"fork":false,"pushed_at":"2025-08-19T03:18:12.000Z","size":769,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-12-15T07:24:53.203Z","etag":null,"topics":["performance","pyo3","python","rust"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/fastpy-rs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evgenyigumnov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-22T07:03:46.000Z","updated_at":"2025-11-29T14:35:34.000Z","dependencies_parsed_at":"2025-08-08T15:09:25.867Z","dependency_job_id":"92b956b4-7b7a-4537-949d-4f2cc2beee68","html_url":"https://github.com/evgenyigumnov/fastpy-rs","commit_stats":null,"previous_names":["evgenyigumnov/fastpy-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evgenyigumnov/fastpy-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgenyigumnov%2Ffastpy-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgenyigumnov%2Ffastpy-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgenyigumnov%2Ffastpy-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgenyigumnov%2Ffastpy-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evgenyigumnov","download_url":"https://codeload.github.com/evgenyigumnov/fastpy-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgenyigumnov%2Ffastpy-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31503381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["performance","pyo3","python","rust"],"created_at":"2025-12-13T17:01:12.062Z","updated_at":"2026-04-07T06:31:21.460Z","avatar_url":"https://github.com/evgenyigumnov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastpy-rs\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://badge.fury.io/py/fastpy-rs.svg)](https://badge.fury.io/py/fastpy-rs)\n\n![cblt](https://github.com/evgenyigumnov/fastpy-rs/raw/HEAD/rust-python.png)\n\n\nFastPy-RS is a high-performance Python library that provides optimized implementations of common functions using Rust. It's designed to be a collection of frequently used functions where performance matters, offering significant speed improvements over pure Python implementations.\n\n## Features\n\n- **Blazing Fast**: Leverages Rust's performance to provide significant speedups\n- **Easy to Use**: Simple Python interface\n- **Secure**: Written in Rust, ensuring high security\n\nDocumentation: [https://evgenyigumnov.github.io/fastpy-rs](https://evgenyigumnov.github.io/fastpy-rs)\n\n### Usage\n\n```python\nimport fastpy_rs as fr\n# Using crypto functions\nhash_result = fr.crypto.sha256_str(\"hello\")\n\n# Using data tools\n\n# datatools.base64_encode / datatools.base64_decode\nencoded = fr.datatools.base64_encode(b\"hello\")\ndecoded = fr.datatools.base64_decode(\"aGVsbG8=\")\n\ninvalid_data = '\u003c!!!!!!----'\ntry:\n    fr.datatools.base64_decode(invalid_data)\nexcept ValueError:\n    pass\n\n# datatools.gzip_compress / datatools.gzip_decompress\nimport gzip as py_builtin_gzip\n\ntest_bytes = \"Hello World\".encode()\ncompressed_bytes1 = fr.datatools.gzip_compress(test_bytes)  # default compress level is 9\ncompressed_bytes2 = fr.datatools.gzip_compress(test_bytes, 6)\n\ncompressed_bytes = py_builtin_gzip.compress(\"Hello World\".encode(), 9, mtime=0)\nassert fr.datatools.gzip_decompress(compressed_bytes) == b\"Hello World\"\n\n\n# datatools.url_decode / datatools.url_encode\nfrom urllib.parse import quote, unquote\n\nassert datatools.url_encode(\"This string will be URL encoded.\") == quote(\n        \"This string will be URL encoded.\"\n    )\n\n\nassert datatools.url_decode(\"%F0%9F%91%BE%20Exterminate%21\") == unquote(\n        \"%F0%9F%91%BE%20Exterminate%21\"\n    )\n\n# Count word frequencies in a text\ntext = \"Hello hello world! This is a test. Test passed!\"\nfrequencies = fr.ai.token_frequency(text)\nprint(frequencies)\n# Output: {'hello': 2, 'world': 1, 'this': 1, 'is': 1, 'a': 1, 'test': 2, 'passed': 1}\n\n# JSON parsing\njson_data = '{\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}'\nparsed_json = fr.json.parse_json(json_data)\nprint(parsed_json)\n# Output: {'name': 'John', 'age': 30, 'city': 'New York'}\n\n# JSON serialization\ndata_to_serialize = {'name': 'John', 'age': 30, 'city': 'New York'}\nserialized_json = fr.json.serialize_json(data_to_serialize)\nprint(serialized_json)\n# Output: '{\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}'\n\n# HTTP requests\nurl = \"https://api.example.com/data\"\nresponse = fr.http.get(url)\nprint(response)\n# Output: b'{\"data\": \"example\"}'\n```\n\n## Installation\n\n```bash\npip install fastpy-rs\n```\n\nOr from source:\n\n```bash\npip install maturin\nmaturin develop\n```\n\n## Performance\nRun:\n```\npytest  --benchmark-only  --benchmark-group-by=group\n```\nResults:\n```\n---------------------------------------------------------------------------------- benchmark 'base64_encode': 2 tests ---------------------------------------------------------------------------------\nName (time in us)                  Min                 Max                Mean             StdDev              Median               IQR            Outliers  OPS (Kops/s)            Rounds  Iterations\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\ntest_base64_encode_rust        17.3000 (1.0)      162.0000 (1.0)       18.1661 (1.0)       4.0086 (1.0)       17.8000 (1.0)      0.1001 (1.0)      139;4366       55.0476 (1.0)       16026           1\ntest_base64_encode_python     116.7000 (6.75)     326.2000 (2.01)     120.4332 (6.63)     11.7741 (2.94)     118.9000 (6.68)     2.4000 (23.99)     178;320        8.3034 (0.15)       7887           1\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n-------------------------------------------------------------------------------------------------------------------- benchmark 'regex_search': 2 tests ---------------------------------------------------------------------------------------------------------------------\nName (time in us)                                                                                 Min                   Max                  Mean             StdDev                Median                 IQR            Outliers         OPS            Rounds  Iterations\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\ntest_regex_search_rust[\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\b-email]         633.8000 (1.0)        931.2000 (1.0)        667.8635 (1.0)      35.7218 (1.0)        658.8000 (1.0)       18.1750 (1.0)         79;87  1,497.3119 (1.0)        1143           1\ntest_regex_search_python[\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\b-email]     4,097.2000 (6.46)     4,566.4000 (4.90)     4,215.2770 (6.31)     90.3190 (2.53)     4,203.6500 (6.38)     116.5500 (6.41)         63;6    237.2323 (0.16)        204           1\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n------------------------------------------------------------------------------- benchmark 'sha256': 2 tests --------------------------------------------------------------------------------\nName (time in us)          Min                 Max               Mean            StdDev             Median               IQR            Outliers  OPS (Kops/s)            Rounds  Iterations\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\ntest_sha256_rust       22.0000 (1.0)      218.9000 (1.19)     23.0597 (1.0)      4.0259 (1.0)      22.6000 (1.0)      0.4000 (1.0)      448;2624       43.3657 (1.0)       37038           1\ntest_sha256_python     22.6000 (1.03)     184.4999 (1.0)      23.5171 (1.02)     4.5349 (1.13)     23.1000 (1.02)     0.4999 (1.25)     227;1221       42.5223 (0.98)      19456           1\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n--------------------------------------------------------------------------------------------- benchmark 'token_frequency': 2 tests --------------------------------------------------------------------------------------------\nName (time in us)                        Min                     Max                    Mean                StdDev                  Median                    IQR            Outliers         OPS            Rounds  Iterations\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\ntest_token_frequency_rust           759.9000 (1.0)        1,128.4000 (1.0)          790.5642 (1.0)         41.6179 (1.0)          780.1000 (1.0)          18.7500 (1.0)         65;76  1,264.9194 (1.0)         816           1\ntest_token_frequency_python     727,971.8000 (957.98)   754,932.2000 (669.03)   739,440.5600 (935.33)   9,955.3656 (239.21)   739,839.7000 (948.39)   10,844.9250 (578.40)        2;0      1.3524 (0.00)          5           1\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n--------------------------------------------------------------------------------- benchmark 'json_parse': 2 tests ----------------------------------------------------------------------------------\nName (time in us)               Min                 Max                Mean             StdDev              Median               IQR            Outliers  OPS (Kops/s)            Rounds  Iterations\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\ntest_json_parse_python      67.0000 (1.0)      351.2000 (1.08)      71.7280 (1.0)       8.6944 (1.0)       70.5000 (1.0)      2.2000 (1.0)       292;588       13.9416 (1.0)       10965           1\ntest_json_parse_rust       148.9000 (2.22)     324.5000 (1.0)      155.2763 (2.16)     12.0176 (1.38)     153.2000 (2.17)     2.9000 (1.32)      138;236        6.4401 (0.46)       3728           1\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n---------------------------------------------------------------------------- benchmark 'json_serialize': 2 tests -----------------------------------------------------------------------------\nName (time in ms)                  Min                Max               Mean            StdDev             Median               IQR            Outliers      OPS            Rounds  Iterations\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\ntest_json_serialize_python     18.5541 (1.0)      19.9359 (1.0)      19.3042 (1.0)      0.3420 (1.88)     19.3594 (1.0)      0.4167 (1.43)         17;0  51.8021 (1.0)          53           1\ntest_json_serialize_rust       30.9494 (1.67)     31.6470 (1.59)     31.2320 (1.62)     0.1815 (1.0)      31.2358 (1.61)     0.2919 (1.0)           8;0  32.0185 (0.62)         33           1\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------\nName (time in us)             Min                   Max                Mean              StdDev              Median                 IQR            Outliers  OPS (Kops/s)            Rounds  Iterations\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\ntest_http_get_rust       321.9620 (1.0)      1,928.3610 (2.77)     629.2036 (1.0)      335.8742 (31.09)    538.7160 (1.0)      424.6580 (27.51)        12;4        1.5893 (1.0)         100         100\ntest_http_get_python     637.9020 (1.98)       696.6980 (1.0)      663.1543 (1.05)      10.8032 (1.0)      664.8140 (1.23)      15.4370 (1.0)          37;1        1.5079 (0.95)        100         100\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n```\n### Performance Insights\n\n- **Token Frequency** shows the most dramatic improvement (935x), making it ideal for text analysis tasks\n- **Base64** and **Regex** operations benefit significantly from Rust's optimizations (6-6.6x faster)\n- **SHA-256** performance is on par with Python, as both use optimized native implementations\n- Lower standard deviation in Rust implementations indicates more consistent performance\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n### Development Setup\n\n1. Install Rust: https://www.rust-lang.org/tools/install\n2. Install maturin: `pip install maturin`\n3. Clone the repository\n4. Build in development mode: `maturin develop`\n5. Run tests: `pytest tests/`\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Roadmap\n\n### 📦 **JSON / Data**\n\n1. [x] `parse_json(string) -\u003e dict`\n2. [x] `serialize_json(obj) -\u003e str`\n\n\n---\n\n### 🌐 **HTTP / Networking**\n\n11. [x] `get(url) -\u003e str`\n12. [ ] `http_post(url, data, headers=None) -\u003e str`\n13. [ ] `http_download(url, dest_path)`\n14. [ ] `http_request(method, url, headers, body) -\u003e (code, body)`\n15. [ ] `fetch_json(url) -\u003e dict`\n16. [ ] `http_head(url) -\u003e headers`\n17. [ ] `http_retry_request(...)`\n18. [ ] `http_stream_lines(url) -\u003e Iterator[str]`\n19. [ ] `http_check_redirect_chain(url) -\u003e List[str]`\n20. [ ] `http_measure_latency(url) -\u003e float`\n\n---\n\n### 🔐 **Hashing / Crypto**\n\n21. [x] `sha256(data: bytes | str) -\u003e str`\n22. [x] `md5(data: bytes | str) -\u003e str`\n23. [x] `hmac_sha256(key, message) -\u003e str`\n24. [x] `blake3_hash(data) -\u003e str`\n25. [x] `is_valid_sha256(hexstr: str) -\u003e bool`\n26. [x] `secure_compare(a: str, b: str) -\u003e bool`\n\n---\n\n### 🧮 **Data Processing / Encoding**\n\n27. [x] `base64_encode(data: bytes) -\u003e str`\n28. [x] `base64_decode(data: str) -\u003e bytes`\n29. [x] `gzip_compress(data: bytes) -\u003e bytes`\n30. [x] `gzip_decompress(data: bytes) -\u003e bytes`\n31. [x] `url_encode(str) -\u003e str`\n32. [x] `url_decode(str) -\u003e str`\n33. [ ] `csv_parse(csv_string) -\u003e List[Dict]`\n34. [ ] `csv_serialize(data: List[Dict]) -\u003e str`\n35. [ ] `bloom_filter_create(size: int, hash_funcs: int)`\n36. [ ] `bloom_filter_check(item: str) -\u003e bool`\n\n---\n\n### ⏱️ **Performance / Utils**\n\n37. [x] `benchmark_fn(callable, *args, **kwargs) -\u003e float`\n38. [ ] `parallel_map(func, list, threads=4) -\u003e list`\n39. [ ] `fast_deduplication(list) -\u003e list`\n40. [ ] `sort_large_list(list) -\u003e list`\n41. [ ] `fuzzy_string_match(a, b) -\u003e score`\n42. [ ] `levenshtein_distance(a, b) -\u003e int`\n43. [ ] `tokenize_text(text: str) -\u003e List[str]`\n44. [ ] `fast_word_count(text: str) -\u003e Dict[str, int]`\n45. [x] `regex_search(pattern, text) -\u003e List[str]`\n46. [ ] `regex_replace(pattern, repl, text) -\u003e str`\n\n---\n\n### 🧠 **AI/ML Preprocessing**\n\n47. [ ] `normalize_vector(vec: List[float]) -\u003e List[float]`\n48. [ ] `cosine_similarity(vec1, vec2) -\u003e float`\n49. [x] `token_frequency(text: str) -\u003e Dict[str, int]` \n50. [ ] `encode_text_fast(text: str) -\u003e List[int]`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevgenyigumnov%2Ffastpy-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevgenyigumnov%2Ffastpy-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevgenyigumnov%2Ffastpy-rs/lists"}