This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Integrate PyHyphen into the textwrap module?
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: elsiehupp, eric.smith, rhettinger, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2021-08-18 03:58 by elsiehupp, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7)
msg399819 - (view) Author: Elsie Hupp (elsiehupp) Date: 2021-08-18 03:58
PyHyphen is a mature library that wraps the existing CPython `textwrap` module and provides the ability to break and hyphenate words in wrapped text.

PyHyphen is on PyPI here:

https://pypi.org/project/PyHyphen/

And on GitHub here:

https://github.com/dr-leo/PyHyphen

While the PyPI page and the README file say that PyHyphen uses an Apache 2.0 License, the GitHub repository says that it uses a GPL 2.0/LGPL 2.1/MPL 1.1 tri-license:

https://github.com/dr-leo/PyHyphen/blob/master/LICENSE.txt

To what extent would it be feasible to integrate PyHyphen's enhancements into the core `textwrap` module? It is my understanding that the `textwrap` itself began life as a third-party module, which would suggest that such integrations are somewhat precedented.

I'm not experienced enough to know how to do a pull request myself, and I don't understand the legal details well enough to know if PyHyphen is license-compatible with CPython.
msg399842 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-08-18 13:06
Thank you for the suggestion.

Hyphenation seems like a niche requirement to me, probably too niche and with too many design decisions to include it in the stdlib. It's also not clear to my why PyHyphen would be the best option for this, as opposed to the other hyphenation libraries on PyPI. You'll need to address both of these issues as part of any proposal.

I suggest you bring this up on the python-ideas mailing list in order to get a broader discussion.
msg399854 - (view) Author: Elsie Hupp (elsiehupp) Date: 2021-08-18 16:42
I mainly suggested PyHyphen because (at a fairly superficial glance) it has been around for over a decade, and it extends an existing module rather than adding a new one. To be fair, `textwrap` itself is relatively niche, and it's my understanding that it's also a relatively recent addition to the standard library.

I can repost this this to the mailing list, though I'll probably do some more digging first.
msg399861 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-08-18 18:27
Many years ago I write highly optimized hyphenation module (as a part of OrnamentBook project https://sourceforge.net/projects/pybookreader/files/OrnamentBook/). I could contribute the code to the stdlib. But the problem is that the algorithm depends on language specific data files. I am not sure that we are ready to include these files in the stdlib. And how are we going to handle requests for support of new languages and how to validate contributed data files for unknown new languages?
msg400002 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-08-20 22:47
This strikes me as an example of the sort of thing that should not be in the stdlib.  'Correct' behavior is a matter of opinion and the language being hyphenated.  I recommend rejecting.
msg400004 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-08-21 00:26
I concur with Terry.  The suggestion is nice but it belongs outside the standard library.
msg400011 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-08-21 03:16
I agree this doesn’t belong in the stdlib. For future reference, my principal objections are 1) the need to manage and distribute per-language dictionaries and 2) difficulty in determining the best algorithm for the stdlib. There are a lot of ways to tweak this. The community is well served with the multiple libraries on PyPI.
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 89106
2021-08-21 03:16:58eric.smithsetmessages: + msg400011
2021-08-21 00:26:26rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg400004

resolution: rejected
stage: resolved
2021-08-20 22:47:07terry.reedysetnosy: + terry.reedy

messages: + msg400002
versions: + Python 3.11, - Python 3.7
2021-08-18 18:27:45serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg399861
2021-08-18 16:42:10elsiehuppsetmessages: + msg399854
2021-08-18 13:06:53eric.smithsetnosy: + eric.smith
messages: + msg399842
components: + Library (Lib)
2021-08-18 03:58:11elsiehuppcreate