|
1 | 1 | # Contributing |
2 | 2 |
|
3 | | -When contributing to this repository, please first discuss the change you wish to make via issue, |
4 | | -email, or any other method with the owners of this repository before making a change. |
| 3 | +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. |
5 | 4 |
|
6 | | -Please note we have a code of conduct, please follow it in all your interactions with the project. |
| 5 | +Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project. |
7 | 6 |
|
8 | | -## Getting started |
| 7 | +## How to contribute |
9 | 8 |
|
10 | | -### General Contribution Instructions |
| 9 | +### Reporting bugs or feature requests |
11 | 10 |
|
12 | | -1. Fork the repository. |
13 | | -2. Clone the forked repository. |
14 | | -3. Push all your changes to the dev branch of the forked repository. |
15 | | -4. Create pull requests to the origin repository. |
| 11 | +You can use the [`Issues`](https://github.com/Sage-Bionetworks/schematic/issues) tab to **create bug and feature requests**. Providing enough details to the developers to verify and troubleshoot your issue is paramount: |
| 12 | +- **Provide a clear and descriptive title as well as a concise summary** of the issue to identify the problem. |
| 13 | +- **Describe the exact steps which reproduce the problem** in as many details as possible. |
| 14 | +- **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior. |
| 15 | +- **Explain which behavior you expected to see** instead and why. |
| 16 | +- **Provide screenshots of the expected or actual behaviour** where applicable. |
16 | 17 |
|
17 | | -### Setup Project for Development and Testing |
| 18 | +### General contribution instructions |
| 19 | + |
| 20 | +1. Follow the [Github docs](https://help.github.com/articles/fork-a-repo/) to make a copy (a fork) of the repository to your own Github account. |
| 21 | +2. [Clone the forked repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository) to your local machine so you can begin making changes. |
| 22 | +3. Make sure this repository is set as the [upstream remote repository](https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-for-a-fork) so you are able to fetch the latest commits. |
| 23 | +4. Push all your changes to the `develop` branch of the forked repository. |
| 24 | + |
| 25 | +*Note*: Make sure you have you have the latest version of the `develop` branch on your local machine. |
| 26 | + |
| 27 | +``` |
| 28 | +git checkout develop |
| 29 | +git pull upstream develop |
| 30 | +``` |
| 31 | + |
| 32 | +5. Create pull requests to the upstream repository. |
| 33 | + |
| 34 | +### The development lifecycle |
| 35 | + |
| 36 | +1. Pull the latest content from the `develop` branch of this central repository (not your fork). |
| 37 | +2. 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`). |
| 38 | +3. After completing work and testing locally, push the code to the appropriate branch on your fork. |
| 39 | +4. In Github, create a pull request from the bug/feature branch of your fork to the `develop` branch of the central repository. |
| 40 | + |
| 41 | +> 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. |
| 42 | +
|
| 43 | +### Development environment setup |
| 44 | + |
| 45 | +1. Install [package dependencies](https://sage-schematic.readthedocs.io/en/develop/README.html#installation-requirements-and-pre-requisites) |
| 46 | +2. Clone the `schematic` package repository |
| 47 | + |
| 48 | +``` |
| 49 | +git clone https://github.com/Sage-Bionetworks/schematic.git |
| 50 | +``` |
18 | 51 |
|
19 | | -1. Install [package dependencies](https://sage-schematic.readthedocs.io/en/develop/README.html#installation-requirements-and-pre-requisites). |
20 | | -2. Clone the `schematic` package repository: `git clone https://github.com/Sage-Bionetworks/schematic.git` |
21 | 52 | 3. [Create and activate](https://sage-schematic.readthedocs.io/en/develop/README.html#virtual-environment-setup) a virtual environment. |
22 | 53 | 4. Run the following commands to build schematic and install the package along with all of its dependencies: |
23 | | - ```python |
24 | | - cd schematic # change directory to schematic |
25 | | - git checkout develop # switch to develop branch of schematic |
26 | | - poetry build # build source and wheel archives |
27 | | - pip install dist/schematicpy-0.1.11-py3-none-any.whl # install wheel file |
28 | | - ``` |
| 54 | + |
| 55 | +``` |
| 56 | +cd schematic # change directory to schematic |
| 57 | +git checkout develop # switch to develop branch of schematic |
| 58 | +poetry build # build source and wheel archives |
| 59 | +pip install dist/schematicpy-x.y.z-py3-none-any.whl # install wheel file |
| 60 | +``` |
| 61 | + |
| 62 | +*Note*: Use the appropriate version number (based on the version of the codebase you are pulling) while installing the wheel file above. |
| 63 | + |
29 | 64 | 5. [Obtain](https://sage-schematic.readthedocs.io/en/develop/README.html#obtain-google-credentials-file-s) appropriate Google credentials file(s). |
30 | 65 | 6. [Obtain and Fill in](https://sage-schematic.readthedocs.io/en/develop/README.html#fill-in-configuration-file-s) the `config.yml` file and the `.synapseConfig` file as well as described in the `Fill in Configuration File(s)` part of the documentation. |
31 | 66 | 7. [Run](https://docs.pytest.org/en/stable/usage.html) the test suite. |
32 | 67 |
|
33 | | -Note: To ensure that all tests run successfully, contact your DCC liason and request to be added to the `schematic-dev` [team](https://www.synapse.org/#!Team:3419888) on Synapse. |
| 68 | +*Note*: To ensure that all tests run successfully, contact your DCC liason and request to be added to the `schematic-dev` [team](https://www.synapse.org/#!Team:3419888) on Synapse. |
| 69 | + |
| 70 | +8. To test new changes made to any of the modules within `schematic`, do the following: |
34 | 71 |
|
35 | | -## Pull Request Process |
| 72 | +``` |
| 73 | +# make changes to any files or modules |
| 74 | +pip uninstall schematicpy # uninstall package |
| 75 | +poetry build |
| 76 | +pip install dist/schematicpy-x.y.z-py3-none-any.whl # install wheel file |
| 77 | +``` |
36 | 78 |
|
37 | | -1. Ensure any install or build dependencies are removed before the end of the layer when doing a |
38 | | - build. |
39 | | -2. If needed, update the README.md with details of changes to the interface, this includes new environment |
40 | | - variables, exposed ports, useful file locations and container parameters. |
41 | | -3. You may merge the Pull Request in once you have the sign-off of at least one other developer, or if you |
42 | | - do not have permission to do that, you may request the second reviewer to merge it for you. |
43 | | -4. When merging into dev into master follow release procedures (TODO: releas process to be determined) |
| 79 | +## Testing |
44 | 80 |
|
45 | | -## Updating Synapse Test Resources |
| 81 | +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](https://github.com/Sage-Bionetworks/schematic/tree/develop-docs-update/tests) subdirectory. |
| 82 | + |
| 83 | +You can run the test suite in the following way: |
| 84 | + |
| 85 | +``` |
| 86 | +pytest -vs tests/ |
| 87 | +``` |
| 88 | + |
| 89 | +### Updating Synapse test resources |
46 | 90 |
|
47 | 91 | 1. Duplicate the entity being updated (or folder if applicable). |
48 | 92 | 2. Edit the duplicates (_e.g._ annotations, contents, name). |
49 | | -3. Update the test suite in your branch to use these duplicates, including the expected values in the test assertions. |
50 | | -4. Open a PR as per the usual process (see above). |
51 | | -5. 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. |
52 | | - - 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. |
| 93 | +3. Update the test suite in your branch to use these duplicates, including the expected values in the test assertions. |
| 94 | +4. Open a PR as per the usual process (see above). |
| 95 | +5. 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. |
| 96 | + - 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. |
53 | 97 |
|
54 | 98 | ## Code style |
55 | 99 |
|
56 | | -* Please consult this code style guide prior contributing code to the project: |
57 | | -http://google.github.io/styleguide/pyguide.html |
58 | | - |
| 100 | +* Please consult the [Google Python style guide](http://google.github.io/styleguide/pyguide.html) prior to contributing code to this project. |
59 | 101 | * Be consistent and follow existing code conventions and spirit. |
0 commit comments