Skip to content
Abhinav kumar edited this page Dec 30, 2023 · 6 revisions

Developer's guide

  1. Quickstart by forking the main repository https://github.com/PolyPhyHub/PolyPhy

  2. Clone your copy of the repository

    1. Using https git clone https://github.com/[YourUsername]/polyphy.git
    2. Using ssh git clone [email protected]:[YourUsername]/polyphy.git
  3. Link or point your cloned copy to the main repository. (I always name it upstream)

    1. git remote add upstream https://github.com/PolyPhyHub/PolyPhy.git
  4. Check/confirm your settings using git remote -v

origin      [email protected]:[YourUsername]/polyphy.git (fetch)
origin      [email protected]:[YourUsername]/polyphy.git (push)
upstream    https://github.com/PolyPhyHub/PolyPhy.git (fetch)
upstream    https://github.com/PolyPhyHub/PolyPhy.git (push)
  1. Install the package from the main directory. use -U or –upgrade to upgrade or overwrite any previously installed versions.
pip install . -U
  1. Check if the package was installed
polyphy -v

Required Modules

You will need Python 3.8+ Make sure the required modules are installed: Pip install -r requirements.txt

Developers need to install these extra packages.

pip install codecov
pip install coverage
pip install flake8
pip install matplotlib
pip install numpy
pip install pylint
pip install pytest
pip install pytest-cov
pip install pytest-xdist
pip install setuptools
pip install sphinx
pip install taichi
pip install toml
pip install yapf

Installation

Either install from source as

pip install . --upgrade
or
pip install . -U
or
python setup.py install

or install in development mode.

python setup.py develop
or
pip install -e .

For more about installing refer to the python setuptools documentation. you can also install from Git.

# Local repository
pip install git+file:///path/to/your/git/repo #  test a PIP package located in a local git repository
pip install git+file:///path/to/your/git/repo@branch  # checkout a specific branch by adding @branch_name at the end

# Remote GitHub repository
pip install git+git://github.com/myuser/myproject  #  package from a GitHub repository
pip install git+git://github.com/myuser/myproject@my_branch # github repository Specific branch

Running tests locally

From the source top-level directory, Use Pytest as examples below

$   pytest -v # All tests

Style Guide for Python Code

Use yapf -d --recursive polyphy/ --style=.style.yapf to check style. Use yapf -i --recursive polyphy/ --style=.style.yapf refactor style.

Continuous Integration

The main GitHub repository runs the test on GitHub Actions (Ubuntu-latest and Ubuntu 20.04).

Pull requests submitted to the repository will automatically be tested using these systems and results reported in the checks section of the pull request page.

Create Release

Start

  1. Run the tests.

  2. Update CHANGELOG.rst with major updates since the last release

  3. Update the version number bumpversion release or provide a version as bumpversion –new-version 3.1.0

  4. On Github draft a release with the version changes. Provide a version as tag and publish.

  5. After the release, update the version to dev, run bumpversion patch

Release on Test PyPi and PyPi is handled by Github actions using tox.

git push upstream main
git push upstream --tags

Collaborative Workflows with GitHub

This will update your .git/config to point to your repository copy of the Polyphy as remote “origin” To fetch pull requests you can add fetch = +refs/pull//head:refs/remotes/origin/pr/ to your .git/config as below. .. code-block:: bash

[remote “upstream”] url = https://github.com/PolyPhyHub/PolyPhy.git fetch = +refs/heads/:refs/remotes/upstream/ # To fetch pull requests add fetch = +refs/pull//head:refs/remotes/origin/pr/

Fetch upstream main and create a branch to add the contributions to.

git fetch upstream
git checkout main
git reset --hard upstream/main
git checkout -b [new-branch-to-fix-issue]

Please read the contribution docs.