Please check INSTALLATION.md to build SecretFlow from source.
Before start, please install required package for testing.
pip install -r dev-requirements.txt
There are two types in secretflow/tests.
- simulation mode: SUT(System under test) is simulated by a single Ray cluster.
- production mode: SUT consists of multiple ray clusters. We have multiple processes running as different parties. In most cases, SUT is tested by production mode.
If you need to run all tests,
# tests under production mode
pytest --env prod -n auto -v --capture=no tests/
# tests under simulation mode
pytest --env sim -n auto -v --capture=no tests/
If you would like to run a single test, e.g. tests/device/test_spu.py,
# tests under simulation mode
pytest --env sim -n auto -v --capture=no tests/device/test_spu.py
# tests under production mode
pytest --env prod -n auto -v --capture=no tests/device/test_spu.py
We stick to Google Style.
We prefer black as our code formatter. For various editor users,
please refer to editor integration.
Pass -S, --skip-string-normalization
to black to avoid string quotes or prefixes normalization.
black
won't format your imports. You can do this manually or by IDE, e.g. VSCode. The format of imports refers to Imports formatting
We stick to Angular Style.
if you update the documentation files in docs/
, you are supposed to update its multilingual version in docs/locales/zh_CN/LC_MESSAGES
.
For example, if you update docs/getting_started/installation.md
, you also need to update the corresponding *.po
file in docs/locales/zh_CN/LC_MESSAGES/getting_started/installation.po
.
Follow follwing steps to update documentation:
-
Update documentation in
docs
. -
Run the following command to update
*.po
file.cd docs pip install -r requirements.txt sh update_po.sh
-
Update the corresponding
*.po
file. -
All
fuzzy
should be removed in*.po
file, because it won't take effect in the Chinese version of the documentation. -
All strings which start with
#~
such as#~ msgid
or#~ msgstr
should be removed, because it is redundant. -
Only commit the files which you update and pull request.
-
If your document is conflict with the main branch of SecretFlow, you are supposed to solve the conflict locally and commit.
You should use protoc v3.19.6
Protocol Buffers resides at submodules/spec/ as git submodules.
~/protoc-3.19.6/bin/protoc --proto_path submodules/spec/ --python_out . submodules/spec/secretflow/spec/v1/*.proto
Protocol Buffers resides at secretflow/protos.
~/protoc-3.19.6/bin/protoc --proto_path secretflow/protos/ --python_out . secretflow/protos/secretflow/spec/extend/*.proto
All generated Python code resides at secretflow/spec.