flashlight / text

Text utilities, including beam search decoding, tokenizing, and more, built for use in Flashlight.
MIT License
64 stars 15 forks source link

Fix python namespace packaging + Flashlight pkgs #28

Closed jacobkahn closed 1 year ago

jacobkahn commented 1 year ago

See title. Stop using namespace_packages since it's deprecated, and follow the official docs which stipulate removing __init__.py from every namespace dir that doesn't actually have package assets.

Test plan: tested install combos, i.e. text:

conda create -n flashlight-python python=3.10
conda activate flashlight-python
cd text/bindings/python
USE_KENLM=0 python setup.py install

sequence:

cd sequence/bindings/python
USE_CUDA=0 python setup.py install

then test incremental install

python
> from flashlight.lib.text import decoder
> from flashlight.lib.sequence import criterion

then remove things:

pip uninstall flashlight-text
python
> from flashlight.lib.sequence import criterion

remove everything

pip uninstall flashlight-sequence
python
> import flashlight
>> ModuleNotFoundError: No module named 'flashlight'

Checklist

facebook-github-bot commented 1 year ago

@jacobkahn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 1 year ago

@jacobkahn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 1 year ago

@jacobkahn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.