Skip to content
/ pypub Public
forked from wcember/pypub

Python 3 and 2 library to programatically create epub files

License

Notifications You must be signed in to change notification settings

clach04/pypub

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pypub

Create epub (version 2) files using python. Pypub is a python library to create epub files quickly without having to worry about the intricacies of the epub specification.

Installation

The current release of pypub is available through pip:

$ pip install pypub

Pypub is compatible with Python 2.7 and known to work with Python 3.10.

Quickstart

>>> import pypub
>>> my_first_epub = pypub.Epub('My First Epub')
>>> my_first_chapter = pypub.create_chapter_from_url('https://en.wikipedia.org/wiki/EPUB')
>>> my_first_epub.add_chapter(my_first_chapter)
>>> my_first_epub.create_epub('OUTPUT_DIRECTORY')

Features

  • Pypub is easy to install and has minimal dependencies.
  • Pypub abstracts the epub specification. Create epubs without worrying about what an NCX is.
  • Pypub can create epubs from websites, html files, strings, or a combination of all three.
  • Pypub can clean up poorly formatted and complicated html so it will cleanly as a chapter in your book.
  • Pypub creates epubs specifically so they can be converted into Amazon Kindle mobi or azw3 files. Don't know which tags Amazon supports? Don't worry about it because pypub does.
  • Pypub is customizable. Don't like the way pypub sanitizes html files for you ebook? Pypub can be configured with your own sanitation function.
  • Pypub is licensed under the MIT license. Do what you want with it.

Documentation

Documentation is available at http://pypub.readthedocs.org/en/latest/developer_interface.html

Dev Setup

To use code from a source code checkout from git

$ python -m pip install -r requirements.txt

Running Tests

Issue:

python -m pypub.unit_tests_chapter
python -m pypub.unit_tests_clean
python -m pypub.unit_tests_epub
python -m pypub.unit_tests_image

There is no way to run all tests (with stdlib).

Useful Resources

Copyright and License

Copyright (c) 2020 William Cember

Licensed under the MIT License

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Python 3 and 2 library to programatically create epub files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 95.5%
  • Python 4.5%