namecase


Namenamecase JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/makukha/namecase
SummaryNaming case conventions parsing and converting tool.
upload_time2024-07-28 21:44:39
maintainerNone
docs_urlNone
authorMichael Makukha
requires_python!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7
licenseMIT
keywords case convert naming camel case pascal case snake case kebab case all caps screaming snake case
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # namecase
[![license](https://img.shields.io/github/license/makukha/namecase.svg)](https://github.com/makukha/namecase/blob/main/LICENSE)
![Coverage Status](https://raw.githubusercontent.com/makukha/namecase/0.3.3/docs/img/coverage-badge.svg)
[![pypi](https://img.shields.io/pypi/v/namecase.svg)](https://pypi.python.org/pypi/namecase)
[![versions](https://img.shields.io/pypi/pyversions/namecase.svg)](https://github.com/pydantic/pydantic)

**Naming case conventions parsing and converting tool.**

Small and clean, fully typed, zero dependency pure Python 2.7 to 3.13 and probably above.

The package supports detection and conversion between cases:

* snake_case
* camelCase
* PascalCase
* kebab-case
* ALL_CAPS_CASE (aka SCREAMING_SNAKE_CASE)
* Title Case

and more to be added.


## Usage

```doctest
>>> from namecase import is_snake, to_snake

>>> text = 'Some-Title phrase'
>>> is_snake(text)
False
>>> to_snake(text)
'some_title_phrase'
```

### Command line tool

```bash
$ namecase --case allcaps "hi there"
HI_THERE
$ echo "hi_there\nsee you" | python -m namecase -c camel
hiThere
seeYou
```

### Supported cases

```doctest
>>> text = 'Some-Title phrase'
```

#### snake_case
```doctest
>>> from namecase import is_snake, to_snake
>>> to_snake(text)
'some_title_phrase'
>>> is_snake(to_snake(text))
True
```

#### camelCase
```doctest
>>> from namecase import is_camel, to_camel
>>> to_camel(text)
'someTitlePhrase'
>>> is_camel(to_camel(text))
True
```

#### PascalCase
```doctest
>>> from namecase import is_pascal, to_pascal
>>> to_pascal(text)
'SomeTitlePhrase'
>>> is_pascal(to_pascal(text))
True
```

#### kebab-case
```doctest
>>> from namecase import is_kebab, to_kebab
>>> to_kebab(text)
'some-title-phrase'
>>> is_kebab(to_kebab(text))
True
```

#### ALL_CAPS_CASE
```doctest
>>> from namecase import is_allcaps, to_allcaps
>>> to_allcaps(text)
'SOME_TITLE_PHRASE'
>>> is_allcaps(to_allcaps(text))
True
```

#### Title Case
```doctest
>>> from namecase import is_title, to_title
>>> to_title(text)
'Some Title Phrase'
>>> is_title(to_title(text))
True
```

### Separators

Phrase separators are non-word characters including underscore, and places where text case is changed from lower to upper. Digits are not treated as separators.

```doctest
>>> from namecase import words
>>> words('!some_reallyMESsy text--wit4Digits.3VeryWh3re--')
'some,really,ME,Ssy,text,wit4,Digits,3Very,Wh3re'
```

### Unicode

Only ASCII names are supported. Unicode support is planned.


## Development

### Mac OS X

Requires Docker and Homebrew.

```bash
git clone https://github.com/makukha/namecase.git
brew install go-task
task init
```

Testing:

```bash
task test
```

## Plans

* Add more test, explore edge cases
* Add Unicode support (write tests)
* Add more cases

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/makukha/namecase",
    "name": "namecase",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7",
    "maintainer_email": null,
    "keywords": "case, convert, naming, camel case, pascal case, snake case, kebab case, all caps, screaming snake case",
    "author": "Michael Makukha",
    "author_email": "m.makukha@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "# namecase\n[![license](https://img.shields.io/github/license/makukha/namecase.svg)](https://github.com/makukha/namecase/blob/main/LICENSE)\n![Coverage Status](https://raw.githubusercontent.com/makukha/namecase/0.3.3/docs/img/coverage-badge.svg)\n[![pypi](https://img.shields.io/pypi/v/namecase.svg)](https://pypi.python.org/pypi/namecase)\n[![versions](https://img.shields.io/pypi/pyversions/namecase.svg)](https://github.com/pydantic/pydantic)\n\n**Naming case conventions parsing and converting tool.**\n\nSmall and clean, fully typed, zero dependency pure Python 2.7 to 3.13 and probably above.\n\nThe package supports detection and conversion between cases:\n\n* snake_case\n* camelCase\n* PascalCase\n* kebab-case\n* ALL_CAPS_CASE (aka SCREAMING_SNAKE_CASE)\n* Title Case\n\nand more to be added.\n\n\n## Usage\n\n```doctest\n>>> from namecase import is_snake, to_snake\n\n>>> text = 'Some-Title phrase'\n>>> is_snake(text)\nFalse\n>>> to_snake(text)\n'some_title_phrase'\n```\n\n### Command line tool\n\n```bash\n$ namecase --case allcaps \"hi there\"\nHI_THERE\n$ echo \"hi_there\\nsee you\" | python -m namecase -c camel\nhiThere\nseeYou\n```\n\n### Supported cases\n\n```doctest\n>>> text = 'Some-Title phrase'\n```\n\n#### snake_case\n```doctest\n>>> from namecase import is_snake, to_snake\n>>> to_snake(text)\n'some_title_phrase'\n>>> is_snake(to_snake(text))\nTrue\n```\n\n#### camelCase\n```doctest\n>>> from namecase import is_camel, to_camel\n>>> to_camel(text)\n'someTitlePhrase'\n>>> is_camel(to_camel(text))\nTrue\n```\n\n#### PascalCase\n```doctest\n>>> from namecase import is_pascal, to_pascal\n>>> to_pascal(text)\n'SomeTitlePhrase'\n>>> is_pascal(to_pascal(text))\nTrue\n```\n\n#### kebab-case\n```doctest\n>>> from namecase import is_kebab, to_kebab\n>>> to_kebab(text)\n'some-title-phrase'\n>>> is_kebab(to_kebab(text))\nTrue\n```\n\n#### ALL_CAPS_CASE\n```doctest\n>>> from namecase import is_allcaps, to_allcaps\n>>> to_allcaps(text)\n'SOME_TITLE_PHRASE'\n>>> is_allcaps(to_allcaps(text))\nTrue\n```\n\n#### Title Case\n```doctest\n>>> from namecase import is_title, to_title\n>>> to_title(text)\n'Some Title Phrase'\n>>> is_title(to_title(text))\nTrue\n```\n\n### Separators\n\nPhrase separators are non-word characters including underscore, and places where text case is changed from lower to upper. Digits are not treated as separators.\n\n```doctest\n>>> from namecase import words\n>>> words('!some_reallyMESsy text--wit4Digits.3VeryWh3re--')\n'some,really,ME,Ssy,text,wit4,Digits,3Very,Wh3re'\n```\n\n### Unicode\n\nOnly ASCII names are supported. Unicode support is planned.\n\n\n## Development\n\n### Mac OS X\n\nRequires Docker and Homebrew.\n\n```bash\ngit clone https://github.com/makukha/namecase.git\nbrew install go-task\ntask init\n```\n\nTesting:\n\n```bash\ntask test\n```\n\n## Plans\n\n* Add more test, explore edge cases\n* Add Unicode support (write tests)\n* Add more cases\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Naming case conventions parsing and converting tool.",
    "version": "0.3.3",
    "project_urls": {
        "Homepage": "https://github.com/makukha/namecase",
        "Repository": "https://github.com/makukha/namecase"
    },
    "split_keywords": [
        "case",
        " convert",
        " naming",
        " camel case",
        " pascal case",
        " snake case",
        " kebab case",
        " all caps",
        " screaming snake case"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a19333c10cf531fb53ce4e9ddd0cc657a87683f42b21890edf66d421339e3d3a",
                "md5": "0d9a465e9c0140143c33f92fc43557df",
                "sha256": "fbc51edca62efd2d2f687d6865aed9fe4a7fe66e95eb534ab2a4f932e8395f1c"
            },
            "downloads": -1,
            "filename": "namecase-0.3.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0d9a465e9c0140143c33f92fc43557df",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7",
            "size": 4376,
            "upload_time": "2024-07-28T21:44:39",
            "upload_time_iso_8601": "2024-07-28T21:44:39.218177Z",
            "url": "https://files.pythonhosted.org/packages/a1/93/33c10cf531fb53ce4e9ddd0cc657a87683f42b21890edf66d421339e3d3a/namecase-0.3.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-28 21:44:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "makukha",
    "github_project": "namecase",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "namecase"
}
        
Elapsed time: 0.69823s