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.

Source Distribution

boa-str-1.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

boa_str-1.1.0-py2.py3-none-any.whl (4.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file boa-str-1.1.0.tar.gz.

File metadata

  • Download URL: boa-str-1.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for boa-str-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f37a60cb8cc0c51e77293a4b390b8e7712056dccf180fea59e687ee2d7f34805
MD5 1c5b7d82bb6cfc4a529fe4303a081d50
BLAKE2b-256 9c05cf34751f3c56e35f2a7959c79cc170e5641c67f805e0211912a3c429dad4

See more details on using hashes here.

File details

Details for the file boa_str-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for boa_str-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8ca60c028cf3576080b3cfdbd9554a16c2086540fc7369a68559a135893c154f
MD5 0909a9d8ee4e858f2107e40139b94732
BLAKE2b-256 2a75741f22c5cb6314dffa906e7b58701ad558fa379e522013cbcb49191bf6f4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page