GithubHelp home page GithubHelp logo

utilbox's Introduction

UtilBox README

utilbox is a collection of Python utility packages to help you save time and avoid writing code for commonly required tasks.

Build Status Coverage Status

The current set of capabilities cover the following areas:

  • Encryption
  • JSON manipulation
  • Sending Email
  • Number manipulations
  • File, directory manipulations
  • System interaction
  • Spreadsheet (Excel, CSV) manipulation
  • String and multi-line text manipulation

An overview of the available packages is tabulated as below.

Package Class Description
crypt_utils CryptUtils Encrypt data with AES-128/192/256-bit encryption
json_utils JsonUtils Convert data to JSON formatted string
mail_utils MailUtils Send a plain-text or HTML-formatted email using Python smtplib or external mail application (CLI)
number_utils NumberUtils Perform various operations with numbers and numeric lists
os_utils SysUtils, FileUtils, DirUtils Manipulate files, directories and interact with the underlying OS
spreadsheet_utils ExcelUtils, CsvUtils Work with spreadsheets and CSV files
string_utils StringUtils, TextUtils Manipulate strings and multi-line text

For detailed documentation, refer the UtilBox wiki.

Installation

Install using pip

Make sure you have pip installed on your system, and then run:

pip install utilbox

Install from sources

  • Download the latest release from GitHub and extract it to a temporary location
  • Open your terminal and cd to the extracted archive directory
  • Run python setup.py install

Dependencies

Package dependencies are listed in requirements.txt.

Usage

The below rule should be applied in general when trying to use a utility class,

from utilbox.<package_name> import <class_name>

For example to use the FileUtils class from os_utils package,

from utilbox.os_utils import FileUtils

Here are some real-world scenarios where utilbox can serve your purposes,

Example 1

Let's say you want to fetch only the last line of some text file. To do this,

from utilbox.os_utils import FileUtils

last_line = FileUtils.get_file_last_line("path/to/file.ext")
print last_line

Example 2

What if you wanted the epoch time? No worries,

from utilbox.os_utils import SysUtils

epoch_time = SysUtils.get_epoch_time()
print epoch_time

Example 3

You can send an email just as easily,

from utilbox.mail_utils import MailUtils

smtp_server = "192.168.0.1"
sender_email_id = "[email protected]"

mailer = MailUtils(smtp_server, sender_email_id)

# send a plain-text message
mailer.send_mail_plain("[email protected]", "This is a test mail", sender_email_id, "This message was brought to you by 'utilbox'!")

# send an HTML message
mailer.send_mail_plain("[email protected]", "This is a test mail", sender_email_id, "This message was brought to you by <b>'utilbox'<b>!")

To use the latest bleeding-edge, but possibly unstable version of the code, clone the master branch.
To use the latest stable code, download the latest release from the releases page.

utilbox is being continuously developed and upgraded to be as comprehensive as possible, and any suggestions are most welcome.

Release history

Release history is available in CHANGELOG.md.

License

See LICENSE.txt for license information.

Author

Jenson Jose
Follow me @JoseJenson
Send your suggestions / feedback at [email protected]

How to contribute

To contribute, simply:

  • Fork the project
  • Create your feature branch
  • Commit your changes
  • Push committed changes to your branch
  • If you're happy and you know it, create a new PULL request

utilbox's People

Contributors

jensonjose avatar

Watchers

James Cloos avatar zhaopeng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.