Helper functions

Snakehouse contains a bunch of functions to help you with everyday work. They are meant to be primarily used in your setup.py.

Finding files

Instead of manually specifying list of pyx and c files to compile you can use the following functions:

snakehouse.find_pyx(directory_path: str) List[str]

Return all .pyx files found in given directory.

Parameters:

directory_path – directory to look through

Returns:

.pyx files found

snakehouse.find_c(directory_path: str) List[str]

Return all .c files found in given directory.

Parameters:

directory_path – directory to look through

Returns:

.c files found

snakehouse.find_pyx_and_c(directory_path: str) List[str]

Return a list of all .pyx and .c files found in given directory.

Parameters:

directory_path

Returns:

list of all .pyx and .c files found in given directory

Specifying requirements

If you add a MANIFEST.in file with contents:

include requirements.txt

Then you can write the following in your setup.py:

from snakehouse import read_requirements_txt

setup(install_requires=read_requirements_txt())
snakehouse.read_requirements_txt(path: str = 'requirements.txt')

Read requirements.txt and parse it into a list of packages as given by setup(install_required=).

This means it will read in all lines, discard empty and commented ones, and discard all those who are an URL.

Remember to include your requirements.txt inside your MANIFEST.in!

Parameters:

path – path to requirements.txt. Default is requirements.txt.

Returns:

list of packages ready to be fed to setup(install_requires=)