https://github.com/banesullivan/mimebytes

Make repr of bytes better in ipython

https://github.com/banesullivan/mimebytes

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (3.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Make repr of bytes better in ipython

Basic Info
  • Host: GitHub
  • Owner: banesullivan
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 1.61 MB
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 2 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

README.md

mimebytes

  • Make repr of bytes better in ipython
  • Rich outputs in Jupyter using _repr_png_ and _repr_jpeg_

```python In [1]: from mimebytes import mime

In [2]: with open('image.png', 'rb') as f: ...: content = f.read()

In [3]: mime(content, 'image/png') Out[3]: PNGBytes<376151> (image/png) ```

preview

If python-magic is installed, you do not need to specify the mimetype as it will be autodetected.

```python In [1]: from mimebytes import mime

In [2]: with open('image.png', 'rb') as f: ...: content = f.read()

In [3]: mime(content) Out[3]: PNGBytes<376151> (image/png) ```

Why?

Have you ever tried to output a bytes object in ipython and seen a garbled mess like the following? If so, then this is for you.

```ipython In [1]: with open('image.png', 'rb') as f: ...: content = f.read() ...:

In [2]: content Out[2]: b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x02\x00\x00\x00\x01\xd1\x08\x06\x00\x00\x00\x1c\xf2\x01\xed\x00\x00 \x00IDATx\x9c\xec\xbdy\x9cfWU\xef\xfd\xddk\xefs\x9e\xb1\xc6\xee\xeaNO\xe9$\x9d9\x84$\x1d\x08\x19\x84@\x80\x10@\x01\x15d\x14D\x05\x15\x05\x05\xe1\xe2\xf0^\xbdr\xf5\xeau\x06\x04E#*<... continues on forever> ```

Owner

  • Name: Bane Sullivan
  • Login: banesullivan
  • Kind: user
  • Location: United States

visualization geek & software engineer. co-created @pyvista.

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 21 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
pypi.org: mimebytes

Make repr of bytes better in IPython

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 21 Last month
Rankings
Dependent packages count: 10.0%
Average: 37.9%
Dependent repos count: 65.8%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/release.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
pyproject.toml pypi
setup.py pypi