This repo demonstrates some best practices for writing KBase Apps, as well as providing a simple app that demonstrates uploading data into kbase, using kbase utilities, using an external script, and using biopython to do simple calculations within the app.
- Make a new project using this repository as a template. NOTE: Do not use
example_sdk_appin the name. - Wait for the github action to finish, see details below.
- Clone your repository locally. Be sure the name of the local directory is the same as the repository name.
- Run
kb-sdk test. - Add your token to
test.cfgand your repository secrets. - Run
kb-sdk test.
We also aim to demonstrate various practicies, such as
- Code is organized inside helper classes outside of the impl file. We avoid writing most code in the impl file
- Dependency injection
- Unit tests
- Tests running in github actions. (See the .github directory)
- Use of the logger instead of prints
- Usage of KBase Template
- New Base Image
- Updated Makefile to enable testing with
pytestinstead of the deprecatednose
- Non KBase tests with mocks
- Update UI spec with correct parameters
- Test optional parameters
- Refine KBase tests, perhaps with assert statements
- Add comments to explain what is going on and why things are done this way.
- See also Chris' code
To run the unit tests for this app ensure the image is built by running
kb-sdk test once, then run:
make docker-unit
NOTE: Tests are automatically run via github actions, so you can check to see if your PR passes tests on github
This is a KBase module generated by the KBase Software Development Kit (SDK).
You will need to have the SDK installed to use this module. Learn more about the SDK and how to use it.
You can also learn more about the apps implemented in this module from its catalog page or its spec file.
Add your KBase developer token to test_local/test.cfg and run the following:
$ make
$ kb-sdk testAfter making any additional changes to this repo, run kb-sdk test again to
verify that everything still works.
To use this code in another SDK module, call
kb-sdk install example_kb_sdk_app
in the other module's root directory.
You may find the answers to your questions in our FAQ or Troubleshooting Guide.