Registry / type-stubs / types-python-slugify

types-python-slugify

JSON →
library8.0.2.20240310pypypi✓ verified 25d ago

This package provides typing stubs for the `python-slugify` library, enabling static type checkers like MyPy or Pyright to validate usage of `python-slugify`. It does not contain any executable code itself. The current version is 8.0.2.20240310. As part of the typeshed project, its releases are typically tied to updates in the upstream `python-slugify` library or typeshed's own update cadence.

pip install types-python-slugify
INSTALL
IMPORT
SIG · TYPES-PYTHON-SLUGI
T
types-python-slugify
type-stubspythonv8.0.2.20240310
Install
1.6s avg
Import
90ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v8.0.2.20240310 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.092s · 18.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.088s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

slugify
from slugify import slugify
from slugify-stubs import slugify

This quickstart demonstrates how to use `python-slugify` with type checking enabled by `types-python-slugify`. It shows basic slug generation and creating a custom `Slugify` instance. To use these stubs, both `python-slugify` and `types-python-slugify` must be installed. A type checker like MyPy will then automatically leverage these stubs for static analysis.

import os # Install both packages: pip install python-slugify types-python-slugify from slugify import slugify, Slugify def process_title(title: str) -> str: """Converts a title to a URL-friendly slug.""" # Type checkers (like MyPy) will use types-python-slugify here return slugify(title) def create_custom_slugifier() -> Slugify: """Creates a custom slugifier instance.""" # Example of using the Slugify class, also type-checked return Slugify(to_lower=True, separator='_') # --- Example Usage --- # Basic slugification original_text = "My Awesome Article Title!" slugged_text = process_title(original_text) print(f"Original: '{original_text}'\nSlugged: '{slugged_text}'") # Using a custom slugifier custom_slg = create_custom_slugifier() custom_slugged = custom_slg("Another-Example String") print(f"Custom slugged: '{custom_slugged}'") # To verify type checking, run `mypy your_script_name.py` # For example, calling process_title(123) would raise a type error.
Debug
Known issues
gotcha`types-python-slugify` is a stub-only package. It does not contain any runnable code or provide the `slugify` function/class directly. You must install the actual `python-slugify` library to use the functionality.
fix
Ensure you install `python-slugify` in addition to `types-python-slugify` (e.g., `pip install python-slugify types-python-slugify`) and import symbols directly from `slugify`.
affects: All versions
gotchaDo not attempt to import `slugify` or `Slugify` from `types_python_slugify` (or any variation of the stub package name). Imports should always come from `from slugify import ...` which refers to the runtime library.
fix
Always use `from slugify import slugify` or `from slugify import Slugify` for importing the functionality. The stub package is automatically picked up by type checkers.
affects: All versions
gotchaThe versioning of `types-python-slugify` (e.g., `8.0.2.20240310`) includes a typeshed timestamp (`20240310`). While the `8.0.2` often aligns with the `python-slugify` library version, minor updates to stubs may occur independently of `python-slugify`'s point releases.
fix
While generally compatible, be aware that exact version alignment between the runtime library and its stubs is not guaranteed for every patch release. For critical applications, verify compatibility with your specific `python-slugify` version.
affects: All versions
Upgrade
Version history
8.0.2.20240310latest on PyPI · released Mar 10, 2024
Audit
Dependencies
python-slugifyrequiredProvides the runtime implementation for which these stubs are supplied.
Agent activity
41 hits · last 30 days
node
36
OpenAI (training)
1
Resources
types-python-slugify — pip install types-python-slugify · libregistry