|
| 1 | +============ |
| 2 | +Contributing |
| 3 | +============ |
| 4 | + |
| 5 | +DroneKit is an open-source project. We welcome any contribution that will improve the API — adding new features and making it easier to use. |
| 6 | + |
| 7 | + |
| 8 | +Getting started |
| 9 | +================ |
| 10 | + |
| 11 | +The dronekit-python project is `hosted on Github here <https://github.com/diydrones/dronekit-python/>`_. This where you get the source code, and is the best place to raise `bug reports and enhancement suggestions <https://github.com/diydrones/dronekit-python/issues>`_. |
| 12 | + |
| 13 | +.. tip:: Before starting new work, first create an issue in Github so it can be tracked and discussed! |
| 14 | + |
| 15 | +In addition to creating defect reports, a good starting point is to work on the `open issues <https://github.com/diydrones/dronekit-python/issues>`_ on Github. In particular, :ref:`documentation issues <contributing-to-documentation>` can be resolved without a deep knowledge of the code, and will help you learn more about the project. |
| 16 | + |
| 17 | + |
| 18 | +How to submit changes |
| 19 | +===================== |
| 20 | + |
| 21 | +Contributors should fork the main project Github repository and contribute changes back to the project using pull requests: |
| 22 | + |
| 23 | +* Ideas should be discussed with the project team first (using an issue) |
| 24 | +* Pull requests should be as small and focussed as possible to make them easier to review |
| 25 | +* Rebase your code against the main project before submission to make integration easier |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +.. _contributing-to-documentation: |
| 30 | + |
| 31 | +Contributing to the API documentation |
| 32 | +===================================== |
| 33 | + |
| 34 | +One of the best ways that you can help is by improving this documentation. |
| 35 | + |
| 36 | +The documentation source files are `stored in Github <https://github.com/diydrones/dronekit-python/tree/master/docs>`_. The content is written in plain-text files (file-extension :file:`.rst`) using `reStructuredText <http://sphinx-doc.org/rest.html>`_ markup, and is compiled into HTML using the `Sphinx Documentation Generator <http://sphinx-doc.org/index.html>`_. As with any other contributions to this project, you should fork the main project Github repository and contribute changes back to the project using pull requests. |
| 37 | + |
| 38 | +We've made it very easy to get started by providing a `Vagrant <https://www.vagrantup.com/>`_ based setup for :program:`Sphinx`. Using :program:`Vagrant` you can work with source files on your host machine using a familiar :program:`git` client and text editor, and then invoke :program:`Sphinx` in the :program:`Vagrant` VM to compile the source to HTML. |
| 39 | + |
| 40 | +The instructions below explain how to get the documentation source, and build it using our Vagrant VM: |
| 41 | + |
| 42 | +* Install the Vagrant pre-conditions: |
| 43 | + |
| 44 | + * `Download and install VirtualBox <https://www.virtualbox.org/wiki/Downloads>`_. |
| 45 | + * `Download and install Vagrant for your platform <https://www.vagrantup.com/downloads.html>`_ (Windows, OS-X and Linux are supported). |
| 46 | + |
| 47 | +* `Fork the official dronekit-python repo <https://github.com/diydrones/dronekit-python#fork-destination-box>`_ |
| 48 | +* Clone your fork of the Github repository anywhere on the host PC: :: |
| 49 | + |
| 50 | + git clone https://github.com/YOUR-REPOSITORY/dronekit-python.git |
| 51 | + |
| 52 | +* Navigate to the root of *dronekit-python* and start the Vagrant VM: |
| 53 | + |
| 54 | + :: |
| 55 | + |
| 56 | + cd /your-path-to-clone/dronekit-python/ |
| 57 | + vagrant up |
| 58 | + |
| 59 | + .. note:: This may take a long time to complete the first time it is run — Vagrant needs to download the virtual machine and then set up Sphinx. |
| 60 | + |
| 61 | +* When the VM is running, you can build the source by entering the following command in the prompt: |
| 62 | + |
| 63 | + :: |
| 64 | + |
| 65 | + vagrant ssh -c "cd /vagrant/docs && make html" |
| 66 | + |
| 67 | + The files will be built by :program:`Sphinx`, and will appear on the host system in :file:`<clone-path>/dronekit-python/docs/\_build/html/`. To preview, simply open them in a Web browser. |
| 68 | + |
| 69 | + .. note:: |
| 70 | + |
| 71 | + The ``vagrant ssh -c "cd /vagrant/docs && make html"`` command starts (and closes) an SSH session with the VM. If you plan on building the source a number of times it is much faster to keep the session open: |
| 72 | + |
| 73 | + :: |
| 74 | + |
| 75 | + vagrant ssh # Open an SSH session with the Vagrant VM |
| 76 | + cd /vagrant/docs # Navigate to the docs root (contains Sphinx configuration files) |
| 77 | + make html # Build the HTML |
| 78 | + ... # Repeat "make html" as many time as needed |
| 79 | + make html |
| 80 | + exit # Close the SSH session. |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +* When you are finished you can suspend the VM. Next time you need to build more HTML simply restart it (this is a fast operation): |
| 85 | + |
| 86 | + :: |
| 87 | + |
| 88 | + vagrant suspend #Suspend the VM |
| 89 | + vagrant resume #Restart the VM |
| 90 | + vagrant ssh -c "cd /vagrant/docs && make html" #Build files when needed. |
| 91 | + |
| 92 | + |
| 93 | +* After making changes, follow the normal process to submit them to the project (i.e.commit and push them to your fork on Github, and then create a pull request on Github to the project repository). |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
0 commit comments