First off, thank you for thinking about contributing! Below you’ll find instructions that will hopefully guide you through how to contribute to and improve Flytesnacks.
Determine where to put your new code
- Core: Contains examples that demonstrate functionality available within core flytekit. These examples should be runnable locally.
- Integrations: Contains examples that leverage one or more of the available plugins.
- Case Studies: Contains examples that demonstrate the usage of Flyte to solve real-world problems. These are generally more complex examples that may require extra setup or that can only run on larger clusters.
Create a directory (applicable for
integrations
andcase_studies
directories)After determining where to put your example, create a directory under the appropriate parent directory. Each example directory should contain:
- Dockerfile
- Makefile
- README.rst
- __init__.py
- requirements.in
- sandbox.config
It might be easier to copy one of the existing examples and modify it to your needs.
Add the example to CI
Examples are references in this github workflow. Add a new entry under
strategy -> matrix -> directory
with the name of your directory as well as its relative path. Also, add the example to flyte_tests_manifest.json.- Test your code!
If the Python code can be run locally, just use
python <my file>
to run it.- If the Python code has to be tested in a cluster:
Install flytectl by running
brew install flyteorg/homebrew-tap/flytectl
. Learn more about installation and configuration of flytectl here.Run the
flytectl sandbox start --source=$(pwd)
command in the directory that's one level above the directory that has Dockerfile. For example, to register house_price_prediction example, run the start command in theml_training
directory. To registercore
examples, run the start command in thecookbook
directory. So,cd
to the required directory and run all the upcoming commands in there!- Following are the commands to run if examples in
core
directory are to be tested on sandbox: - Build Docker container using the command:
flytectl sandbox exec -- docker build . --tag "core:v1" -f core/Dockerfile
. - Package the examples by running
pyflyte --pkgs core package --image core:v1 -f
. - Register the examples by running
flytectl register files --archive -p flytesnacks -d development --archive flyte-package.tgz --version v1
. - Visit https://localhost:30081/console to view the Flyte console, which consists of the examples present in the
flytesnacks/cookbook/core
directory. - To fetch new dependencies and rebuild the image, run
flytectl sandbox exec -- docker build . --tag "core:v2" -f core/Dockerfile
,pyflyte --pkgs core package --image core:v2 -f
, andflytectl register files --archive -p flytesnacks -d development --archive flyte-package.tgz --version v2
. - Refer to Build & Deploy Your Application “Fast”er! if code in itself is updated and requirements.txt is the same.
- Build Docker container using the command:
- Following are the commands to run if examples in
docs
folder in flytesnacks
houses the required documentation configuration. All the core, case_studies, and integrations docs are written in the respective README.md and the Python code files.
- README.md file needs to capture the what, why, and how
- What is the integration about? Its features, etc.
- Why do we need this integration? How is it going to benefit the Flyte users?
- Showcase the uniqueness of the integration
- How to install the plugin?
Refer to any repo in the cookbook directory to understand this better.
Explain what the code does
Following are some documentation configuration-related changes (imagine you have added
snowflake
to theintegrations/external_services
folder):- Update conf.py
- Add the Python file names to the
CUSTOM_FILE_SORT_ORDER
list - Add
../integrations/external_services/snowflake
toexample_dirs
- Add
auto/integrations/external_services/snowflake
togallery_dirs
- Add the Python file names to the
- Update external_services.rst file
- Add a new panel
- Update the toctree
- Update conf.py
Verify if the code and documentation look as expected
- Learn about the documentation tools here
- Install the requirements by running
pip install -r docs-requirements.txt
in thecookbook
folder - Run
make html
in thedocs
folder
Tip
For implicit targets, run
make -C docs html
.- Open HTML pages present in the
docs/_build
directory in the browser
After creating the pull request, check if the docs are rendered correctly by clicking on the documentation check