{"id":1970,"library":"coolname","title":"Random Name and Slug Generator","description":"coolname is a Python library for generating random, human-readable names and slugs. It offers various functionalities, including generating names as sequences of words, creating slugs for use in web applications like Django, and generating names of specific lengths. The current version is 4.1.0, and it maintains an active development and release cadence.","status":"active","version":"4.1.0","language":"en","source_language":"en","source_url":"https://github.com/alexanderlukanin13/coolname","tags":["name-generator","slug","random","utility","string-generation"],"install":[{"cmd":"pip install coolname","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Requires Python 3.10 or higher.","package":"Python","optional":false}],"imports":[{"symbol":"generate_slug","correct":"from coolname import generate_slug"},{"symbol":"generate","correct":"from coolname import generate"},{"note":"Used for advanced customization with custom word lists and rules.","symbol":"RandomGenerator","correct":"from coolname import RandomGenerator"}],"quickstart":{"code":"from coolname import generate_slug, generate, RandomGenerator\n\n# Generate a random slug (default length, often 4 words)\nprint(f\"Random slug: {generate_slug()}\")\n\n# Generate a slug with a specific number of words\nprint(f\"2-word slug: {generate_slug(2)}\")\nprint(f\"3-word slug: {generate_slug(3)}\")\n\n# Generate a name as a list of words\nname_words = generate()\nprint(f\"Random name (list): {name_words}\")\nprint(f\"Joined name: {' '.join(name_words)}\")\n\n# Example of custom generator with custom word lists\ncustom_generator = RandomGenerator({\n    'all': {\n        'type': 'cartesian',\n        'lists': ['adjectives', 'animals']\n    },\n    'adjectives': {\n        'type': 'words',\n        'words': ['quick', 'sleepy', 'bright']\n    },\n    'animals': {\n        'type': 'words',\n        'words': ['fox', 'panda', 'owl']\n    }\n})\nprint(f\"Custom generated slug: {custom_generator.generate_slug()}\")","lang":"python","description":"This quickstart demonstrates basic usage of `generate_slug` for creating slugs (with default and specified lengths), `generate` for creating word lists, and an example of advanced customization using `RandomGenerator`."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or later.","message":"The `coolname` library requires Python 3.10 or newer. Installing on older Python versions will fail.","severity":"breaking","affected_versions":"<4.1.0 (requires >=3.10)"},{"fix":"Explicitly pass the desired word count to `generate_slug(count)` for predictable length.","message":"Calling `generate_slug()` without arguments returns a name of random length, with a higher probability for 4-word names. If you require a consistent number of words, always specify the length (e.g., `generate_slug(2)`). Prepositions and articles ('of', 'from', 'the') are not counted towards the specified word length.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the GitHub README for examples on configuring `RandomGenerator` with custom dictionaries and rules.","message":"Customizing word lists or generation rules requires using the `RandomGenerator` class and defining a configuration dictionary. This is more involved than using the simpler `generate()` or `generate_slug()` functions.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}