Skip to content

Developer Guide

Zhiyi Wu edited this page Dec 6, 2022 · 21 revisions

Overview over the development process of alchemlyb and alchemtest. (The developer guide is an evolving document. Please modify as necessary.)

Development

Development happens on the master branch. The master branch is supposed to be installable and produce correct results at any time. We therefore insist on merging code that is covered by tests to about 90% coverage level (i.e., 90% of the lines of code are exercised by tests).

Pull Request, Review, Merge Model

  • We use a Pull Request, Review, Merge model for code development with continuous integration: code can only be added to master through a PR. The PR has to pass
    • code review by another developer with write access to the repo
    • unit tests (all existing tests pass)
    • coverage testing (new code comes with tests to check the majority of its functionality)
  • For each PR, the whole test suite is run (on Travis CI). If your PR does not pass tests then it will typically not be accepted. Ask for help (ping other developers with @NAME mentioning them in the comments of your PR).
  • PRs are typically merged (or rebased onto master) but sometimes the developer in charge can also decide to squash all commits (especially when there are many incremental commits) in order to keep the history clean.

For more details see How to do PRs.

Contributing

Fork the repository and create a PR or, if you have write access to the repo, create a branch in the repo. Name the branch issue-XXX-SUMMARY where you typically reference an issue in the issue tracker and SUMMARY is a very short description, e.g., issue-10-Amber-parser (to reference issue #10).

Discuss all issues related to a PR in the comments to the PR.

As a new contributor, add yourself to the file AUTHORS.

Style Guide

We use black since PR #280 so you don't need to think too hard about Python code formatting.

For doc strings we follow the NumPy docstring standard.

Testing

We use pytest. We use fixtures to set up data for the tests.

Since PR #278, the parsing operations for non-parsing related unit tests are done at the conftest.py as a fixture and made available globally for all tests (see Issue #206 for additional details). Any additional operations should be made in the local test file.

New code should be covered to nearly 100% with tests.

Release management

Parts of the process are automated. Releasing requires setting a release git tag and creating a release from the tag in GitHub. Follow the steps below.

Tagging a release

  • We use semantic versioning MAJOR.MINOR.PATCH (i.e., briefly, major revision changes whenever the API changes in backwards-incompatible manner, MINOR changes for new features, PATCH changes for fixes that correct functionality; as long as MAJOR == 0, we can break the API with increasing MINOR.)

  • Finalize CHANGES.

  • Releases are cut from the master branch and tagged with MAJOR.MINOR.PATCH (note: the release tag determines the tag because we use versioneer, which obtains the release number from the git tag). We do from the master branch for the PyPI release

    1. git tag <major>.<minor>.<patch>
    2. git push --tags
  • Note: the tags need to be pushed to GitHub with git push --tags. (You can add text to the releases on GitHub.)

  • This will automatically trigger a github action (named deploy) to use pypa's build tool to create a tarball and & pure Python wheel and upload it on testpypi

Test the package

  • Once uploaded to testpypi, please check locally that the build is working as intended. In a clean environment do:
    1. pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple alchemlyb=="version number"
    2. pip install pytest
    3. pip install https://github.com/alchemistry/alchemtest/archive/master.zip
    4. pytest --pyargs alchemlyb

PyPi release

  • After a successful test of the testpypi package, create a release on GitHub; zenodo DOIs and snapshots are automatically minted.
  • The release will trigger the deploy action again, which will this time upload the tarball and wheel to PyPI.

Conda package

Conda releases are still experimental (Jun 2022)

Make a release on PyPi and wait for the regrocf autobot to open a PR on the feedstock. If there are no problems, the bot will aut-merge and the conda package will be built. (This can take up to 24h.) If there are issues, review, fix, and then and manually merge the PR.

Clone this wiki locally