Casefy (/keɪsfaɪ/) is a lightweight Python package to convert the casing of strings

Overview

Active Issues

Introduction

Casefy (/keɪsfaɪ/) is a lightweight Python package to convert the casing of strings. It has no third-party dependencies and supports Unicode.


Installation

The latest release can be installed using pip:

pip install -U casefy

Casefy is also available as an Arch Linux AUR package.


Examples

Note: for more details, you can check the API Reference.

import casefy

# camelCase
string = casefy.camelcase("foo_bar")
print(string)  # fooBar

string = casefy.camelcase("FooBar")
print(string)  # fooBar

string = casefy.camelcase("FOO BAR")
print(string)  # fooBar

# snake_case
string = casefy.snakecase("fooBar")
print(string)  # foo_bar

string = casefy.snakecase("fooBARbaz", keep_together=["bar"])
print(string)  # foo_bar_baz

string = casefy.snakecase("FOO BAR")
print(string)  # foo_bar

# CONST_CASE
string = casefy.constcase("fooBar")
print(string)  # FOO_BAR

# kebab-case
string = casefy.kebabcase("fooBar")
print(string)  # foo-bar

# separator case
string = casefy.separatorcase("fooBar", separator="/")
print(string)  # foo/bar

string = casefy.separatorcase("fooBARbaz", separator="%", keep_together=["bar"])
print(string)  # foo%bar%baz

# Sentence case
string = casefy.sentencecase("fooBar")
print(string)  # Foo bar

Contribute

If you find a bug, please open an issue. Pull Requests are also welcome!


Acknowledgements

This project started when I saw that the package python-stringcase was flagged-out-of-date in the Arch AUR Repository. The project stringcase seems not to be actively maintained anymore, so I decided to address its issues and pull requests and solve them in this new package. I kept the API as similar as possible, in order to facilitate any possible migration. I thank Taka Okunishi (author of stringcase) and its contributors for their work.


Related projects

  • case-conversion offers a very similar functionality as this project. I probably wouldn't have written this package if I had known of it before. However, the code of Casefy is more lightweight and just enough for most cases. If you need more functionality, e.g., detecting the case of a string, go with case-conversion.

  • Inflection presents some overlap with this project as well, allowing the transformation of strings from CamelCase to underscored_string, but also singularizing and pluralizing English words.


License

Casefy is distributed under the MIT license.

You might also like...
A Python package for floating-point binary fractions. Do math in base 2!

An implementation of a floating-point binary fractions class and module in Python. Work with binary fractions and binary floats with ease!

A Python package implementing various colour checker detection algorithms and related utilities.
A Python package implementing various colour checker detection algorithms and related utilities.

A Python package implementing various colour checker detection algorithms and related utilities.

Obsidian tools - a Python package for analysing an Obsidian.md vault

obsidiantools is a Python package for getting structured metadata about your Obsidian.md notes and analysing your vault.

A python package for your Kali Linux distro that find the fastest mirror and configure your apt to use that mirror

Kali Mirror Finder Using Single Python File A python package for your Kali Linux distro that find the fastest mirror and configure your apt to use tha

The git for the Python Story Utility Package library.

SUP The git for the Python Story Utility Package library. Installation: Install SUP by simply running pip install psup in your terminal. Check out our

Fcpy: A Python package for high performance, fast convergence and high precision numerical fractional calculus computing.

Fcpy: A Python package for high performance, fast convergence and high precision numerical fractional calculus computing.

python package for generating typescript grpc-web stubs from protobuf files.

grpc-web-proto-compile NOTE: This package has been superseded by romnn/proto-compile, which provides the same functionality but offers a lot more flex

DUQ is a python package for working with physical Dimensions, Units, and Quantities.

DUQ is a python package for working with physical Dimensions, Units, and Quantities.

Personal Toolbox Package

Jammy (Jam) A personal toolbox by Qsh.zh. Usage setup For core package, run pip install jammy To access functions in bin git clone https://gitlab.com/

Releases(v0.1.7)
  • v0.1.7(Dec 27, 2022)

    Casefy

    v0.1.7

    What's Changed

    This release only includes changes in the packaging logic:

    • Remove legacy setup.cfg and setup.py.
    • Change to hatchling as build backend.
    • Update project metadata.

    Full Changelog: https://github.com/dmlls/python-casefy/compare/v0.1.2...v0.1.7

    Source code(tar.gz)
    Source code(zip)
  • v0.1.2(Mar 20, 2022)

    Casefy

    v0.1.2

    What's Changed

    • Added py.typed to enable exported typing by @rob-blackbourn in https://github.com/dmlls/python-casefy/pull/1
    • With https://github.com/dmlls/python-casefy/commit/261c7827ff4fe88304cba7e5caf554f230fc4add, the casefy module no longer exposes re and typing.List

    New Contributors

    • @rob-blackbourn made his first contribution in https://github.com/dmlls/python-casefy/pull/1

    Full Changelog: https://github.com/dmlls/python-casefy/compare/v0.1.1...v0.1.2

    Source code(tar.gz)
    Source code(zip)
