casefy


Namecasefy JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryUtilities for string case conversion.
upload_time2024-11-30 10:00:59
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT License Copyright (c) 2022 Diego Miguel Lozano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords case case-converter casefy casing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center"><img width="400" src="https://github.com/dmlls/python-casefy/blob/main/docs/source/_static/images/cover.png" alt="Casefy"/></p>
<p align="center" display="inline-block">
  <a href="https://docs.jizt.it">
    <a href="https://pypi.org/project/casefy/">
      <img src="https://img.shields.io/pypi/v/casefy"/>
    </a>
    <a href="https://deepsource.io/gh/dmlls/python-casefy/?ref=repository-badge}" target="_blank">
      <img alt="Active Issues" title="DeepSource" src="https://deepsource.io/gh/dmlls/python-casefy.svg/?label=active+issues&token=dbO3UyrUPWvJp6K_PVZpTcnU"/>
    </a>
  </a>
</p>

## Introduction

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

<br>

## Installation

The latest release can be installed using
[pip](https://pypi.org/project/casefy/):

```shell
pip install -U casefy
```

Casefy is also [available](https://aur.archlinux.org/packages/python-casefy) as
an Arch Linux AUR package.

<br>

## Examples

Note: for more details, you can check the [API
Reference](https://dmlls.github.io/python-casefy/api.html).

```python
import casefy

# Alphanum3ric case (removes non-alphanumeric chars)
string = casefy.alphanumcase("foo - 123 ; bar!")
print(string)  # foo123bar

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

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

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

# Capital Case
string = casefy.capitalcase("fooBar")
print(string)  # FooBar

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

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

# lowercase
string = casefy.lowercase("fooBar")
print(string)  # foobar

# PascalCase
string = casefy.pascalcase("foo_bar")
print(string)  # FooBar

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

# Sentence case
string = casefy.sentencecase("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

# 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

# Title Case
string = casefy.titlecase("fooBarBaz")
print(string)  # Foo Bar Baz

# UPPERCASE
string = casefy.uppercase("fooBar")
print(string)  # FOOBAR

# UPPER-KEBAB-CASE
string = casefy.upperkebabcase("fooBar")
print(string)  # FOO-BAR
```

<br>

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

<br>

## Acknowledgements

This project started when I saw that the package
[`python-stringcase`](https://aur.archlinux.org/pkgbase/python-stringcase) was
flagged-out-of-date in the Arch AUR Repository. The project
[stringcase](https://github.com/okunishinishi/python-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](https://github.com/okunishinishi) (author of stringcase) and its
contributors for their work.

<br>

## Related projects

- [`case-conversion`](https://github.com/AlejandroFrias/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](https://github.com/jpvanhal/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.

<br>

## License
Casefy is distributed under the
[MIT](https://github.com/dmlls/python-casefy/blob/main/LICENSE) license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "casefy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "Diego Miguel Lozano <hello@diegomiguel.me>",
    "keywords": "case, case-converter, casefy, casing",
    "author": null,
    "author_email": "Diego Miguel Lozano <hello@diegomiguel.me>",
    "download_url": "https://files.pythonhosted.org/packages/bf/50/f5991618899c42d0c6339bd83fed5f694f56b204dfb3f2a052f0d586d4c5/casefy-1.0.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\"><img width=\"400\" src=\"https://github.com/dmlls/python-casefy/blob/main/docs/source/_static/images/cover.png\" alt=\"Casefy\"/></p>\n<p align=\"center\" display=\"inline-block\">\n  <a href=\"https://docs.jizt.it\">\n    <a href=\"https://pypi.org/project/casefy/\">\n      <img src=\"https://img.shields.io/pypi/v/casefy\"/>\n    </a>\n    <a href=\"https://deepsource.io/gh/dmlls/python-casefy/?ref=repository-badge}\" target=\"_blank\">\n      <img alt=\"Active Issues\" title=\"DeepSource\" src=\"https://deepsource.io/gh/dmlls/python-casefy.svg/?label=active+issues&token=dbO3UyrUPWvJp6K_PVZpTcnU\"/>\n    </a>\n  </a>\n</p>\n\n## Introduction\n\nCasefy (/ke\u026asfa\u026a/) is a lightweight Python package to convert the casing of\nstrings. It has no third-party dependencies and supports Unicode.\n\n<br>\n\n## Installation\n\nThe latest release can be installed using\n[pip](https://pypi.org/project/casefy/):\n\n```shell\npip install -U casefy\n```\n\nCasefy is also [available](https://aur.archlinux.org/packages/python-casefy) as\nan Arch Linux AUR package.\n\n<br>\n\n## Examples\n\nNote: for more details, you can check the [API\nReference](https://dmlls.github.io/python-casefy/api.html).\n\n```python\nimport casefy\n\n# Alphanum3ric case (removes non-alphanumeric chars)\nstring = casefy.alphanumcase(\"foo - 123 ; bar!\")\nprint(string)  # foo123bar\n\n# camelCase\nstring = casefy.camelcase(\"foo_bar\")\nprint(string)  # fooBar\n\nstring = casefy.camelcase(\"FooBar\")\nprint(string)  # fooBar\n\nstring = casefy.camelcase(\"FOO BAR\")\nprint(string)  # fooBar\n\n# Capital Case\nstring = casefy.capitalcase(\"fooBar\")\nprint(string)  # FooBar\n\n# CONST_CASE\nstring = casefy.constcase(\"fooBar\")\nprint(string)  # FOO_BAR\n\n# kebab-case\nstring = casefy.kebabcase(\"fooBar\")\nprint(string)  # foo-bar\n\n# lowercase\nstring = casefy.lowercase(\"fooBar\")\nprint(string)  # foobar\n\n# PascalCase\nstring = casefy.pascalcase(\"foo_bar\")\nprint(string)  # FooBar\n\nstring = casefy.pascalcase(\"fooBar\")\nprint(string)  # FooBar\n\n# Sentence case\nstring = casefy.sentencecase(\"fooBar\")\nprint(string)  # Foo bar\n\n# Separator case\nstring = casefy.separatorcase(\"fooBar\", separator=\"/\")\nprint(string)  # foo/bar\n\nstring = casefy.separatorcase(\"fooBARbaz\", separator=\"%\", keep_together=[\"bar\"])\nprint(string)  # foo%bar%baz\n\n# snake_case\nstring = casefy.snakecase(\"fooBar\")\nprint(string)  # foo_bar\n\nstring = casefy.snakecase(\"fooBARbaz\", keep_together=[\"bar\"])\nprint(string)  # foo_bar_baz\n\nstring = casefy.snakecase(\"FOO BAR\")\nprint(string)  # foo_bar\n\n# Title Case\nstring = casefy.titlecase(\"fooBarBaz\")\nprint(string)  # Foo Bar Baz\n\n# UPPERCASE\nstring = casefy.uppercase(\"fooBar\")\nprint(string)  # FOOBAR\n\n# UPPER-KEBAB-CASE\nstring = casefy.upperkebabcase(\"fooBar\")\nprint(string)  # FOO-BAR\n```\n\n<br>\n\n## Contribute\nIf you find a bug, please open an issue. Pull Requests are also welcome!\n\n<br>\n\n## Acknowledgements\n\nThis project started when I saw that the package\n[`python-stringcase`](https://aur.archlinux.org/pkgbase/python-stringcase) was\nflagged-out-of-date in the Arch AUR Repository. The project\n[stringcase](https://github.com/okunishinishi/python-stringcase) seems not to be\nactively maintained anymore, so I decided to address its issues and pull\nrequests and solve them in this new package. I kept the API as similar as\npossible, in order to facilitate any possible migration. I thank [Taka\nOkunishi](https://github.com/okunishinishi) (author of stringcase) and its\ncontributors for their work.\n\n<br>\n\n## Related projects\n\n- [`case-conversion`](https://github.com/AlejandroFrias/case-conversion) offers\n  a very similar functionality as this project. I probably wouldn't have written\n  this package if I had known of it before. However, the code of Casefy is more\n  lightweight and just enough for most cases. If you need more functionality,\n  e.g., detecting the case of a string, go with `case-conversion`.\n\n- [Inflection](https://github.com/jpvanhal/inflection) presents some overlap\n  with this project as well, allowing the transformation of strings from\n  CamelCase to underscored_string, but also singularizing and pluralizing\n  English words.\n\n<br>\n\n## License\nCasefy is distributed under the\n[MIT](https://github.com/dmlls/python-casefy/blob/main/LICENSE) license.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Diego Miguel Lozano  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Utilities for string case conversion.",
    "version": "1.0.0",
    "project_urls": {
        "Documentation": "https://dmlls.github.io/python-casefy/",
        "GitHub Issues": "https://github.com/dmlls/python-casefy/issues",
        "GitHub Repo": "https://github.com/dmlls/python-casefy/",
        "Homepage": "https://github.com/dmlls/python-casefy"
    },
    "split_keywords": [
        "case",
        " case-converter",
        " casefy",
        " casing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9bb6797c17fe4804896836ef33b447f0a2641d59a8d1d63e63834fb3fbc87cd8",
                "md5": "6dc48f2b2b4a3c75462a6566778bc3cd",
                "sha256": "c89f96fb0fbd13691073b7a65c1e668e81453247d647479a3db105e86d7b0df9"
            },
            "downloads": -1,
            "filename": "casefy-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6dc48f2b2b4a3c75462a6566778bc3cd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6299,
            "upload_time": "2024-11-30T10:00:33",
            "upload_time_iso_8601": "2024-11-30T10:00:33.134184Z",
            "url": "https://files.pythonhosted.org/packages/9b/b6/797c17fe4804896836ef33b447f0a2641d59a8d1d63e63834fb3fbc87cd8/casefy-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf50f5991618899c42d0c6339bd83fed5f694f56b204dfb3f2a052f0d586d4c5",
                "md5": "f5a80984382ed643138487b35870b35a",
                "sha256": "bc99428475c2089c5f6a21297b4cfe4e83dff132cf3bb06655ddcb90632af1ed"
            },
            "downloads": -1,
            "filename": "casefy-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f5a80984382ed643138487b35870b35a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 123432,
            "upload_time": "2024-11-30T10:00:59",
            "upload_time_iso_8601": "2024-11-30T10:00:59.015485Z",
            "url": "https://files.pythonhosted.org/packages/bf/50/f5991618899c42d0c6339bd83fed5f694f56b204dfb3f2a052f0d586d4c5/casefy-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-30 10:00:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dmlls",
    "github_project": "python-casefy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "casefy"
}
        
Elapsed time: 6.60688s