semvec/pypi-packages huggingface dataset:
showscore 0.1.4
Render music21 scores in jupyter notebooks
License: MIT
Requires Python: >=3.8

# ShowScore

[Music21](https://github.com/cuthbertLab/music21) is an excellent library for
working with music notation in Python. However, to render sheet music you need
to install an external program and configure paths. ShowScore can render scores
beautifully, without any dependencies (and faster to boot!). We do this by using
[OpenSheetMusicDisplay](https://github.com/opensheetmusicdisplay/opensheetmusicdisplay),
an open-source music renderer written in JavaScript.

### Usage

```python
from music21 import *

# Your ABC notation as a string
abc_notation = "X:1\nT:My Tune\nM:4/4\nK:C\nCDEF|G2G2|A4|G2F2|E4|"

# Load the ABC notation from the string
score = converter.parse(abc_notation)

from showscore import show
show(score)
```

```python
from showscore import show
from music21 import corpus
score = corpus.parse('bwv565')

# score will be rendered below cell:
show(score)

# open score in new tab:
show(score, tab=True)
```

### Options

- `showscore.backend` - currently one of 'canvas' (default) or 'svg'
  - canvas is more performant and less laggy - but won't resize automatically
  - use `showscore.backend = 'svg'` to use svg renderer
- `show(score, title=True, tab=False)`
  - `title` - false to hide title
  - `tab` - open in new tab rather than inline

### Known bugs

Some corpus pieces give rendering errors. E.g. 'bach/bwv846' has an error in
Chrome. These are bugs in the OS If a piece fails to render it will display the
error message in red.

- Several pieces (e.g. 'bach/bwv846') will display 'Error rendering
  data:TypeError: Cannot read properties of undefined (reading
  'TempoExpressions')' this is a bug in OpenSheetMusicDisplay. For now use the
  fix below.
- If you see anything else open an [Issue

```python
from music21 import corpus
from showscore import show
score = corpus.parse('bach/bwv846')  # Prelude in C

# filter out metronome marks to fix rendering error
for el in score.recurse().getElementsByClass('MetronomeMark'):
    el.activeSite.remove(el)
    
show(score)
```

### Tested in

- VSCode Notebooks
- Jupyter lab
prettypi 0.3.3
A Python library for pretty printing and enhanced console output.
License: MIT
Requires Python: >=3.8

# PrettyPi

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/prettypi)
[![PyPI version](https://badge.fury.io/py/prettypi.svg)](https://badge.fury.io/py/prettypi)
![PyPI - License](https://img.shields.io/pypi/l/prettypi)
![PyPI - Downloads](https://img.shields.io/pypi/dm/prettypi)
![Doc - link](https://img.shields.io/badge/docs-pages-green?link=https%3A%2F%2Fglawnn.github.io%2FPrettyPi)



PrettyPi is a Python library for enhancing console output with colorful and style text, emojis, tables, and more.

- [documentation](https://glawnn.github.io/PrettyPi/)
- [pypi](https://pypi.org/project/prettypi/)


## Features
- PrettyPrint
  - [x] **Emoji**: Add emojis to your console messages.
  - [x] **Color**: Easily print text in various colors.
  - [x] **Style**: Easily print text with style.
  - [x] **Background Color**: Print text with colored background.
  - [x] **Alignment**: Support text alignment (left, center, right).
  - [x] **Alert**: print alert messages
- PrettyTable
  - [ ] **Display**: Create and display tables in the console.
  - [ ] **Custom**: Customize table formatting and styles.
  - [ ] **Template**: Define and use templates for displaying tables.
  - [ ] **Sorting**: Implement sorting functionality for table columns.
  - [ ] **Filtering**: Add filtering capabilities to tables based on user-defined criteria.
  - [ ] **Pagination**: Enable pagination for large datasets displayed in tables.
- PrettyTree
  - [x] **Display**: Create and display tree.
  - [x] **Color**: Color node in tree.
  - [x] **Style**: Custom style node in tree.

## Installation
You can install PretiPy using pip:

```bash
pip install prettypi
```

## Usage
Here's a quick example of how to use PrettyPi:

### pretty_print
```python
from prettypi.pretty_print import StyledStr
from prettypi.utils import Color, Style, Emoji, BackgroundColor

styled_str = StyledStr("My name", background_color=BackgroundColor.MAGENTA, style=Style.UNDERLINE)
styled_str2 = StyledStr("Toto", color=Color.RED, style=Style.BOLD)

print(f"{styled_str} is {styled_str2} {Emoji.SMILE}")
```

### pretty_print Alert
```python
from prettypi.pretty_print import Alert

alert = Alert.info("This is an information alert")
print(alert)
```

### pretty_tree
```python
from prettypi.pretty_tree import TreeNode
from prettypi.utils import Color, Style

root = TreeNode("Root", color=Color.RED, style=Style.BOLD)
child1 = TreeNode("Child1")
child2 = TreeNode("Child2")

child1.add_child(TreeNode("Child1.1"))
child1.add_child(TreeNode("Child1.2"))

root.add_child(child1)
root.add_child(child2)

root.display()
```