Internet Name — make filenames safe and consistent for the web
Project description
iname — Internet Name
Make filenames safe and consistent for the web. One file at a time, composable with Unix pipes.
Install
pip install iname
Usage
# Rename a single file (default: web style with hyphens)
iname "My Photo (2).jpeg" # → my-photo-2.jpeg
# Preview without renaming
iname "My Photo (2).jpeg" --dry-run
# Different naming styles
iname "My Photo.jpeg" --style snake # → my_photo.jpeg
iname "My Photo.jpeg" --style kebab # → my-photo.jpeg
iname "My Photo.jpeg" --style camel # → myPhoto.jpeg
# Batch rename with find
find . -name "*.jpeg" | iname
# Chain with other tools
iname "My Photo.jpeg" | xargs ls -la
# Preview a batch
find . -name "*.JPEG" | iname --dry-run --verbose
Styles
| Style | Input | Output |
|---|---|---|
web (default) |
My Photo (2).jpeg |
my-photo-2.jpeg |
snake |
My Photo (2).jpeg |
my_photo_2.jpeg |
kebab |
My_Photo (2).jpeg |
my-photo-2.jpeg |
camel |
My Photo (2).jpeg |
myPhoto2.jpeg |
Behavior
- Stdout: always prints the new path (enables piping and chaining)
- Stderr:
--verboseprintsold → newmappings (doesn't interfere with pipes) - Collisions: auto-dedup with
-01,-02, ...-99suffix - Already safe: prints path unchanged, exits 0
- Exit codes: 0 = success, 1 = error, 2 = usage error
Safety
- Rejects symlinks
- Strips null bytes
- Normalizes Unicode whitespace (no-break spaces, narrow spaces)
- Truncates to filesystem NAME_MAX (255 bytes)
- Case-insensitive filesystem aware
Zero dependencies
iname uses only the Python standard library. No runtime dependencies.
Development
pip install -e '.[dev]'
pytest --cov=iname --cov-report=term-missing
Origin
Extracted from xplat — the proven rename logic, distilled into a single-purpose Unix tool.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iname-0.1.0.tar.gz.
File metadata
- Download URL: iname-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
888ee39fc7d10c9c572de302a51688bc46134ae8587fbbf9296023965a36b5b2
|
|
| MD5 |
fded7122ad738608c66691c87dc82786
|
|
| BLAKE2b-256 |
f5063ac91319943d9e6265ceb0e573e166d26e0ffed20c86c533768d07a44501
|
File details
Details for the file iname-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iname-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3db0662c6dbc8d00325932017490e0ea756ff6b215f1bd6ed804edffc5926810
|
|
| MD5 |
2b56e006a734e91213f81cc6dd3e50e5
|
|
| BLAKE2b-256 |
4613acd0cc4b03d2adcb1467ed45c802a73bfef6c577c479c26f1a68a2a91805
|