Skip to main content

Convert strings to snakecase

Project description

PyPI CircleCI Codecov

Boa is a Python package for normalizing and converting strings to snakecase.

For example, it translates the user-defined event 'User Buys Item' to 'user_buys_item' which can then be used in a file path in S3, or as the name of a schema or table in Redshift.

It also handles the more complex cases such as stripping punctuation and converting words from camelCase or PascalCase to snake_case (see examples below).

Installation

Install in your virtual environment:

$ pip install boa-str

Quickstart

>>> import boa
>>> my_str = 'Hello Boa'
>>> boa.constrict(my_str)
'hello_boa'

Examples

>>> import boa
>>> boa.constrict('toInfinityAndBeyond')
'to_infinity_and_beyond'
>>> boa.constrict('Welcome-to-planet-Earth!')
'welcome_to_planet_earth'

Tests

We use nose2 and coverage for unit tests.

Install with test requirements:

$ pip install boa-str[test]

Then run:

$ invoke test

Style

$ invoke lint

Contribute

Clone the repo, then install with dev requirements which also includes test requirements:

$ git clone https://github.com/astronomerio/boa/
$ cd boa
$ pip install .[dev]

๐Ÿ๏ธ๐Ÿ๏ธ๐Ÿ๏ธ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
boa_str-1.1.0-py2.py3-none-any.whl (4.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3
boa-str-1.1.0.tar.gz (2.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page