commoner


Namecommoner JSON
Version 0.4.2 PyPI version JSON
download
home_page
SummaryCommoner provides a set of common functions and classes for Python projects.
upload_time2023-03-12 02:58:20
maintainer
docs_urlNone
authoruncenter
requires_python>=3.11,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Commoner

[![PyPI](https://img.shields.io/pypi/v/commoner)](https://pypi.org/project/commoner/)
[![PyPI - License](https://img.shields.io/pypi/l/commoner)](https://pypi.org/project/commoner/)

Commoner provides a set of common functions and classes for Python projects.

## Installation

Commoner is available on PyPI and can be installed with `pip`:

Either run:
```sh
pip install commoner
```
or run:
```sh
python3 -m pip install commoner
```

## Usage

Commoner is a collection of common functions and classes that can be used in any Python project. It is not meant to be used as a standalone library, but rather as a collection of useful functions and classes that can be imported into other projects. The following is a list of the modules and classes that are available in Commoner:

* println() - Prints a line of text and then prints a specified number of newlines.
* printsln() - Prints a line of text without a newline at the end.
* printx() - Prints a line of text a specified number of times.
* typewriter() - Prints a line of text with a typewriter effect (one character at a time).
* random_string() - Generates a random string of a specified length.
* sort_dict_keys() - Sorts a dictionary by its keys.
* sort_dict_values() - Sorts a dictionary by its values.
* swap_keys_values() - Swaps the keys and values of a dictionary.
* reverse() - Reverses a list, string, or dictionary.

### Chalk

The Chalk class provides a set of methods for printing colored text using ANSI escape codes.

* bold(text) - Prints bold text.
* italic(text) - Prints italic text.
* underline(text) - Prints underlined text.
* red(text) - Prints red text.
* yellow(text) - Prints yellow text.
* green(text) - Prints green text.
* cyan(text) - Prints cyan text.
* blue(text) - Prints blue text.
* magenta(text) - Prints magenta text.
* white(text) - Prints white text.
* black(text) - Prints black text.

* set(color): Sets the text color to the specified color.
* reset(): Resets the text color to the default color.

### Wait

The Wait class provides a set of methods for printing a loading animation to the console.

* start() - Starts the loading animation.
* stop() - Stops the loading animation.
* wait(seconds): Waits for the specified amount of time.
* input(message, color): Waits for the user to press a key (with an optional message and optional color).

#### Progress

The Progress sub-class of Wait provides a set of methods for printing a progress bar to the console.

* Progress(total, character="#", reverse=False): Creates a new progress bar.
* Progress.start(message): Starts the progress bar (with an optional message).
* Progress.update(current, message): Updates the progress bar (with an optional message).
* Progress.finish(message): Finishes the progress bar (with an optional message).
* Progress.timed(seconds, character, message): Starts a progress bar that counts down from a specified amount of time.

For example:
```py
my_progress = Wait.Progress(100)
my_progress.start()
for i in range(100):
    run_some_code()
    my_progress.update(i + 1)
my_progress.finish()
```
or for a timed progress bar:
```py
my_progress = Wait.Progress.timed(10)
````

### Shout

The Shout class provides a set of methods for printing preconfigured messages to the console.

* warning(message) - Prints a warning message to the console (yellow text).
* error(message) - Prints an error message to the console (red text).
* success(message) - Prints a success message to the console (green text).
* info(message) - Prints an info message to the console (blue text).

### Text

The Text class is an extension of the str type with additional functionality.

* replace(old, new) - Replaces characters in the text.
* reverse() - Reverses the text.
* count(char) - Counts the number of times a character (or all characters) appear(s) in the text.
* to_snake() - Converts the text to snake case.
* to_camel() - Converts the text to camel case.
* to_pascal() - Converts the text to pascal case.
* to_kebab() - Converts the text to kebab case.
* to_actual_title() - Converts the text to an actual title (e.g. "this is a title" -> "This Is a Title").
* to_initials(case_sensitive) - Converts the text to initials (e.g. "this is a title" -> "T.I.a.T") (case sensitive by default).

### Console

The Console class provides a set of methods for interacting with the console.

* clear() - Clears the console.
* format(style) - Sets the text color to the specified color.

## License

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "commoner",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "uncenter",
    "author_email": "me@uncenter.org",
    "download_url": "https://files.pythonhosted.org/packages/de/87/600b05812fea513ff91a318cbceab7f5e71e7e5cec6ae984de95a2546af5/commoner-0.4.2.tar.gz",
    "platform": null,
    "description": "# Commoner\n\n[![PyPI](https://img.shields.io/pypi/v/commoner)](https://pypi.org/project/commoner/)\n[![PyPI - License](https://img.shields.io/pypi/l/commoner)](https://pypi.org/project/commoner/)\n\nCommoner provides a set of common functions and classes for Python projects.\n\n## Installation\n\nCommoner is available on PyPI and can be installed with `pip`:\n\nEither run:\n```sh\npip install commoner\n```\nor run:\n```sh\npython3 -m pip install commoner\n```\n\n## Usage\n\nCommoner is a collection of common functions and classes that can be used in any Python project. It is not meant to be used as a standalone library, but rather as a collection of useful functions and classes that can be imported into other projects. The following is a list of the modules and classes that are available in Commoner:\n\n* println() - Prints a line of text and then prints a specified number of newlines.\n* printsln() - Prints a line of text without a newline at the end.\n* printx() - Prints a line of text a specified number of times.\n* typewriter() - Prints a line of text with a typewriter effect (one character at a time).\n* random_string() - Generates a random string of a specified length.\n* sort_dict_keys() - Sorts a dictionary by its keys.\n* sort_dict_values() - Sorts a dictionary by its values.\n* swap_keys_values() - Swaps the keys and values of a dictionary.\n* reverse() - Reverses a list, string, or dictionary.\n\n### Chalk\n\nThe Chalk class provides a set of methods for printing colored text using ANSI escape codes.\n\n* bold(text) - Prints bold text.\n* italic(text) - Prints italic text.\n* underline(text) - Prints underlined text.\n* red(text) - Prints red text.\n* yellow(text) - Prints yellow text.\n* green(text) - Prints green text.\n* cyan(text) - Prints cyan text.\n* blue(text) - Prints blue text.\n* magenta(text) - Prints magenta text.\n* white(text) - Prints white text.\n* black(text) - Prints black text.\n\n* set(color): Sets the text color to the specified color.\n* reset(): Resets the text color to the default color.\n\n### Wait\n\nThe Wait class provides a set of methods for printing a loading animation to the console.\n\n* start() - Starts the loading animation.\n* stop() - Stops the loading animation.\n* wait(seconds): Waits for the specified amount of time.\n* input(message, color): Waits for the user to press a key (with an optional message and optional color).\n\n#### Progress\n\nThe Progress sub-class of Wait provides a set of methods for printing a progress bar to the console.\n\n* Progress(total, character=\"#\", reverse=False): Creates a new progress bar.\n* Progress.start(message): Starts the progress bar (with an optional message).\n* Progress.update(current, message): Updates the progress bar (with an optional message).\n* Progress.finish(message): Finishes the progress bar (with an optional message).\n* Progress.timed(seconds, character, message): Starts a progress bar that counts down from a specified amount of time.\n\nFor example:\n```py\nmy_progress = Wait.Progress(100)\nmy_progress.start()\nfor i in range(100):\n    run_some_code()\n    my_progress.update(i + 1)\nmy_progress.finish()\n```\nor for a timed progress bar:\n```py\nmy_progress = Wait.Progress.timed(10)\n````\n\n### Shout\n\nThe Shout class provides a set of methods for printing preconfigured messages to the console.\n\n* warning(message) - Prints a warning message to the console (yellow text).\n* error(message) - Prints an error message to the console (red text).\n* success(message) - Prints a success message to the console (green text).\n* info(message) - Prints an info message to the console (blue text).\n\n### Text\n\nThe Text class is an extension of the str type with additional functionality.\n\n* replace(old, new) - Replaces characters in the text.\n* reverse() - Reverses the text.\n* count(char) - Counts the number of times a character (or all characters) appear(s) in the text.\n* to_snake() - Converts the text to snake case.\n* to_camel() - Converts the text to camel case.\n* to_pascal() - Converts the text to pascal case.\n* to_kebab() - Converts the text to kebab case.\n* to_actual_title() - Converts the text to an actual title (e.g. \"this is a title\" -> \"This Is a Title\").\n* to_initials(case_sensitive) - Converts the text to initials (e.g. \"this is a title\" -> \"T.I.a.T\") (case sensitive by default).\n\n### Console\n\nThe Console class provides a set of methods for interacting with the console.\n\n* clear() - Clears the console.\n* format(style) - Sets the text color to the specified color.\n\n## License\n\nCommoner is licensed under the MIT License. See the LICENSE file for more information.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Commoner provides a set of common functions and classes for Python projects.",
    "version": "0.4.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "69016b38014bb14d5e9761cf3c297bdfa229ac0ae67fe93f3cda0df04500b9ef",
                "md5": "340da76eb6f15b3bef9e72d33657b39c",
                "sha256": "d40f91b2956d8d320be659d0fd662254d90d75b0503adb02e382e1b17ec60b91"
            },
            "downloads": -1,
            "filename": "commoner-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "340da76eb6f15b3bef9e72d33657b39c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 10511,
            "upload_time": "2023-03-12T02:58:18",
            "upload_time_iso_8601": "2023-03-12T02:58:18.416807Z",
            "url": "https://files.pythonhosted.org/packages/69/01/6b38014bb14d5e9761cf3c297bdfa229ac0ae67fe93f3cda0df04500b9ef/commoner-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de87600b05812fea513ff91a318cbceab7f5e71e7e5cec6ae984de95a2546af5",
                "md5": "b0ad673807271a9741d80daf9ed08c62",
                "sha256": "48d838481724480cafc502dab6a53b78723d1331d2f40fcfc5dc39426ef1e226"
            },
            "downloads": -1,
            "filename": "commoner-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b0ad673807271a9741d80daf9ed08c62",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 9699,
            "upload_time": "2023-03-12T02:58:20",
            "upload_time_iso_8601": "2023-03-12T02:58:20.117554Z",
            "url": "https://files.pythonhosted.org/packages/de/87/600b05812fea513ff91a318cbceab7f5e71e7e5cec6ae984de95a2546af5/commoner-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-12 02:58:20",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "commoner"
}
        
Elapsed time: 0.04321s