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

Lint

$ invoke lint

Dev

Install with dev requirements (includes test requirements):

$ pip install boa-str[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.0.1.tar.gz (1.5 kB view details)

Uploaded Source

Built Distribution

boa_str-1.0.1-py2.py3-none-any.whl (2.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for boa-str-1.0.1.tar.gz
Algorithm Hash digest
SHA256 65bef88b24a6f0b30990b2d3657866bb5ed34bb07d5050b7d5fb8b21317868f8
MD5 22477fe75e2910f98c4512deb4af6167
BLAKE2b-256 7ae5aa86a71e895274e4e180365f9785cadb09ff501e2a4b111d408bba0c66be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boa_str-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ebd78e7715ea73757647b89e949a1d834050f545659fbd38cbd7624a41a2c55c
MD5 d5089709c41d58464648f5272a4f06d0
BLAKE2b-256 c2f8cd7a05807afd3a32988f7a0cacc95aae28b99912b8828cbf3c5384e4db15

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