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
pyinitials-1.0.0.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file pyinitials-1.0.0.tar.gz
.
File metadata
- Download URL: pyinitials-1.0.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/20.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 438cdff55c966e2512b4064556e69bfdd2931ced7a0f5ff56ff36433c40466ff |
|
MD5 | 147ef129dc5433f1aee4540a5c917e3b |
|
BLAKE2b-256 | b55e3cc31653c5d70a3b808dd746b05707688fe3c45ecd60e34a845781609eb7 |
File details
Details for the file pyinitials-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyinitials-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/20.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac75d10dc06e939abd4c98494f651a2777c5098756d5fc6900ede80648bb2caa |
|
MD5 | 547547c632c3f72ec0d649bdb9bfe38c |
|
BLAKE2b-256 | 879c1ec69136d1395d78ad83815254611ba750db46f3068487c9f07824a02168 |