├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── auto-make.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── Jenkinsfile ├── LICENSE ├── Makefile ├── README.md ├── code-env └── python │ ├── desc.json │ └── spec │ └── requirements.txt ├── custom-recipes └── your-plugin-id-component-name │ ├── recipe.json │ └── recipe.py ├── parameter-sets └── bla-bla-bla │ └── parameter-set.json ├── plugin.json ├── python-lib ├── __init__.py └── dummy_module.py └── tests └── python ├── integration ├── pytest.ini ├── requirements.txt └── test_dummy_scenario.py ├── resources └── .gitkeep └── unit ├── requirements.txt └── test_dummy_module.py /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | - Browser [e.g. chrome, safari] 29 | - DSS version [e.g. 7.0.3, 8.0.1] 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/auto-make.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [push, pull_request] 4 | 5 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 6 | jobs: 7 | make: 8 | # The type of runner that the job will run on 9 | runs-on: ubuntu-20.04 10 | 11 | # Steps represent a sequence of tasks that will be executed as part of the job 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v2 15 | # Runs a single command using the runners shell 16 | - name: Make 17 | run: make plugin 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # DSS specific stuff 2 | dist/ 3 | .wlock 4 | .ts 5 | 6 | # Byte-compiled / optimized / DLL files 7 | __pycache__/ 8 | *.py[cod] 9 | *$py.class 10 | 11 | # C extensions 12 | *.so 13 | 14 | # Distribution / packaging 15 | .Python 16 | build/ 17 | develop-eggs/ 18 | dist/ 19 | downloads/ 20 | eggs/ 21 | .eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | wheels/ 28 | pip-wheel-metadata/ 29 | share/python-wheels/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | MANIFEST 34 | .DS_Store 35 | 36 | # PyInstaller 37 | # Usually these files are written by a python script from a template 38 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 39 | *.manifest 40 | *.spec 41 | 42 | # Installer logs 43 | pip-log.txt 44 | pip-delete-this-directory.txt 45 | 46 | # Unit test / coverage reports 47 | htmlcov/ 48 | .tox/ 49 | .nox/ 50 | .coverage 51 | .coverage.* 52 | .cache 53 | nosetests.xml 54 | coverage.xml 55 | unit.xml 56 | *.cover 57 | *.py,cover 58 | .hypothesis/ 59 | .pytest_cache/ 60 | cover/ 61 | 62 | # Translations 63 | *.mo 64 | *.pot 65 | 66 | # Django stuff: 67 | *.log 68 | local_settings.py 69 | db.sqlite3 70 | db.sqlite3-journal 71 | 72 | # Flask stuff: 73 | instance/ 74 | .webassets-cache 75 | 76 | # Scrapy stuff: 77 | .scrapy 78 | 79 | # Sphinx documentation 80 | docs/_build/ 81 | 82 | # PyBuilder 83 | target/ 84 | 85 | # Jupyter Notebook 86 | .ipynb_checkpoints 87 | 88 | # IPython 89 | profile_default/ 90 | ipython_config.py 91 | 92 | # pyenv 93 | # For a library or package, you might want to ignore these files since the code is 94 | # intended to run in multiple environments; otherwise, check them in: 95 | .python-version 96 | 97 | # pipenv 98 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 99 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 100 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 101 | # install all needed dependencies. 102 | Pipfile.lock 103 | 104 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 105 | __pypackages__/ 106 | 107 | # Celery stuff 108 | celerybeat-schedule 109 | celerybeat.pid 110 | 111 | # SageMath parsed files 112 | *.sage.py 113 | 114 | # Environments 115 | .env 116 | .venv 117 | env/ 118 | venv/ 119 | ENV/ 120 | env.bak/ 121 | venv.bak/ 122 | 123 | # Spyder project settings 124 | .spyderproject 125 | .spyproject 126 | 127 | # Rope project settings 128 | .ropeproject 129 | 130 | # mkdocs documentation 131 | /site 132 | 133 | # mypy 134 | .mypy_cache/ 135 | .dmypy.json 136 | dmypy.json 137 | 138 | # Pyre type checker 139 | .pyre/ 140 | 141 | # pytype static type analyzer 142 | .pytype/ 143 | 144 | # mac stuff 145 | .DS_Store 146 | 147 | # History files 148 | .Rhistory 149 | .Rapp.history 150 | 151 | # Session Data files 152 | .RData 153 | 154 | # User-specific files 155 | .Ruserdata 156 | 157 | # Example code in package build process 158 | *-Ex.R 159 | 160 | # Output files from R CMD build 161 | /*.tar.gz 162 | 163 | # Output files from R CMD check 164 | /*.Rcheck/ 165 | 166 | # RStudio files 167 | .Rproj.user/ 168 | 169 | # produced vignettes 170 | vignettes/*.html 171 | vignettes/*.pdf 172 | 173 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 174 | .httr-oauth 175 | 176 | # knitr and R markdown default cache directories 177 | *_cache/ 178 | /cache/ 179 | 180 | # Temporary files created by R markdown 181 | *.utf8.md 182 | *.knit.md 183 | 184 | # R Environment Variables 185 | .Renviron 186 | 187 | # pkgdown site 188 | docs/ 189 | 190 | # translation temp files 191 | po/*~ 192 | 193 | # Compiled class file 194 | *.class 195 | 196 | # Log file 197 | *.log 198 | 199 | # BlueJ files 200 | *.ctxt 201 | 202 | # Mobile Tools for Java (J2ME) 203 | .mtj.tmp/ 204 | 205 | # Package Files # 206 | *.jar 207 | *.war 208 | *.nar 209 | *.ear 210 | *.zip 211 | *.tar.gz 212 | *.rar 213 | 214 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 215 | hs_err_pid* 216 | 217 | .gradle 218 | **/build/ 219 | !src/**/build/ 220 | 221 | # Ignore Gradle GUI config 222 | gradle-app.setting 223 | 224 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 225 | !gradle-wrapper.jar 226 | 227 | # Cache of project 228 | .gradletasknamecache 229 | 230 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 231 | # gradle/wrapper/gradle-wrapper.properties 232 | .vscode/settings.json 233 | 234 | .idea/ 235 | 236 | tests/allure_report -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## Version X.Y.Z - Type of release (*) - YYYY-MM-DD 4 | - Changes 1 ... 5 | - Changes 2 ... 6 | - ... 7 | 8 | (*) Possible types of releases 9 | 10 | - Initial release 11 | - Bugfix release 12 | - Feature release 13 | - .... -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | - Using welcoming and inclusive language 18 | - Being respectful of differing viewpoints and experiences 19 | - Gracefully accepting constructive criticism 20 | - Focusing on what is best for the community 21 | - Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | - The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | - Trolling, insulting/derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at plugins@dataiku.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | options { 3 | disableConcurrentBuilds() 4 | } 5 | agent { label 'dss-plugin-tests'} 6 | environment { 7 | PLUGIN_INTEGRATION_TEST_INSTANCE="$HOME/instance_config.json" 8 | UNIT_TEST_FILES_STATUS_CODE = sh(script: 'ls ./tests/*/unit/test*', returnStatus: true) 9 | INTEGRATION_TEST_FILES_STATUS_CODE = sh(script: 'ls ./tests/*/integration/test*', returnStatus: true) 10 | } 11 | stages { 12 | stage('Run Unit Tests') { 13 | when { environment name: 'UNIT_TEST_FILES_STATUS_CODE', value: "0"} 14 | steps { 15 | sh 'echo "Running unit tests"' 16 | catchError(stageResult: 'FAILURE') { 17 | sh """ 18 | make unit-tests 19 | """ 20 | } 21 | sh 'echo "Done with unit tests"' 22 | } 23 | } 24 | stage('Run Integration Tests') { 25 | when { environment name: 'INTEGRATION_TEST_FILES_STATUS_CODE', value: "0"} 26 | steps { 27 | sh 'echo "Running integration tests"' 28 | catchError(stageResult: 'FAILURE') { 29 | sh """ 30 | make integration-tests 31 | """ 32 | } 33 | sh 'echo "Done with integration tests"' 34 | } 35 | } 36 | } 37 | post { 38 | always { 39 | script { 40 | allure([ 41 | includeProperties: false, 42 | jdk: '', 43 | properties: [], 44 | reportBuildPolicy: 'ALWAYS', 45 | results: [[path: 'tests/allure_report']] 46 | ]) 47 | 48 | def status = currentBuild.currentResult 49 | sh "file_name=\$(echo ${env.JOB_NAME} | tr '/' '-').status; touch \$file_name; echo \"${env.BUILD_URL};${env.CHANGE_TITLE};${env.CHANGE_AUTHOR};${env.CHANGE_URL};${env.BRANCH_NAME};${status};\" >> $HOME/daily-statuses/\$file_name" 50 | cleanWs() 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2023 Dataiku 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile variables set automatically 2 | plugin_id=`cat plugin.json | python -c "import sys, json; print(str(json.load(sys.stdin)['id']).replace('/',''))"` 3 | plugin_version=`cat plugin.json | python -c "import sys, json; print(str(json.load(sys.stdin)['version']).replace('/',''))"` 4 | archive_file_name="dss-plugin-${plugin_id}-${plugin_version}.zip" 5 | remote_url=`git config --get remote.origin.url` 6 | last_commit_id=`git rev-parse HEAD` 7 | 8 | .DEFAULT_GOAL := plugin 9 | 10 | plugin: dist-clean 11 | @echo "[START] Archiving plugin to dist/ folder..." 12 | @cat plugin.json | json_pp > /dev/null 13 | @mkdir dist 14 | @echo "{\"remote_url\":\"${remote_url}\",\"last_commit_id\":\"${last_commit_id}\"}" > release_info.json 15 | @git archive -v -9 --format zip -o dist/${archive_file_name} HEAD 16 | @if [[ -d tests ]]; then \ 17 | zip --delete dist/${archive_file_name} "tests/*"; \ 18 | fi 19 | @zip -u dist/${archive_file_name} release_info.json 20 | @rm release_info.json 21 | @echo "[SUCCESS] Archiving plugin to dist/ folder: Done!" 22 | 23 | dev: dist-clean 24 | @echo "[START] Archiving plugin to dist/ folder... (dev mode)" 25 | @cat plugin.json | json_pp > /dev/null 26 | @mkdir dist 27 | @zip -v -9 dist/${archive_file_name} -r . --exclude "tests/*" "env/*" ".git/*" ".pytest_cache/*" ".idea/*" "dist/*" 28 | @echo "[SUCCESS] Archiving plugin to dist/ folder: Done!" 29 | 30 | unit-tests: 31 | @echo "Running unit tests..." 32 | @( \ 33 | PYTHON_VERSION=`python3 -c "import sys; print('PYTHON{}{}'.format(sys.version_info.major, sys.version_info.minor))"`; \ 34 | PYTHON_VERSION_IS_CORRECT=`cat code-env/python/desc.json | python3 -c "import sys, json; print('$$PYTHON_VERSION' in json.load(sys.stdin)['acceptedPythonInterpreters']);"`; \ 35 | if [ $$PYTHON_VERSION_IS_CORRECT == "False" ]; then echo "Python version $$PYTHON_VERSION is not in acceptedPythonInterpreters"; exit 1; else echo "Python version $$PYTHON_VERSION is in acceptedPythonInterpreters"; fi; \ 36 | ) 37 | @( \ 38 | rm -rf ./env/; \ 39 | python3 -m venv env/; \ 40 | source env/bin/activate; \ 41 | pip install --upgrade pip;\ 42 | pip install --no-cache-dir -r tests/python/unit/requirements.txt; \ 43 | pip install --no-cache-dir -r code-env/python/spec/requirements.txt; \ 44 | export PYTHONPATH="$(PYTHONPATH):$(PWD)/python-lib"; \ 45 | python3 -m pytest tests/python/unit --alluredir=tests/allure_report || ret=$$?; exit $$ret \ 46 | ) 47 | 48 | integration-tests: 49 | @echo "Running integration tests..." 50 | @( \ 51 | rm -rf ./env/; \ 52 | python3 -m venv env/; \ 53 | source env/bin/activate; \ 54 | pip3 install --upgrade pip;\ 55 | pip install --no-cache-dir -r tests/python/integration/requirements.txt; \ 56 | python3 -m pytest tests/python/integration --alluredir=tests/allure_report || ret=$$?; exit $$ret \ 57 | ) 58 | 59 | tests: unit-tests integration-tests 60 | 61 | dist-clean: 62 | rm -rf dist -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Plugin Template 2 | 3 | This repository is a template for developers to create Dataiku DSS plugins from GitHub. 4 | 5 | Use it and adapt it as you wish, and have fun with Dataiku! 6 | 7 | 8 | # How to test your plugin 9 | 10 | We recommend supporting your development cycle with unit and integration tests. 11 | To operate integration tests, you will need the help of the `dataiku-plugin-tests-utils` package to automate their executions while targeting dedicated DSS instances. 12 | 13 | `dataiku-plugin-tests-utils` will be installed as a `pytest plugin`. Install that package inside an environment dedicated to integration tests; otherwise, `pytest` will complain about unused fixtures inside your unit tests. 14 | 15 | # How to install in your plugin 16 | 17 | To install the `dataiku-plugin-tests-utils` package for your plugins, use the following line depending on your preferred way to managed packages. 18 | 19 | ## Using requirements.txt 20 | 21 | ### Development 22 | 23 | ``` 24 | git+https://github.com/dataiku/dataiku-plugin-tests-utils.git@#egg=dataiku-plugin-tests-utils 25 | ``` 26 | 27 | Replace `` with the most accurate value 28 | 29 | ### Stable release 30 | 31 | ``` 32 | git+https://github.com/dataiku/dataiku-plugin-tests-utils.git@releases/tag/#egg=dataiku-plugin-tests-utils 33 | ``` 34 | 35 | Replace `` with the most accurate value 36 | 37 | ## Using pipfile 38 | 39 | Put the following line under `[dev-packages]` section 40 | 41 | ### Development cycle 42 | 43 | ``` 44 | dku-plugin-test-utils = {git = "https://github.com/dataiku/dataiku-plugin-tests-utils.git", ref = ""} 45 | ``` 46 | 47 | ### Stable release 48 | TBD 49 | 50 | ## Dev env 51 | 52 | ### Config 53 | 54 | First, ensure that you have personal API Keys for the DSS you want to target. 55 | Secondly, define a config file that will give the DSS you will target. 56 | ``` 57 | { 58 | "DSSX": 59 | { 60 | "url": ".......", 61 | "users": { 62 | "usrA": "api_key", 63 | "usrB": "api_key", 64 | "default": "usrA" 65 | }, 66 | "python_interpreter": ["PYTHON27", "PYTHON36"] 67 | 68 | }, 69 | "DSSY": 70 | { 71 | "url": "......", 72 | "users": { 73 | "usrA": "api_key", 74 | "usrB": "api_key", 75 | "default": "usrB" 76 | }, 77 | "python_interpreter": ["PYTHON36", "PYTHON39"] 78 | } 79 | } 80 | 81 | ``` 82 | 83 | **BEWARE**: User names must be identical in the configuration file between the different DSS instances. 84 | Then, set the environment variable `PLUGIN_INTEGRATION_TEST_INSTANCE` to point to the config file. 85 | 86 | # How to use the package 87 | 88 | ## General information 89 | 90 | To use the package in your test files: 91 | ```python 92 | import dku_plugin_test_utils 93 | import dku_plugin_test_utils.subpakcage.subsymbol 94 | ``` 95 | Look at the next section for more information about potential `subpackage` and `subsymbol`. 96 | 97 | The python integration test files are indirections towards the "real" tests written as DSS scenarios on DSS instances. 98 | The python test function triggers the targeted DSS scenario and waits either for its successful or failed completion. 99 | Thence your test function should look like the following snippet : 100 | ```python 101 | # Mandatory imports 102 | from dku_plugin_test_utils import dss_scenario 103 | 104 | def test_run_some_dss_scenario(user_dss_clients): 105 | dss_scenario.run(user_clients, 'PROJECT_KEY', 'scenario_id', user="user1") 106 | 107 | # [... other tests ...] 108 | ``` 109 | With: 110 | - `user_dss_clients`: representing the DSS client corresponding to the desired user. 111 | - `PROJECT_KEY`: The project that holds the test scenarios 112 | - `scenario_id`: The test scenario to run 113 | - `user`: Specify the user to run the scenario with. It is an optional argument. By default, it is "default". 114 | 115 | ## How to generate a graphical report with Allure for integration tests 116 | 117 | For each plugin, a folder named `allure_report` should exist inside the `test` folder; reports will be generated inside that folder. 118 | To generate the graphical report, you must have Allure installed on your system as described [on their installation guide](https://docs.qameta.io/allure/#_manual_installation). Once the installation is done, run the following : 119 | ```shell 120 | allure serve path/to/the/allure_report/dir/inside/you/plugin/test/folder/ 121 | ``` 122 | 123 | # Package hierarchy 124 | 125 | As it is a tooling package for integration tests, it will aggregate different packages with different goals. 126 | The following hierarchy exposes the different sub-package contained in `dku_plugin_test_utils` with their aim 127 | and the list of public symbols: 128 | 129 | - `run_config`: 130 | - `ScenarioConfiguration`: Class exposing the parsed run configuration as a python dictionary. 131 | - `PluginInfo`: Parse the plugin.json and the code-env desc.json files to extract plugin metadata as a python dictionary. 132 | - `dss_scenario`: 133 | - `run`: Run the target DSS scenario and wait for its completion (either success or failure). 134 | -------------------------------------------------------------------------------- /code-env/python/desc.json: -------------------------------------------------------------------------------- 1 | { 2 | "acceptedPythonInterpreters": [ 3 | "PYTHON36", 4 | "PYTHON37", 5 | "PYTHON38", 6 | "PYTHON39", 7 | "PYTHON310", 8 | "PYTHON311" 9 | ], 10 | "corePackagesSet": "AUTO", 11 | "forceConda": false, 12 | "installCorePackages": true, 13 | "installJupyterSupport": false 14 | } -------------------------------------------------------------------------------- /code-env/python/spec/requirements.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /custom-recipes/your-plugin-id-component-name/recipe.json: -------------------------------------------------------------------------------- 1 | // This file is the descriptor for the Custom code recipe test 2 | { 3 | // Meta data for display purposes 4 | "meta": { 5 | // label: name of the recipe as displayed, should be short 6 | "label": "Your recipe label", 7 | // description: longer string to help end users understand what this recipe does 8 | "description": "Your recipe description", 9 | // icon: must be one of the FontAwesome 3.2.1 icons, complete list here at https://fontawesome.com/v3.2.1/icons/ 10 | "icon": "icon-puzzle-piece" 11 | }, 12 | "kind": "PYTHON", 13 | // Inputs and outputs are defined by roles. In the recipe's I/O tab, the user can associate one 14 | // or more dataset to each input and output role. 15 | // The "arity" field indicates whether the user can associate several datasets to the role ('NARY') 16 | // or at most one ('UNARY'). The "required" field indicates whether the user is allowed to 17 | // associate no dataset with the role. 18 | "inputRoles": [ 19 | { 20 | "name": "input_A_role", 21 | "label": "input A displayed name", 22 | "description": "what input A means", 23 | "arity": "UNARY", 24 | "required": true, 25 | "acceptsDataset": true 26 | }, 27 | { 28 | "name": "input_B_role", 29 | "label": "input B displayed name", 30 | "description": "what input B means", 31 | "arity": "NARY", 32 | "required": false, 33 | "acceptsDataset": true 34 | // ,'mustBeSQL': true 35 | // ,'mustBeStrictlyType':'HDFS' 36 | } 37 | // ... 38 | ], 39 | "outputRoles": [ 40 | { 41 | "name": "main_output", 42 | "label": "main output displayed name", 43 | "description": "what main output means", 44 | "arity": "UNARY", 45 | "required": false, 46 | "acceptsDataset": true 47 | }, 48 | { 49 | "name": "errors_output", 50 | "label": "errors output displayed name", 51 | "description": "what errors output means", 52 | "arity": "UNARY", 53 | "required": false, 54 | "acceptsDataset": true 55 | } 56 | // ... 57 | ], 58 | /* The field "params" holds a list of all the params 59 | for wich the user will be prompted for values in the Settings tab of the recipe. 60 | 61 | The available parameter types include: 62 | STRING, STRINGS, INT, DOUBLE, BOOLEAN, SELECT, MULTISELECT, MAP, TEXTAREA, PRESET, COLUMN, COLUMNS 63 | 64 | For the full list and for more details, see the documentation: https://doc.dataiku.com/dss/latest/plugins/reference/params.html 65 | */ 66 | "params": [ 67 | { 68 | "name": "parameter1", 69 | "label": "User-readable label", 70 | "type": "STRING", 71 | "description": "Some documentation for parameter1", 72 | "mandatory": true 73 | }, 74 | { 75 | "name": "parameter2", 76 | "label": "Parameter 2 label", 77 | "type": "INT", 78 | "defaultValue": 42 79 | /* Note that standard json parsing will return it as a double in Python (instead of an int), so you need to write 80 | int(get_recipe_config()['parameter2']) 81 | */ 82 | }, 83 | // A "SELECT" parameter is a multi-choice selector. Choices are specified using the selectChoice field 84 | { 85 | "name": "parameter3", 86 | "label": "Parameter 3 label", 87 | "type": "SELECT", 88 | "selectChoices": [ 89 | { 90 | "value": "val_x", 91 | "label": "display name for val_x" 92 | }, 93 | { 94 | "value": "val_y", 95 | "label": "display name for val_y" 96 | } 97 | ] 98 | }, 99 | // A 'COLUMN' parameter is a string, whose value is a column name from an input schema. 100 | // To specify the input schema whose column names are used, use the "columnRole" field like below. 101 | // The column names will come from the schema of the first dataset associated to that role. 102 | { 103 | "name": "parameter4", 104 | "label": "Parameter 4 label", 105 | "type": "COLUMN", 106 | "columnRole": "input_B_role" 107 | } 108 | // The 'COLUMNS' type works in the same way, except that it is a list of strings. 109 | ], 110 | // The field "resourceKeys" holds a list of keys that allows to limit the number 111 | // of concurrent executions and activities triggered by this recipe. 112 | // 113 | // Administrators can configure the limit per resource key in the Administration > Settings > Flow build 114 | // screen. 115 | "resourceKeys": [] 116 | } -------------------------------------------------------------------------------- /custom-recipes/your-plugin-id-component-name/recipe.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # TODO 4 | -------------------------------------------------------------------------------- /parameter-sets/bla-bla-bla/parameter-set.json: -------------------------------------------------------------------------------- 1 | /* This file is the descriptor for the parameter set bla-bla-bla */ 2 | { 3 | "meta": { 4 | // label: name of the parameter set as displayed, should be short 5 | "label": "Parameter set bla-bla-bla", 6 | // description: longer string to help end users understand what these parameter correspond to 7 | "description": "", 8 | // icon: must be one of the FontAwesome 3.2.1 icons, complete list here at https://fontawesome.com/v3.2.1/icons/ 9 | "icon": "icon-puzzle-piece" 10 | }, 11 | /* if users are allowed to fill the values for an instance of this parameter 12 | set directly in the plugin component using it, as opposed to only be allowed 13 | to select already defined presets (default value, can be changed in plugin 14 | settings) 15 | */ 16 | "defaultDefinableInline": true, 17 | /* if users are allowed to define presets at the project level in addition 18 | to the instance level (default value, can be changed in plugin settings) */ 19 | "defaultDefinableAtProjectLevel": true, 20 | /* The field "params" holds a list of all the params 21 | for which the user will be prompted for values. The ones in 22 | pluginParams relate to plugin settings (ie instance-level) 23 | and the ones in params relate to element settings (ie recipe, 24 | dataset, ...) 25 | 26 | The values given by the user will override/complete the ones 27 | set by the user in the element's (dataset, recipe,...) config. 28 | 29 | To make parameters not visible in the element's config, 30 | define them here but not in the element's json. 31 | 32 | The available parameter types include: 33 | STRING, STRINGS, INT, DOUBLE, BOOLEAN, SELECT, MULTISELECT, MAP, TEXTAREA, 34 | PRESET, DATASET, DATASET_COLUMN, MANAGED_FOLDER, CREDENTIAL_REQUEST 35 | 36 | For the full list and for more details, see the documentation: https://doc.dataiku.com/dss/latest/plugins/reference/params.html 37 | */ 38 | "pluginParams": [ 39 | { 40 | "name": "parameter1", 41 | "label": "User-readable name", 42 | "type": "STRING", 43 | "description": "Some documentation for parameter1", 44 | "mandatory": true 45 | } 46 | ], 47 | "params": [ 48 | { 49 | "name": "parameter2", 50 | "type": "INT", 51 | "defaultValue": 42 52 | /* Note that standard json parsing will return it as a double in Python (instead of an int), so you need to write 53 | int(self.config()['parameter2']) 54 | */ 55 | }, 56 | /* A "SELECT" parameter is a multi-choice selector. Choices are specified using the selectChoice field*/ 57 | { 58 | "name": "parameter8", 59 | "type": "SELECT", 60 | "selectChoices": [ 61 | { 62 | "value": "val_x", 63 | "label": "display name for val_x" 64 | }, 65 | { 66 | "value": "val_y", 67 | "label": "display name for val_y" 68 | } 69 | ] 70 | } 71 | ] 72 | } -------------------------------------------------------------------------------- /plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "your-plugin-id", 3 | "version": "0.1.0", 4 | "meta": { 5 | "label": "Plugin template - Replace by your plugin label", 6 | "category": "Your category (optional)", 7 | "description": "Your description (keep it short and simple)", 8 | "author": "Organization (firstName LASTNAME)", 9 | "icon": "icon-font-awesome-3.2.1", 10 | "licenseInfo": "Apache Software License", 11 | "url": "https://www.dataiku.com/product/plugins/your-plugin-id/", 12 | "tags": [ 13 | "myTag" 14 | ], 15 | "supportLevel": "NOT_SUPPORTED" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /python-lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dataiku/dss-plugin-template/e3b7f8633b779dfc23231edaeed6f9f504dc7601/python-lib/__init__.py -------------------------------------------------------------------------------- /python-lib/dummy_module.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | DUMMY_CONSTANT = "foo" 4 | 5 | 6 | def dummy_function(): 7 | return DUMMY_CONSTANT 8 | -------------------------------------------------------------------------------- /tests/python/integration/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | usefixtures = plugin dss_target 3 | -------------------------------------------------------------------------------- /tests/python/integration/requirements.txt: -------------------------------------------------------------------------------- 1 | pytest 2 | requests<2.22,>=2 3 | dataiku-api-client 4 | git+https://github.com/dataiku/dataiku-plugin-tests-utils.git@master#egg=dataiku-plugin-tests-utils 5 | -------------------------------------------------------------------------------- /tests/python/integration/test_dummy_scenario.py: -------------------------------------------------------------------------------- 1 | 2 | # -*- coding: utf-8 -*- 3 | from dku_plugin_test_utils import dss_scenario 4 | 5 | 6 | TEST_PROJECT_KEY = "TESTPLUGINTEMPLATE" 7 | 8 | 9 | def test_dummy_scenario(user_dss_clients): 10 | dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="DUMMYTESTSCENARIO") 11 | -------------------------------------------------------------------------------- /tests/python/resources/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dataiku/dss-plugin-template/e3b7f8633b779dfc23231edaeed6f9f504dc7601/tests/python/resources/.gitkeep -------------------------------------------------------------------------------- /tests/python/unit/requirements.txt: -------------------------------------------------------------------------------- 1 | pytest~=6.2 2 | allure-pytest~=2.8 3 | -------------------------------------------------------------------------------- /tests/python/unit/test_dummy_module.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # This is a test file intended to be used with pytest 3 | # pytest automatically runs all the function starting with "test_" 4 | # see https://docs.pytest.org for more information 5 | 6 | from dummy_module import dummy_function 7 | 8 | 9 | def test_dummy_function(): 10 | dummy_results = dummy_function() 11 | assert dummy_results == "foo" 12 | --------------------------------------------------------------------------------