Skip to content

Files

Latest commit

0776a00 · Dec 19, 2021

History

History
189 lines (123 loc) · 3.61 KB

README_DEV.md

File metadata and controls

189 lines (123 loc) · 3.61 KB

olutils - developer documentation

travis codecov PyPI Latest Release

Basics

Download the project

Clone repository:

git clone https://github.com/OctaveLauby/olutils.git
cd olutils

One can make an editable code installation:

pip install -e .

Testing

Classic testing

python -m pytest tests -vv
python -m pylint olutils

Testing with coverage

coverage run -m pytest tests; coverage report

Or, if one has pytest-cov installed:

python -m pytest tests --cov

Virtual Environment

python -m venv venv
source venv/Scripts/activate
python -m pip install -r requirements.txt
...
deactivate

matplotlib does not have to be imported: plotting submodule is not loaded in that case

Release & Distribute

Release

  1. Check current version to know what is the next version

    git tag
  2. Create release branch from branch-to-release (usually dev)

    git checkout -b release/x.x.x
  3. Add related section in release notes, commit and push (even if not completed yet)

    git commit -m "Adding release note related to current release"
    git push --set-upstream origin release/x.x.x
    
  4. Create 2 pull requests on github:

    • on from {release_branch} to {dev} (name="Release/x.x.x Dev)
    • on from {release_branch} to {master} (name="Release/x.x.x)
  5. Fill up the release note + commit and push

    • Read commits descriptions
    • Go through all the Files Changes

    Fill free to complete missing documentations and add comments in code

  6. Update setup

    • Update version
    • Ensure install_requires have all requirements
  7. Run tests on clean venv

    rm -r venv
    python -m venv venv
    source venv/Scripts/activate
    python m pytest -vv

    If any error, fix issues + commit and push

  8. Merge dev pull request on github

    • Check the File Changes (one should see the new release note and the possible fixes he made)
    • Merge pull request

    One can redo tests locally just to be sure

  9. Merge master pull request on github + Delete branch

  10. Add tag and Push

    • Tag master
    git checkout master
    git pull
    git tag -a vx.x.x -m "Version x.x.x"
    • Tag dev
    git checkout dev
    git pull
    git tag -a vx.x.x-dev -m "Version x.x.x (dev)"
    • Push
    git push origin --tags
  11. Update local repo:

    • Remove release branch: git branch -d release/x.x.x

Distribution

First make sure to be on master branch with latest release.

  1. Install distribution libraries

    pip install check-manifest
    pip install twine
    pip install wheel
  2. Building manifest file:

    check-manifest --create
  3. Building the wheel:

    python setup.py bdist_wheel
  4. Building the source distribution:

    python setup.py sdist
  5. Publishing:

    python setup.py bdist_wheel sdist
    twine upload dist/*

For TestPyPi publication: twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Not working on Git terminal for some reason