When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
You can use the Issues
tab to create bug and feature requests. Providing enough details to the developers to verify and troubleshoot your issue is paramount:
- Provide a clear and descriptive title as well as a concise summary of the issue to identify the problem.
- Describe the exact steps which reproduce the problem in as many details as possible.
- Describe the behavior you observed after following the steps and point out what exactly is the problem with that behavior.
- Explain which behavior you expected to see instead and why.
- Provide screenshots of the expected or actual behaviour where applicable.
- Follow the Github docs to make a copy (a fork) of the repository to your own Github account.
- Clone the forked repository to your local machine so you can begin making changes.
- Make sure this repository is set as the upstream remote repository so you are able to fetch the latest commits.
- Push all your changes to the
develop
branch of the forked repository.
Note: Make sure you have you have the latest version of the develop
branch on your local machine.
git checkout develop
git pull upstream develop
- Create pull requests to the upstream repository.
- Pull the latest content from the
develop
branch of this central repository (not your fork). - Create a branch off the
develop
branch. Name the branch appropriately, either briefly summarizing the bug (ex.,spatil/add-restapi-layer
) or feature or simply use the issue number in the name (ex.,spatil/issue-414-fix
). - After completing work and testing locally, push the code to the appropriate branch on your fork.
- In Github, create a pull request from the bug/feature branch of your fork to the
develop
branch of the central repository.
A Sage Bionetworks engineer must review and accept your pull request. A code review (which happens with both the contributor and the reviewer present) is required for contributing.
- Install package dependencies.
- Clone the
schematic
package repository.
git clone https://github.com/Sage-Bionetworks/schematic.git
- Create and activate a virtual environment.
- Run the following commands to build schematic and install the package along with all of its dependencies:
cd schematic # change directory to schematic
git checkout develop # switch to develop branch of schematic
poetry build # build source and wheel archives
pip install dist/schematicpy-x.y.z-py3-none-any.whl # install wheel file
Note: Use the appropriate version number (based on the version of the codebase you are pulling) while installing the wheel file above.
- Obtain appropriate Google credentials file(s).
- Obtain and Fill in the
config.yml
file and the.synapseConfig
file as well as described in theFill in Configuration File(s)
part of the documentation. - Run the test suite.
Note: To ensure that all tests run successfully, contact your DCC liason and request to be added to the schematic-dev
team on Synapse.
- To test new changes made to any of the modules within
schematic
, do the following:
# make changes to any files or modules
pip uninstall schematicpy # uninstall package
poetry build
pip install dist/schematicpy-x.y.z-py3-none-any.whl # install wheel file
Once the code has been merged into the develop
branch on this repo, there are two processes that need to be completed to ensure a release is complete.
- You should create a GitHub tag, with the appropriate version number. Typically, from
v21.06
onwards all tags are created following the Linux Ubuntu versioning convention which is theYY.MM
format whereY
is the year andM
is the month of that year when that release was created. - You should push the package to PyPI. Schematic is on PyPI as schematicpy. You can go through the following two sections for that.
The purpose of this section is to verify that the package looks and works as intended, by viewing it on Test PyPI and installing the test version in a separate virtual environment.
poetry build # build the package
poetry config repositories.testpypi https://test.pypi.org/legacy/ # add Test PyPI as an alternate package repository
poetry publish -r testpypi # publish the package to Test PyPI
Installing:
pip install --index-url https://test.pypi.org/simple/
If the package looks great on Test PyPI and works well, the next step is to publish the package to PyPI:
poetry publish # publish the package to PyPI
You'll need to register for a PyPI account before uploading packages to the package index. Similarly for Test PyPI as well.
All code added to the client must have tests. The Python client uses pytest to run tests. The test code is located in the tests subdirectory.
You can run the test suite in the following way:
pytest -vs tests/
- Duplicate the entity being updated (or folder if applicable).
- Edit the duplicates (e.g. annotations, contents, name).
- Update the test suite in your branch to use these duplicates, including the expected values in the test assertions.
- Open a PR as per the usual process (see above).
- Once the PR is merged, leave the original copies on Synapse to maintain support for feature branches that were forked from
develop
before your update.- If the old copies are problematic and need to be removed immediately (e.g. contain sensitive data), proceed with the deletion and alert the other contributors that they need to merge the latest
develop
branch into their feature branches for their tests to work.
- If the old copies are problematic and need to be removed immediately (e.g. contain sensitive data), proceed with the deletion and alert the other contributors that they need to merge the latest
- Please consult the Google Python style guide prior to contributing code to this project.
- Be consistent and follow existing code conventions and spirit.