asyml / stave

An extensible framework for building visualization and annotation tools to enable better interaction with NLP and Artificial Intelligence. This is part of the CASL project: http://casl-project.ai/
https://asyml.io
Apache License 2.0
49 stars 18 forks source link

Allow user specified django project #207

Closed mylibrar closed 3 years ago

mylibrar commented 3 years ago

This PR fixes #206.

Description of changes

  1. pypi.yml Remove settings.py and wsgi.py in stave package.
  2. READEME.md Update stave load to stave load-samples.
  3. stave_cli.py Add a new configurable argument django_settings_module. Add interactive interface for user to set up and initialize config of stave.
  4. stave_config.py Define default configs. Provide a set of interfaces to access/update stave configuration.
  5. stave_viewer.py Update the logic of configuring django.

Possible influences of this PR

  1. If an older version of stave was installed before, ~/.stave needs to be removed to avoid potential conflicts (e.g., KeyError).
  2. When users choose to set django_settings_module, they need to make sure the module is a path to a valid django project and settings.py is properly configured. Otherwise there may be undefined behaviors.

Demonstration of results

  1. Uninstall previous version of stave and remove the ~/.stave folder:
    rm -r ~/.stave
  2. Install new version of stave_test
    pip3 install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple stave_test
  3. Run and try different stave commands as specified in README.md. You may either (1) Skip all the initial configs to accept default django settings; or (2) Set django_settings_module to a settings.py file from a properly configured django project. Refer to https://github.com/asyml/stave/blob/master/simple-backend/stave_backend/settings.py for more details.
mylibrar commented 3 years ago
pip3 install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple stave_test
hunterhector commented 3 years ago
pip3 install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple stave_test

since tests-pypi is used for testing, you don't need to use a separate stave_test repo