Code Monkey home page Code Monkey logo

didjvu4jsb's Introduction

Overview

didjvu uses the Gamera framework to separate foreground/background layers, which can be then encoded into a DjVu file.

Originally written by Jakub Wilk, ported to Python3 by Friedrich Froebel.

The intention of this fork is to make changes necessary to allow easy debugging with Thonny.

The ultimate goal is to understand the code enough to add some features to the program.

Prerequisites

The following software is required:

Additionally, one of the following libraries is needed for the --xmp option:

  • GExiv2 (≥ 0.12.2) + PyGI or
  • python-xmp-toolkit or
    • Due to the repository being archived, this backend might lead to issues. Starting at Python 3.12, distutils is not available anymore, thus breaking the (default) installation.
  • py3exiv2

Installation (by Friedrich Froebel)

The easiest way to install didjvu is from PyPI:

pip install didjvu

Alternatively, you can use didjvu without installing it, straight out of an unpacked source tarball or a VCS checkout.

It's also possible to install it from source for the current interpreter with:

pip install .

The man pages can be deployed using:

make install_manpage

By default, make install_manpage installs them to /usr/local/. You can specify a different installation prefix by setting the PREFIX variable, e.g.:

make install PREFIX="$HOME/.local"

Installation (Friedrich Froebel's answers to Janusz S. Bień)

Cf.

FriedrichFroebel#22

For now, Gamera has to be installed manually, due to the package on PyPI being outdated and only providing a Windows binary (see hsnr-gamera/gamera-4#65 where we try to improve this). For installing it, just follow the manual steps:

git clone [email protected]:hsnr-gamera/gamera-4.git cd gamera-4 python -m pip install . --verbose

Usually, you want to do everything in a virtual environment:

Create it: python3 -m virtualenv venv Enter it: source venv/bin/activate Use as the global environment, for example installing packages etc. To exit it: deactivate

venv is the stdlib module, virtualenv an alternative with more features: https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe

[ For python3 -m virtualenv venv I've got /usr/bin/python3: No module named virtualenv...]

Depending on your setup, you will have to install the corresponding OS or global Python package: https://packages.debian.org/bookworm/python3-virtualenv https://pypi.org/project/virtualenv/

Debugging with Thonny (Friedrich Froebel's answers to Janusz S. Bień)

FriedrichFroebel#23

[I had the virtual environment associated with Thonny and used it succesfully, but the association somehow vanished. I re-associated the environment following thonny/thonny#3014.]

FriedrichFroebel#24

The actual entry point is in didjvu/__main__.py - the installed bin/didjvu just points to the didjvu.__main__.main function. Nevertheless, you have to make sure that your sys.path is set correctly, as otherwise __main__.py might fail to run. Thus I would recommend to either go with the bin/didjvu file or with a custom didjvu.py file in the root directory of the repository:

from didjvu.__main__ import main

main()

from didjvu.didjvu import Main imports the internal main entry point

didjvu/didjvu/didjvu.py

Line 214 in 5adbf8b
class Main:

whose __init__ method starts the argument parsing and in

didjvu/didjvu/cli.py

Line 340 in 5adbf8b
return action(options)

calls the actual action (bundle, separate or encode).

In didjvu.didjvu import Main, the first didjvu is the outer package (which you can install using pip for example and corresponding to the didjvu directory). The second didjvu is the didjvu.py file in this directory, Main is the object to import, in this case the Main class.

About this fork (by Friedrich Froebel)

This repository is a port of the original repository to Python 3.

The process involved the 2to3 tool and manual fixes afterwards to get the existing tests to pass. Some of the error reports and fixes arising from the early porting process have been contributed by @rmast.

At the moment there are no plans to submit a pull request to the upstream repository, which would probably require some changes to my code as well. This is mostly due to the corresponding upstream issue being marked as wontfix: Issue #13.

I will try to keep this fork/port in sync with the upstream changes where necessary. Please note that I do not have any plans on implementing completely new features for now. Feature requests and bugs which can be reproduced in the original version as well should be reported at both places in the best case.

Differences from upstream (by Friedrich Froebel)

  • Package requires Python ≥ 3.6.
  • Drop old Gamera workarounds.
  • Migrate from nose to plain unittest stdlib module.
  • Conform to PEP8 coding style.
  • Use standardized setup.py-based installation.
  • Rename lib to didjvu and migrate didjvu binary to __main__.py and console script version.

didjvu4jsb's People

Contributors

jwilk avatar friedrichfroebel avatar jsbien avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.