Skip to main content

PyInitials, because GvR is shorter than Guido van Rossum

from pyinitials import initials

print(initials('Guido van Rossum')) # prints "GvR"

main

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

ISC

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)

Source distribution for pyinitials 1.0.1
File Size Uploaded
pyinitials-1.0.1.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyinitials 1.0.1
File Interpreter ABI Platform
pyinitials-1.0.1-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page