|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Contributions are welcome, and they are greatly appreciated! Every |
| 4 | +little bit helps, and credit will always be given. |
| 5 | + |
| 6 | +## Types of Contributions |
| 7 | + |
| 8 | +You can contribute in many ways: |
| 9 | + |
| 10 | +### Report Bugs |
| 11 | + |
| 12 | +Report bugs at https://github.com/IFCA/deepaas/issues. |
| 13 | + |
| 14 | +If you are reporting a bug, please include: |
| 15 | + |
| 16 | +* Your operating system name and version. |
| 17 | +* Any details about your local setup that might be helpful in troubleshooting. |
| 18 | +* If you can, provide detailed steps to reproduce the bug. |
| 19 | +* If you don't have steps to reproduce the bug, just note your observations in |
| 20 | + as much detail as you can. Questions to start a discussion about the issue |
| 21 | + are welcome. |
| 22 | + |
| 23 | +### Fix Bugs |
| 24 | + |
| 25 | +Look through the GitHub issues for bugs. Anything tagged with "bug" |
| 26 | +is open to whoever wants to implement it. |
| 27 | + |
| 28 | +### Implement Features |
| 29 | + |
| 30 | +Look through the GitHub issues for features. Anything tagged with "enhancement" |
| 31 | +and "please-help" is open to whoever wants to implement it. |
| 32 | + |
| 33 | +Please do not combine multiple feature enhancements into a single pull request. |
| 34 | + |
| 35 | +Note: this project is very conservative, so new features that aren't tagged |
| 36 | +with "please-help" might not get into core. We're trying to keep the code base |
| 37 | +small, extensible, and streamlined. Whenever possible, it's best to try and |
| 38 | +implement feature ideas as separate projects outside of the core codebase. |
| 39 | + |
| 40 | +### Write Documentation |
| 41 | + |
| 42 | +cASO could always use more documentation, whether as part of the official cASO |
| 43 | +docs, in docstrings, or even on the web in blog posts, articles, and such. |
| 44 | + |
| 45 | +If you want to review your changes on the documentation locally, you can do:: |
| 46 | + |
| 47 | + pip install -r docs/requirements.txt |
| 48 | + make servedocs |
| 49 | + |
| 50 | +This will compile the documentation, open it in your browser and start |
| 51 | +watching the files for changes, recompiling as you save. |
| 52 | + |
| 53 | +### Submit Feedback |
| 54 | + |
| 55 | +The best way to send feedback is to file an issue at the follwing URL: |
| 56 | + |
| 57 | + https://github.com/IFCA/deepaas/issues |
| 58 | + |
| 59 | +If you are proposing a feature: |
| 60 | + |
| 61 | +* Explain in detail how it would work. |
| 62 | +* Keep the scope as narrow as possible, to make it easier to implement. |
| 63 | +* Remember that this is a volunteer-driven project, and that contributions |
| 64 | + are welcome :) |
| 65 | + |
| 66 | +## Setting Up the Code for Local Development |
| 67 | + |
| 68 | +Here's how to set up `deepaas` for local development. |
| 69 | + |
| 70 | +1. Fork the `deepaas` repo on GitHub. |
| 71 | +2. Clone your fork locally:: |
| 72 | + |
| 73 | + $ git clone [email protected]:your_name_here/deepaas.git |
| 74 | + |
| 75 | +3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: |
| 76 | + |
| 77 | + $ mkvirtualenv deepaas |
| 78 | + $ cd deepaas/ |
| 79 | + $ python setup.py develop |
| 80 | + |
| 81 | +4. Create a branch for local development:: |
| 82 | + |
| 83 | + $ git checkout -b name-of-your-bugfix-or-feature |
| 84 | + |
| 85 | +Now you can make your changes locally. |
| 86 | + |
| 87 | +5. When you're done making changes, check that your changes pass the tests and |
| 88 | + the style checks (pep8, flake8 and |
| 89 | + https://docs.openstack.org/hacking/latest/): |
| 90 | + |
| 91 | + $ pip install tox |
| 92 | + $ tox |
| 93 | + |
| 94 | +Please note that tox runs the style tests automatically, since we have a test |
| 95 | +environment for it (named pep8). |
| 96 | + |
| 97 | +If you feel like running only the pep8 environment, please use the following |
| 98 | +command:: |
| 99 | + |
| 100 | + $ tox -e pep8 |
| 101 | + |
| 102 | +6. Commit your changes and push your branch to GitHub:: |
| 103 | + |
| 104 | + $ git add . |
| 105 | + $ git commit -m "Your detailed description of your changes." |
| 106 | + $ git push origin name-of-your-bugfix-or-feature |
| 107 | + |
| 108 | +7. Check that the test coverage hasn't dropped:: |
| 109 | + |
| 110 | + $ tox -e cover |
| 111 | + |
| 112 | +8. Submit a pull request through the GitHub website. |
| 113 | + |
| 114 | + |
| 115 | +## Contributor Guidelines |
| 116 | + |
| 117 | +### Pull Request Guidelines |
| 118 | + |
| 119 | +Before you submit a pull request, check that it meets these guidelines: |
| 120 | + |
| 121 | +1. The pull request should include tests. |
| 122 | +2. If the pull request adds functionality, the docs should be updated. Put |
| 123 | + your new functionality into a function with a docstring, and add the |
| 124 | + feature to the list in README.rst. |
| 125 | +3. The pull request should work for Python 2.7, 3.4, 3.6 on Travis CI. |
| 126 | +4. Check https://travis-ci.org/IFCA/deepaas/pull_requests to ensure the tests pass |
| 127 | + for all supported Python versions and platforms. |
| 128 | + |
| 129 | +### Coding Standards |
| 130 | + |
| 131 | +* PEP8 |
| 132 | +* We follow the OpenStack Style Guidelines: https://docs.openstack.org/hacking/latest/user/hacking.html#styleguide |
| 133 | +* Write new code in Python 3. |
| 134 | + |
| 135 | +## Testing with tox |
| 136 | + |
| 137 | +Tox uses `py.test` under the hood, hence it supports the same syntax for selecting tests. |
| 138 | + |
| 139 | +For further information please consult the `pytest usage docs`_. |
| 140 | + |
| 141 | +To run a particular test class with tox:: |
| 142 | + |
| 143 | + $ tox -e py '-k TestCasoManager' |
| 144 | + |
| 145 | +To run some tests with names matching a string expression:: |
| 146 | + |
| 147 | + $ tox -e py '-k generate' |
| 148 | + |
| 149 | +Will run all tests matching "generate", test_generate_files for example. |
| 150 | + |
| 151 | +To run just one method:: |
| 152 | + |
| 153 | + $ tox -e py '-k "TestCasoManager and test_required_fields"' |
| 154 | + |
| 155 | +To run all tests using various versions of python in virtualenvs defined in tox.ini, just run tox.:: |
| 156 | + |
| 157 | + $ tox |
| 158 | + |
| 159 | +This configuration file setup the pytest-cov plugin and it is an additional |
| 160 | +dependency. It generate a coverage report after the tests. |
| 161 | + |
| 162 | +It is possible to tests with some versions of python, to do this the command |
| 163 | +is: |
| 164 | + |
| 165 | + $ tox -e py27,py34 |
| 166 | + |
| 167 | +Will run py.test with the python2.7, python3.4 and pypy interpreters, for |
| 168 | +example. |
0 commit comments