Skip to main content

camelsnake is a Python library for converting between camel case and snake case strings

Project description

camelsnake

camelsnake is a Python library for converting between camel case and snake case strings using regular expressions. It provides two functions:

  • camel_to_snake(camel_str: str) -> str: Converts a camel case string to a snake case string.
  • snake_to_camel(snake_str: str) -> str: Converts a snake case string to a camel case string.

Installation

To install camelsnake, simply use pip:

pip install camelsnake

Usage

To use camelsnake, import the library and call the camel_to_snake and snake_to_camel functions with the appropriate input strings. Here's an example:

import camelsnake

camel_str = 'HelloWorld'
snake_str = camelsnake.camel_to_snake(camel_str)
print(snake_str)  # Output: 'hello_world'

snake_str = 'my_http_request'
camel_str = camelsnake.snake_to_camel(snake_str)
print(camel_str)  # Output: 'myHttpRequest'

Testing

To run the tests for camelsnake, install pytest and run the following command in the project directory:

pytest

This will run the tests in the test_camelsnake.py file and output the results.

License

camelsnake is licensed under the MIT License. See the LICENSE file for more information.

Contributing

Contributions to camelsnake are welcome! If you find a bug or would like to suggest a new feature, please open an issue or submit a pull request. See the CONTRIBUTING.md file for more information.

PS - I published this package in an attempt to see how ridiculous the task is that qualifies for a library of its own

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

camelsnake-0.0.2.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

camelsnake-0.0.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file camelsnake-0.0.2.tar.gz.

File metadata

  • Download URL: camelsnake-0.0.2.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for camelsnake-0.0.2.tar.gz
Algorithm Hash digest
SHA256 08f19c6101f01689446751c001445123a113e24b0b95174ad57e283efb91128b
MD5 8a9e497d8000524862d6c5a82c49abd1
BLAKE2b-256 8e7c8ed028389ea052421c61f216a64b75f799dd62a4332d16417f8e475fed8e

See more details on using hashes here.

File details

Details for the file camelsnake-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: camelsnake-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for camelsnake-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2251fd6ecdbfdf90bf55f26cf6a115df1c19fecacfdbfbddd6702f4d70709add
MD5 d7c85ddeda7e4ef3ae7d49b80af76ca3
BLAKE2b-256 be79a24f2baf3920f440de1439e09220a03f620554f96ecbe1a64f40418ff3fd

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