No project description provided
Project description
PyInitials, because GvR is shorter than Guido van Rossum
from pyinitials import initials
print(initials('Guido van Rossum')) # prints "GvR"
This project is a Python clone of the JavaScript initials package.
Installation
Install from PyPi, for example with Poetry:
poetry add pyinitials
Usage
from pyinitials import initials, find, parse, add_to
initials('John Doe') # 'JD'
initials(['John Doe', 'Robert Roe']) # ['JD', 'RR']
# alias for initials('John Doe')
find('John Doe') # 'JD'
parse('John Doe') # Parts(name='John Doe', initials='JD', email=None)
# add initials to name(s)
add_to('John Doe') # 'John Doe (JD)'
# Pass existing initials for names
initials(['John Doe', 'Jane Dane'], existing={'John Doe': 'JD'}) # ['JD', 'JDa']
Notes
Preffered initials can be passed in (JD), e.g.
initials('John Doe (JoDo)') # 'JoDo'
If a name contains an email, it gets ignored when calculating initials
initials('John Doe joe@example.com') # 'JD'
If a name is an email, the domain part gets ignored
initials('joe@example.com') # 'jo'
When passing an Array of names, duplicates of initials are avoided
initials(['John Doe', 'Jane Dane']) # ['JDo', 'JDa']
Build and test
Install dependencies:
poetry install
Run the unit-tests:
poetry run pytest
LICENSE
Project details
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 pyinitials-1.0.1.tar.gz.
File metadata
- Download URL: pyinitials-1.0.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e018f1486550a0469a95f1a7d7074a8f20d7743a813219af8e9dd881585cb38
|
|
| MD5 |
a99a2f593e526c2f22891e31a7d773f1
|
|
| BLAKE2b-256 |
decc24a911f34cbdeac23513b34215a18d3a2eb1b3c7310fbcb0f97b0ad7c1b8
|
File details
Details for the file pyinitials-1.0.1-py3-none-any.whl.
File metadata
- Download URL: pyinitials-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
564d3e88498f17e31b5fa8b15a6f33063e2dfa5f3acf88876357331f28c181ec
|
|
| MD5 |
ba1df3a7ccb9a3f78a445fa5d979cecd
|
|
| BLAKE2b-256 |
1f924f08daa8389ad0694c2ba5b380d450af0e824a18f98c8c09df3afc83b882
|