Nmap script to guess* a GitLab version.

gitlab-version-nse Nmap script to guess* a GitLab version. Usage https://github.com/righel/gitlab-version-nse cd gitlab-version-nse nmap target --s

Luciano Righetti 120 Dec 05, 2022
This program organizes automatically files in folders named as file's extension

Auto Sorting System by Sergiy Grimoldi - V.0.0.2 This program organizes automatically files in folders named as file's extension How to use the code T

Sergiy Grimoldi 1 Jan 07, 2022
A Python package for floating-point binary fractions. Do math in base 2!

An implementation of a floating-point binary fractions class and module in Python. Work with binary fractions and binary floats with ease!

10 Oct 29, 2022
A simple python script to generate an iCalendar file for the university classes.

iCal Generator This is a simple python script to generate an iCalendar file for the university classes. Installation Clone the repository git clone ht

Foad Rashidi 2 Sep 01, 2022
A random cats photos python module

A random cats photos python module

Fayas Noushad 6 Dec 01, 2021
Python tool to check a web applications compliance with OWASP HTTP response headers best practices

Check Your Head A quick and easy way to check a web applications response headers!

Zak 6 Nov 09, 2021
Python type-checker written in Rust

pravda Python type-checker written in Rust Features Fully typed with annotations and checked with mypy, PEP561 compatible Add yours! Installation pip

wemake.services 31 Oct 21, 2022
This is a package that allows you to create a key-value vault for storing variables in a global context

This is a package that allows you to create a key-value vault for storing variables in a global context. It allows you to set up a keyring with pre-defined constants which act as keys for the vault.

Data Ductus 2 Dec 14, 2022
Install, run, and update apps without root and only in your home directory

Qube Apps Install, run, and update apps in the private storage of a Qube. Build and install in Qubes Get the code: git clone https://github.com/micahf

Micah Lee 26 Dec 27, 2022
Backman is a random/fixed background image setter for wlroots based compositors

backman Backman is a random/fixed background image setter for wlroots based compositors Dependencies: The program depends on swaybg, python3-toml (or

Hemish 3 Mar 09, 2022
Small Python script to parse endlessh's output and print some neat statistics

endlessh_parser endlessh_parser is a small Python script that parses endlessh's output and prints some neat statistics about it Usage Install all the

ManicRobot 1 Oct 18, 2021
Customized python validations.

A customized python validations.

Wilfred V. Pine 2 Apr 20, 2022
Animation retargeting tool for Autodesk Maya. Retargets mocap to a custom rig with a few clicks.

Animation Retargeting Tool for Maya A tool for transferring animation data and mocap from a skeleton to a custom rig in Autodesk Maya. Installation: A

Joaen 63 Jan 06, 2023
✨ Un pierre feuille ciseaux totalement fait en Python par moi, et en français.

Pierre Feuille Ciseaux ❗ Un pierre feuille ciseaux totalement fait en Python par moi. 🔮 Avec l'utilisation du module "random", j'ai pu faire un choix

MrGabin 3 Jun 06, 2021
Color getter (including method to get random color or complementary color) made out of Python

python-color-getter Color getter (including method to get random color or complementary color) made out of Python Setup pip3 install git+https://githu

Jung Gyu Yoon 2 Sep 17, 2022
[P]ython [w]rited [B]inary [C]onverter

pwbinaryc [P]ython [w]rited [Binary] [C]onverter You have rights to: Modify the code and use it private (friends are allowed too) Make a page and redi

0 Jun 21, 2022
PyResToolbox - A collection of Reservoir Engineering Utilities

pyrestoolbox A collection of Reservoir Engineering Utilities This set of functio

Mark W. Burgoyne 39 Oct 17, 2022
A monitor than send discord webhook when a specific monitored product has stock in your nearby pickup stores.

Welcome to Apple In-store Monitor This is a monitor that are not fully scaled, and might still have some bugs.

5 Jun 16, 2022
Python 3 script unpacking statically x86 CryptOne packer.

Python 3 script unpacking statically x86 CryptOne packer. CryptOne versions: 2021/08 until now (2021/12)

5 Feb 23, 2022
💉 코로나 잔여백신 예약 매크로 커스텀 빌드 (속도 향상 버전)

Korea-Covid-19-Vaccine-Reservation 코로나 잔여 백신 예약 매크로를 기반으로 한 커스텀 빌드입니다. 더 빠른 백신 예약을 목표로 하며, 속도를 우선하기 때문에 사용자는 이에 대처가 가능해야 합니다. 지정한 좌표 내 대기중인 병원에서 잔여 백신

Queue.ri 21 Aug 15, 2022