Method definitions for use in SASTA
You can install SASTADEV using pip:
pip install sastadev
The installation provides an entrypoint sastadev
which invokes sastadev.__main__.main()
To lists arguments and options:
sastadev -h
or
python -m sastadev -h
from sastadev.deregularise import correctinflection
result = correctinflection('slaapten')
print(result)
# [('sliepen', 'Overgeneralisation')]
The package contains a configuration module sastadev.conf
that produces a SastadevConfig
object at runtime, called settings
.
Example 1 (correct):
from sastadev.conf import settings
def get_dataroot():
print(settings.DATAROOT)
Example 2 (wrong!):
from sastadev.conf import settings
dataroot = settings.DATAROOT
def get_dataroot():
print(dataroot)
The key difference is that the code in example 2 evaluates settings.DATAROOT
at the moment the code is executed. If settings.DATAROOT
changes between the first time the module is loaded and the time it is ran, the first value will be used. This disables configurable settings.
sastadev.conf.settings
can be changed at runtime.
:warning: Changing
settings
properties changes all code that is executed after the change. Therefore, make sure you set the settings once, and at the beginning of the runtime cycle.
To install the requirements:
pip install -r requirements.txt
To install the package in editable state:
pip install -e .
Tests should be written and run using pytest. To test, make sure the package is installed in editable mode. Then, each time you wish to run the tests:
pytest
Linting configuration is provided for flake8. To lint, run:
flake8 ./src/sastadev/
Specify the files which should be included in the package in pypi/include.txt
.
pip install twine
python setup.py sdist
twine upload dist/*.tar.gz
Enhancements, bugfixes, and new features are welcome. For major changes, please follow these steps:
feature/<your-branchname
>, based on develop
that contains your changes develop
develop
branch will be merged into master
, and a new release will be made