diff options
-rw-r--r-- | README.md | 41 | ||||
-rw-r--r-- | bsie/utils/loading.py | 4 | ||||
-rw-r--r-- | doc/source/installation.rst | 34 | ||||
-rw-r--r-- | setup.py | 51 |
4 files changed, 106 insertions, 24 deletions
@@ -7,10 +7,38 @@ that information in a BSFS storage. ## Installation -You can install BSIE via pip: +You can install BSIE via pip. BSIE comes with support for various file formats. +For this, it needs to install many external packages. BSIE lets you control +which of these you want to install. Note that if you choose to not install +support for some file types, BSIE will show a warning and skip them. +All other formats will be processed normally. + +To install only the minimally required software, use: $ pip install --extra-index-url https://pip.bsfs.io bsie +To install all dependencies, use the following shortcut: + + $ pip install --extra-index-url https://pip.bsfs.io bsie[all] + +To install a subset of all dependencies, modify the extras part (``[image, preview]``) +of the follwing command to your liking: + + $ pip install --extra-index-url https://pip.bsfs.io bsie[image,preview] + +Currently, BSIE providesthe following extra flags: + +* image: Read data from image files. + Note that you may also have to install ``exiftool`` through your system's + package manager (e.g. ``sudo apt install exiftool``). +* preview: Create previews from a variety of files. + Note that support for various file formats also depends on what + system packages you've installed. You should at least install ``imagemagick`` + through your system's package manager (e.g. ``sudo apt install imagemagick``). + See [Preview Generator](https://github.com/algoo/preview-generator) for + more detailed instructions. +* features: Extract feature vectors from images. + ## Development @@ -23,9 +51,15 @@ Install bsie as editable from the git repository: $ git clone https://git.bsfs.io/bsie.git $ cd bsie - $ pip install -e . + $ pip install -e .[all] + +If you want to develop (*dev*), run the tests (*test*), edit the +documentation (*doc*), or build a distributable (*build*), +install bsfs with the respective extras (in addition to file format extras): -Install the following additional packages besides BSIE: + $ pip install -e .[dev,doc,build,test] + +Or, you can manually install the following packages besides BSIE: $ pip install coverage mypy pylint $ pip install rdflib requests types-PyYAML @@ -52,4 +86,3 @@ To build the documentation, run the following commands from the **doc folder**: $ make html $ xdg-open build/html/index.html - diff --git a/bsie/utils/loading.py b/bsie/utils/loading.py index 3c5c7c1..58202d1 100644 --- a/bsie/utils/loading.py +++ b/bsie/utils/loading.py @@ -22,14 +22,14 @@ def safe_load(module_name: str, class_name: str): module = importlib.import_module(module_name) except Exception as err: # cannot import module - raise errors.LoaderError(f'cannot load module {module_name}') from err + raise errors.LoaderError(f'cannot load module {module_name} ({err})') from err try: # get the class from the module cls = getattr(module, class_name) except Exception as err: # cannot find the class - raise errors.LoaderError(f'cannot load class {class_name} from module {module_name}') from err + raise errors.LoaderError(f'cannot load class {class_name} from module {module_name} ({err})') from err return cls diff --git a/doc/source/installation.rst b/doc/source/installation.rst index b634457..ee6fadb 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -2,15 +2,39 @@ Installation ============ -Installation ------------- +You can install *bsie* via pip. BSIE comes with support for various file formats. +For this, it needs to install many external packages. BSIE lets you control +which of these you want to install. Note that if you choose to not install +support for some file types, BSIE will show a warning and skip them. +All other formats will be processed normally. +It is recommended to install *bsie* in a virtual environment (via ``virtualenv``). -Install *bsie* via pip:: +To install only the minimally required software, use:: pip install --extra-index-url https://pip.bsfs.io bsie -This installs the `bsie` python package as well as the `bsie.app` command. -It is recommended to install *bsie* in a virtual environment (via `virtualenv`). +To install all dependencies, use the following shortcut:: + + pip install --extra-index-url https://pip.bsfs.io bsie[all] + +To install a subset of all dependencies, modify the extras part (``[image, preview]``) +of the follwing command to your liking:: + + pip install --extra-index-url https://pip.bsfs.io bsie[image,preview] + +Currently, BSIE providesthe following extra flags: + +* image: Read data from image files. + Note that you may also have to install ``exiftool`` through your system's + package manager (e.g. ``sudo apt install exiftool``). +* preview: Create previews from a variety of files. + Note that support for various file formats also depends on what + system packages you've installed. You should at least install ``imagemagick`` + through your system's package manager (e.g. ``sudo apt install imagemagick``). + See `Preview Generator <https://github.com/algoo/preview-generator>`_ for + more detailed instructions. +* features: Extract feature vectors from images. + License @@ -2,6 +2,28 @@ from setuptools import setup, find_packages import os +extras = { + # NOTE: an 'all' extra is added automatically + 'features': [ + # image feature extractors + 'numpy', + ], + 'preview': [ + # preview readers + 'preview_generator', # also depends on some system packages + 'pillow', + 'rawpy', + ], + 'image': [ + # image readers + 'pillow', + 'rawpy', + # exif reader + 'pyexiv2', + ], + } + + setup( # package metadata name='bsie', @@ -9,14 +31,15 @@ setup( author='Matthias Baumgartner', author_email='dev@bsfs.io', description='Extract information from files and store them in a BSFS.', - long_description=open(os.path.join(os.path.dirname(__file__), 'README')).read(), + long_description=open(os.path.join(os.path.dirname(__file__), 'README.md')).read(), license='BSD', license_files=('LICENSE', ), url='https://www.bsfs.io/bsie/', download_url='https://pip.bsfs.io', # packages - packages=[p for p in find_packages() if p.startswith('bsie')], + packages=find_packages(include=['bsie']), + package_dir={'bsie': 'bsie'}, # data files are included if mentioned in MANIFEST.in include_package_data=True, @@ -31,18 +54,20 @@ setup( python_requires=">=3.7", install_requires=( 'bsfs', - # filematcher 'pyparsing', 'python-magic', + 'pyyaml', ), - extra_require=( - # image feature extractors - 'numpy', - # preview reader - 'preview_generator', # also depends on some system packages - # image reader - 'pillow', - 'rawpy', - ) -) + extras_require=dict( + # development targets + build=['build'], + dev=['coverage', 'mypy', 'pylint'], + doc=['sphinx', 'sphinx-copybutton', 'furo'], + test=['rdflib', 'requests', 'types-PyYAML'], + # add 'all' + all=list({pkg for ext in extras.values() for pkg in ext}), + # add extras + **extras + ), + ) |