This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
- Python >= 3.7
- virtualenv >= 16.4.3
- GNU Make >= 3.8.1
- Create a new sandbox (aka venv) and install required python libraries into it
virtualenv --python=python3.7 venv source venv/bin/activate # Install sm-dataflow as an editable package pip install -e . # Install additional Python packages for development pip install -r requirements-dev.txt # Download the spaCy model for tokenization python -m spacy download en_core_web_md-2.2.0 --direct # Add tests/ to PYTHONPATH export PYTHONPATH="./tests:$PYTHONPATH"
- Run
make test
to execute all tests.
- Setup the Python Interpreter
- For PyCharm, go to
Settings -> Project Settings -> Project Interpreter
. - For IntelliJ, go to
File -> Project Structure -> Project -> Project SDK
. - Add a
Virtualenv Environment
from anExisting environment
and set the Interpreter toYOUR_REPO_ROOT/venv/bin/python
.
- For PyCharm, go to
- Configure
pytest
- In
Preferences -> Tools -> Python Integration Tools
, set the default test runner topytest
.
- In
- Setup source folders so that the
pytest
in the IDE becomes aware of the source codes.- Right click the
src
folder and chooseMark Directory As -> Sources Root
. - Right click the
tests
folder and chooseMark Directory As -> Test Sources Root
.
- Right click the
We force the following checks before a pull request can be merged into master: isort, black, pylint, mypy, and pytest.
- You can run
make test
to automatically execute these checks. - You can run
make
to execute all checks exceptpytest
. - To fix any formatting or import errors, you can simply run
make format
. - To fix
pylint
andmypy
errors, you can skip prefix tasks by manually runningpylint src/ tests/
andmypy src/ tests/
. - To fix
pytest
errors, you can skip prefix tasks by manually runningpython -m pytest tests/
. You can also go to the test file and run a specific test (see htt s://www.jetbrains.com/help/pycharm/pytest.html#run-pytest-test). - For more details, see the
test
task in the Makefile and the GitHub action lint_code_and_run_tests.yml.