Contributing to PennyLane

For topics discussing PennyLane development. For bug reports, please use the GitHub issue tracker.

PennyLane is a collaborative effort with the quantum computation and machine learning community - while we will continue working on adding new and exciting features to PennyLane, we invite you to join us and suggest improvements, research ideas, or even just to discuss how PennyLane fits into your workflow.

How can I get involved in the community?

If you want to contribute but don’t know where to start, start by checking out our documentation. Have a go working through some of the tutorials, and having a look at the PennyLane API and code documentation to see how things work under the hood.

To chat directly with the team designing and building PennyLane, as well as members of our community – ranging from quantum machine learning researchers, to students, to those just interested in being a part of a rapidly growing industry - you can join our PennyLane discussion forum.

Available categories include:

  • PennyLane Feedback: For general discussion regarding PennyLane, including feature requests, and theoretical questions
  • PennyLane Help: For help and advice using PennyLane
  • PennyLane Development: For discussion of PennyLane development
  • PennyLane Plugins: For discussion of the available PennyLane plugins, and plugin development
  • Xanadu Software: For discussion relating to other Xanadu software projects, including StrawberryFields, QMLT, Hafnian, and OpenBoson.

Sometimes, it might take us a couple of hours to reply - please be patient!

How can I contribute?

It’s up to you!

  • Be a part of our community - chat with the community and respond to questions at the PennyLane discussion forums, and provide exciting updates of the projects/experiments you are investigating with PennyLane.

    You can even write your own PennyLane tutorials, or blog about your results.
    Send us the link, and we may even add it to our documentation as an external resource!

  • Test the cutting-edge PennyLane releases - clone our GitHub repository, and keep up to date with the latest features. If you run into any bugs, make a bug report on our issue tracker.

  • Report bugs - even if you are not using the development branch of PennyLane, if you come across any bugs or issues, make a bug report. See the next section for more details on the bug reporting procedure.

  • Suggest new features and enhancements - use the GitHub issue tracker and let us know what will make PennyLane even better for your workflow.

  • Contribute to our documentation, or to PennyLane directly - if you would like to add
    to our documentation, or suggest improvements/changes, let us know - or even submit a pull request directly. All authors who have contributed to the PennyLane codebase will be listed alongside the latest release.

  • Develop a PennyLane plugin - PennyLane is designed to be device and quantum-framework agnostic; the quantum node device can be switched out to any other compatible devices, with no code changes necessary. We would love to support even more devices and quantum frameworks. If you would like to write a PennyLane plugin, see the developer overview section of our documentation.

    Ask us if you have any questions, and send a link to your plugin to support@xanadu.ai so we can highlight it in our documentation!

Pull requests

If you would like to contribute directly to the PennyLane codebase, simply make a fork of the master branch, and then when ready, submit a pull request. We encourage everyone to have a go forking and modifying the PennyLane source code, however, we have a couple of guidelines on pull requests to ensure the main master branch of PennyLane conforms to existing standards and quality.

General guidelines

  • Do not make a pull request for minor typos/cosmetic code changes - make an issue instead.
  • For major features, consider making an independent app that runs on top of PennyLane, rather than modifying PennyLane directly.

Before submitting

Before submitting a pull request, please make sure the following is done:

  • All new features must include a unit test. If you’ve fixed a bug or added code that should be tested,
    add a test to the test directory!
  • All new functions and code must be clearly commented and documented. Have a look through the source code at some of the existing function docstrings - the easiest approach is to simply copy an existing docstring and modify it as appropriate. If you do make documentation changes, make sure that the docs build and render correctly by running make docs.
  • Ensure that the test suite passes, by running make test.
  • Make sure the modified code in the pull request conforms to the PEP8 coding standard. The PennyLane source code conforms to PEP8 standards. We check all of our code against Pylint. To lint modified files, simply install pip install pylint, and then from the source code directory, run pylint pennylane/path/to/file.py.

Submitting the pull request

  • When ready, submit your fork as a pull request to the PennyLane repository, filling out the pull request template. This template is added automatically to the comment box when you create a new issue.

  • When describing the pull request, please include as much detail as possible regarding the changes made/new features added/performance improvements. If including any bug fixes, mention the issue numbers associated with the bugs.

  • Once you have submitted the pull request, three things will automatically occur:

    • The test suite will automatically run on Travis CI to ensure that the all tests continue to pass.
    • Once the test suite is finished, a code coverage report will be generated on Codecov. This will calculate the percentage of PennyLane covered by the test suite, to ensure that all new code additions are adequately tested.
    • Finally, the code quality is calculated by Codacy, to ensure all new code additions adhere to our code quality standards.

    Based on these reports, we may ask you to make small changes to your branch before merging the pull request into the master branch. Alternatively, you can also grant us permission to make changes to your pull request branch.

:fireworks: Thank you for contributing to PennyLane! :fireworks:

- The PennyLane team