tibs-0.7.0
توضیحات
A sleek Python library for binary data.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | tibs-0.7.0 |
| نام | tibs |
| نسخه کتابخانه | 0.7.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Scott Griffiths <dr.scottgriffiths@gmail.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/tibs/ |
| مجوز | The MIT License Copyright (c) 2025 Scott Griffiths (dr.scottgriffiths@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
<p>
<img src="https://raw.githubusercontent.com/scott-griffiths/tibs/main/doc/tibs_white.png" alt="Tibs cat" height="130" align="left" />
<a href="https://github.com/scott-griffiths/tibs">
<img src="https://raw.githubusercontent.com/scott-griffiths/tibs/main/doc/tibs.png" alt="tibs" height="110" />
</a><br />
A sleek Python library for binary data
</p>
<br clear="left" />
[](https://pypi.org/project/tibs/)
[](https://github.com/scott-griffiths/tibs/actions/workflows/new_ci.yaml)
[](https://mutibs.readthedocs.io/en/latest/)

[](https://www.pepy.tech/projects/tibs)
[](https://pypistats.org/packages/tibs)
----
``tibs`` is a simple but powerful Python library for creating, interpreting and manipulating binary data.
It is 100% written in Rust to give it excellent performance, and is from the same author as
the [bitstring](https://github.com/scott-griffiths/bitstring) library.
# Documentation
The full documentation is available on [Read the Docs](https://mutibs.readthedocs.io/en/latest/).
## Getting started
To install use
```
pip install tibs
```
There are pre-built wheels for most configurations - if there are issues then please let me know.
Tibs works with Python 3.8 and later.
## A taster
One way to get to know the library is to start a Python interactive session and try a
small binary record. `Tibs` is immutable, like `bytes`; `Mutibs` is the mutable version
for in-place editing.
```pycon
>>> from tibs import Tibs, Mutibs
>>> # Four flag bits, a 12-bit integer field, then two payload bytes.
>>> packet = Tibs.from_joined(["0b1010", Tibs.from_u(3200, 12), b"OK"])
>>> packet
Tibs('0xac804f4b')
>>> len(packet)
32
>>> # Slice at bit positions, then interpret each slice however you need.
>>> packet[:4].bin
'1010'
>>> packet[4:16].to_u()
3200
>>> packet[16:].bytes
b'OK'
>>> # Search and test using strings, bytes, booleans or other Tibs values.
>>> packet.find("0x4f", byte_aligned=True)
16
>>> packet.find_all("0b10")
[0, 2, 5, 8, 17, 23, 25, 28]
>>> # Convert to Mutibs when you want to patch the data in-place.
>>> patched = packet.to_mutibs()
>>> patched[4:16] = Tibs.from_u(2047, 12)
>>> patched[-8:] = b"!"
>>> patched
Mutibs('0xa7ff4f21')
>>> patched[4:16].to_u(), patched[-16:].bytes
(2047, b'O!')
>>> # The same operations are designed to scale to large bit sequences.
>>> Tibs.from_random(1_000_000, seed=b"readme").count(1)
500480
```
This only scratches the surface: the docs cover construction from ints, floats, bytes
and strings; endianness; searching and replacing; rotations; bit indexing; and more
worked examples.
For more information see the full [documentation](https://mutibs.readthedocs.io/en/latest/).
# Credits
The `tibs` library was created by Scott Griffiths and is released under the MIT License.
The Tibs cat artwork was created by Ada Griffiths and is not covered by the software license. All rights reserved.
<p>
<img src="https://raw.githubusercontent.com/scott-griffiths/tibs/main/doc/_static/tibs_white_sleeping.png" alt="Tibs cat" height="110" align="left" />
</p>
نیازمندی
| مقدار | نام |
|---|---|
| xtr | pytest>=9.0.0; |
| xtr | hypothesis>=6.151.0; |
| xtr | pytest-benchmark>=5.2.0; |
| xtr | pyright>=1.1.389; |
| xtr | build; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl tibs-0.7.0:
pip install tibs-0.7.0.whl
نصب پکیج tar.gz tibs-0.7.0:
pip install tibs-0.7.0.tar.gz