PyHal

Your swiss knife to perform fast and easy pythonic stuff


Keywords
hal, library, general-purpose
Licenses
Apache-2.0/libpng-2.0
Install
pip install PyHal==10.2.6

Documentation

HAL | Handy Algorithmic Library

Your swiss knife to perform fast and easy pythonic stuff

Build Status codecov.io Code Health
Table of Contents

The problem

Say you want to

If you want to do this stuff in a fast and easy way, this library is for you

Examples

Edit songs tags

Classic way

import os
from mutagen.mp3 import MP3
my_folder = "path to folder containing songs"
for root, dirs, files in os.walk(my_folder):
    for file in files:
        audio = MP3(file)
        audio["artist"] = "An example"
        audio.save()

Using pyhal

from hal.files.models.system import ls_recurse
from hal.files.models.audio import MP3Song
my_folder = "path to folder containing songs"
for file in ls_recurse(my_folder):
    MP3Song(file).set_artist("An example")

Plot data

Classic way

import numpy as np
import matplotlib.pyplot as plt
x = np.arange(1., 100.)
y = np.sin(x)
plt.plot(x, y)
plt.show()

Using pyhal

import numpy as np
from hal.charts.plotter import Plot2d
Plot2d().plot(np.sin, 1, 100, 100)

Get YouTube RSS feed of channel

Classic way

No easy way that I know of

Using pyhal

from hal.internet.services.youtube import YoutubeChannel
video_url = "my awesome video of an awesome channel"
channel_feed = YoutubeChannel.get_feed_url_from_video(video_url)
# or if you know the name
channel_name = "my awesome channel"
channel_feed = YoutubeChannel(channel_name).get_feed_url()

Generate module tests code

Classic way

No easy way that I know of

Using pyhal

from hal.tests.gen import TestWriter
src = "path to module source folder"
out = "path to output folder"
w = TestWriter(src)
w.write_tests(out)

Install

PyPI version Requirements Status Known Vulnerabilities

Different ways, all equals

via pipenv

  • $ pipenv install .
  • $ make install

via pip

  • $ pip3 install PyHal
  • $ make pip-install

fast install

  • make fast-init just copies source files to distitribution files ... run it only if you're sure about dependencies

Usage and documentation

Browse the online documentation here](https://pyhal.readthedocs.io/en/latest/) or make your own by make docs

Contributing and feedback

Contributions welcome Open Source Love

  1. open an issue
  2. fork this repository
  3. create your feature branch (git checkout -b my-new-feature)
  4. commit your changes (git commit -am 'Added my new feature')
  5. publish the branch (git push origin my-new-feature)
  6. open a PR

Suggestions and improvements are welcome!

Authors

Code Climate BCH compliance pylint score

sirfoga
Stefano Fogarollo

Thanks to

License