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
Metadata
Release files for pyinitials 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyinitials-1.0.1.tar.gz | 4.1 kB | Without provenance | Details for pyinitials-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyinitials-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pyinitials-1.0.1-py3-none-any.whl |
Total release size: 8.7 kB
Release files / pyinitials-1.0.1.tar.gz
| Download URL | pyinitials-1.0.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e018f1486550a0469a95f1a7d7074a8f20d7743a813219af8e9dd881585cb38
|
|
BLAKE2b-256 checksum How to use checksums |
decc24a911f34cbdeac23513b34215a18d3a2eb1b3c7310fbcb0f97b0ad7c1b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.13.1 Darwin/24.1.0
|
Release files / pyinitials-1.0.1-py3-none-any.whl
| Download URL | pyinitials-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
564d3e88498f17e31b5fa8b15a6f33063e2dfa5f3acf88876357331f28c181ec
|
|
BLAKE2b-256 checksum How to use checksums |
1f924f08daa8389ad0694c2ba5b380d450af0e824a18f98c8c09df3afc83b882
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.13.1 Darwin/24.1.0
|
Security for pyinitials 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.