{"id":16916903,"url":"https://github.com/althonos/iocursor","last_synced_at":"2025-09-07T17:31:29.341Z","repository":{"id":62571385,"uuid":"335715392","full_name":"althonos/iocursor","owner":"althonos","description":"A zero-copy file-like wrapper for Python byte buffers, inspired by Rust's std::io::Cursor.","archived":false,"fork":false,"pushed_at":"2023-04-04T00:13:03.000Z","size":65,"stargazers_count":16,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-04T07:57:11.850Z","etag":null,"topics":["buffer","file-like","python","python-c-extension","python-extension","sans-io","zero-copy"],"latest_commit_sha":null,"homepage":"","language":"C","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/althonos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","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}},"created_at":"2021-02-03T18:18:31.000Z","updated_at":"2025-08-14T10:08:46.000Z","dependencies_parsed_at":"2024-10-28T16:43:07.484Z","dependency_job_id":null,"html_url":"https://github.com/althonos/iocursor","commit_stats":{"total_commits":54,"total_committers":1,"mean_commits":54.0,"dds":0.0,"last_synced_commit":"06baa5ccbbef2b342b1e7006441d263034aa85cb"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/althonos/iocursor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fiocursor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fiocursor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fiocursor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fiocursor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/althonos","download_url":"https://codeload.github.com/althonos/iocursor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fiocursor/sbom","scorecard":{"id":187184,"data":{"date":"2025-08-11","repo":{"name":"github.com/althonos/iocursor","commit":"06baa5ccbbef2b342b1e7006441d263034aa85cb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:78: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:82: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:91: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:106: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:108: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:116: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:124: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:138: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:140: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:165: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:167: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:107: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:109: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:118: update your workflow using https://app.stepsecurity.io/secureworkflow/althonos/iocursor/test.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:52","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:113","Warn: pipCommand not pinned by hash: .github/workflows/test.yml:56","Warn: pipCommand not pinned by hash: .github/workflows/test.yml:114","Info:   0 out of  18 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   4 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: COPYING:0","Info: FSF or OSI recognized license: MIT License: COPYING:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T19:59:25.918Z","repository_id":62571385,"created_at":"2025-08-16T19:59:25.919Z","updated_at":"2025-08-16T19:59:25.919Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273606368,"owners_count":25135973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["buffer","file-like","python","python-c-extension","python-extension","sans-io","zero-copy"],"created_at":"2024-10-13T19:31:14.145Z","updated_at":"2025-09-07T17:31:29.099Z","avatar_url":"https://github.com/althonos.png","language":"C","readme":"# `io‸cursor`\n\n*A [zero-copy](https://en.wikipedia.org/wiki/Zero-copy)\n[file-like wrapper](https://docs.python.org/3/library/io.html#io.BufferedIOBase)\nfor [Python](https://www.python.org/) [byte buffers](https://docs.python.org/3/c-api/buffer.html),\ninspired by Rust's [`std::io::Cursor`](https://doc.rust-lang.org/std/io/struct.Cursor.html).*\n\n[![Actions](https://img.shields.io/github/actions/workflow/status/althonos/iocursor/test.yml?branch=master\u0026logo=github\u0026style=flat-square\u0026maxAge=300)](https://github.com/althonos/iocursor/actions)\n[![Coverage](https://img.shields.io/codecov/c/gh/althonos/iocursor?style=flat-square\u0026maxAge=3600)](https://codecov.io/gh/althonos/iocursor/)\n[![PyPI](https://img.shields.io/pypi/v/iocursor.svg?style=flat-square\u0026maxAge=3600)](https://pypi.org/project/iocursor)\n[![Wheel](https://img.shields.io/pypi/wheel/iocursor.svg?style=flat-square\u0026maxAge=3600)](https://pypi.org/project/iocursor/#files)\n[![Python Versions](https://img.shields.io/pypi/pyversions/iocursor.svg?style=flat-square\u0026maxAge=3600)](https://pypi.org/project/iocursor/#files)\n[![Python Implementations](https://img.shields.io/pypi/implementation/iocursor.svg?style=flat-square\u0026maxAge=3600\u0026label=impl)](https://pypi.org/project/iocursor/#files)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square\u0026maxAge=2678400)](https://choosealicense.com/licenses/mit/)\n[![Source](https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=2678400\u0026style=flat-square)](https://github.com/althonos/iocursor/)\n[![GitHub issues](https://img.shields.io/github/issues/althonos/iocursor.svg?style=flat-square\u0026maxAge=600)](https://github.com/althonos/iocursor/issues)\n[![Downloads](https://img.shields.io/badge/dynamic/json?style=flat-square\u0026color=303f9f\u0026maxAge=86400\u0026label=downloads\u0026query=%24.total_downloads\u0026url=https%3A%2F%2Fapi.pepy.tech%2Fapi%2Fprojects%2Fiocursor)](https://pepy.tech/project/iocursor)\n[![Changelog](https://img.shields.io/badge/keep%20a-changelog-8A0707.svg?maxAge=2678400\u0026style=flat-square)](https://github.com/althonos/iocursor/blob/master/CHANGELOG.md)\n\n\n\n## 🗺️ Overview\n\n`iocursor.Cursor` lets you wrap an allocated buffer (i.e. a Python object\nimplementing the [buffer protocol](https://docs.python.org/3/c-api/buffer.html)),\nand interfacing with it through the API of a file-like object. It shares\nsome common points with [`io.BytesIO`](https://docs.python.org/3/library/io.html#io.BytesIO)\nbut with the following main differences:\n\n- *zero-copy* VS *copy*: `Cursor` will not copy the data you give it at\n  initialisation, while `BytesIO` will. This makes `Cursor` more efficient\n  when you are using it for read-only operations.\n- *static* VS *growable*: `Cursor` will only use the buffer you give it at\n  static memory, while `BytesIO` will use its dedicated, growable buffer.\n\n\n## 🔧 Installing\n\nInstall directly from PyPI, using [pip](https://pip.pypa.io/):\n\n```console\n$ pip install iocursor\n```\n\nPre-built wheels are available on Linux and OSX for all supported Python3\nversions. Otherwise, building from source only requires a working C compiler.\n\n\n## 🧶 Thread-safety\n\n`iocursor.Cursor` instances are not thread-safe. Using several `Cursor`\ninstances with the same backend memory only for reading should be fine.\nUse a lock when interfacing otherwise.\n\n\n## 💡 Examples\n\n- Use `iocursor.Cursor` when you have `bytes` you need to pass to an interface\n  that only accepts file-like objects. For instance, pass a PNG image decoded\n  from base64 to PIL, without copy:\n  ```python\n  import base64\n  from iocursor import Cursor\n  from PIL import Image\n\n  imgdata = base64.b64decode(\"iVBORw0KGgoAAAANSUhEU...\")\n  img = Image.open(Cursor(imgdata))\n  ```\n- Use `iocursor.Cursor` when you want to use the file-like API to write\n  to a buffer of known size. For instance, retrieve a file using the\n  [`pysmb`](https://miketeo.net/blog/projects/pysmb) API, which only accepts\n  file-like objects:\n  ```python\n  from SMB.SMBConnection import SMBConnectSMBConnection\n\n  smb = SMBConnection('guest', '', 'client', 'server')\n  smb.connect(\"192.168.0.1\")\n\n  info = smb.getAttributes(\"Music\", \"The Clash/Rock the Casbah.mp3\")\n  cursor = Cursor(bytearray(shared_file.file_size))\n  smb.retrieveFile(\"Music\", \"The Clash/Rock the Casbah.mp3\", cursor)\n\n  buffer = cursor.getvalue()\n  ```\n- Use `iocursor.Cursor` when you want to do direct I/O on a type implementing\n  the buffer protocol. For instance, initialize a [`numpy`](https://numpy.org/)\n  [array](https://numpy.org/doc/stable/reference/arrays.html) by writing bytes\n  to it:\n  ```python\n  import numpy\n\n  array = numpy.empty(4, dtype=\"int16\")\n  cursor = Cursor(array)\n  cursor.write(b\"\\x01\\x00\\x02\\x00\\x03\\x00\\x04\\x00\")\n  print(array)  # array([1, 2, 3, 4], dtype=int16)\n  ```\n\n\n## 💭 Feedback\n\n### ⚠️ Issue Tracker\n\nFound a bug ? Have an enhancement request ? Head over to the [GitHub issue\ntracker](https://github.com/althonos/iocursor/issues) if you need to report\nor ask something. If you are filing in on a bug, please include as much\ninformation as you can about the issue, and try to recreate the same bug\nin a simple, easily reproducible situation.\n\n### 🏗️ Contributing\n\nContributions are more than welcome! See [`CONTRIBUTING.md`](https://github.com/althonos/iocursor/blob/master/CONTRIBUTING.md) for more details.\n\n## ⚖️ License\n\nThis library is provided under the [MIT License](https://choosealicense.com/licenses/mit/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falthonos%2Fiocursor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falthonos%2Fiocursor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falthonos%2Fiocursor/lists"}