Skip to content

Latest commit

 

History

History
102 lines (80 loc) · 2.98 KB

CONTRIBUTING.md

File metadata and controls

102 lines (80 loc) · 2.98 KB

Developer Documentation

These instructions are for developers working on the python-libzim source code itself. If you are simply a user of the library and you don't intend to change its internal source code, follow the User Documentation instructions above instead.

Setup: Ubuntu/Debian

Note: Make sure you've installed libzim dylib + headers first (see above).

apt install coreutils wget git ca-certificates \
        g++ pkg-config libtool automake autoconf make meson ninja-build \
        liblzma-dev zlib1g-dev libicu-dev libgumbo-dev libmagic-dev

pip3 install --upgrade pip pipenv

export CFLAGS="-I${LIBZIM_DIR}/include"
export LDFLAGS="-L${LIBZIM_DIR}/lib/x86_64-linux-gnu"
git clone https://github.com/openzim/python-libzim
cd python-libzim
python setup.py build_ext
pipenv install --dev
pipenv run pip install -e .

Common Tasks

Run Linters & Tests

# Check format and linting
invoke check
# Autoformat and import sorting
invoke lint
# Typecheck with mypy (optional)
mypy .
# Run tests
invoke test

Rebuild Cython extension during development

rm libzim/libzim.cpp
rm -Rf build
rm -Rf *.so
python setup.py build_ext
python setup.py install

Build package sdist and bdist_wheels for PyPI

python setup.py build_ext
python setup.py sdist bdist_wheel

# upload to PyPI (caution: this is done automatically via Github Actions)
twine upload dist/*

Use a specific libzim dylib and headers when compiling python-libzim

export CFLAGS="-I${LIBZIM_DIR}/include"
export LDFLAGS="-L${LIBZIM_DIR}/lib/x86_64-linux-gnu"
export LD_LIBRARY_PATH="${LIBZIM_DIR}/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
python setup.py build_ext
python setup.py install

Further Reading

Related Projects

Research

Debugging

Packaging