|
| 1 | + |
| 2 | +# Table of Contents |
| 3 | + |
| 4 | +1. [Introduction](#orgbb07392) |
| 5 | +2. [Projects](#org4061666) |
| 6 | + 1. [Lexicomb](#org41bac77) |
| 7 | +3. [How to contribute](#org4c9fbeb) |
| 8 | + 1. [How to setup a developer environment](#org08111cd) |
| 9 | + 2. [Where to do your work](#org80c01b6) |
| 10 | + 3. [Don't forget unit tests](#org296fb67) |
| 11 | + 4. [Making commits](#org44907d6) |
| 12 | + 5. [Making a pull request](#org344437c) |
| 13 | +4. [License](#orgc67d713) |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +<a id="orgbb07392"></a> |
| 18 | + |
| 19 | +# Introduction |
| 20 | + |
| 21 | +BbPyP (Blogger Bust Python Projects) is a collection of python packages that I intend to use to help develop other more interesting python projects. |
| 22 | + |
| 23 | + |
| 24 | +<a id="org4061666"></a> |
| 25 | + |
| 26 | +# Projects |
| 27 | + |
| 28 | + |
| 29 | +<a id="org41bac77"></a> |
| 30 | + |
| 31 | +## [Lexicomb](https://github.com/BloggerBust/lexicomb) |
| 32 | + |
| 33 | + |
| 34 | +<a id="org4c9fbeb"></a> |
| 35 | + |
| 36 | +# How to contribute |
| 37 | + |
| 38 | +I am happy to accept pull requests. If you need to get a hold of me you can [create an issue](https://github.com/BloggerBust/bbpyp/issues) or [email me directly](https://bloggerbust.ca/about/). |
| 39 | + |
| 40 | + |
| 41 | +<a id="org08111cd"></a> |
| 42 | + |
| 43 | +## How to setup a developer environment |
| 44 | + |
| 45 | +First, [fork this repository](https://github.com/login?return_to=%2FBloggerBust%2Fbbpyp) and clone your fork to a local dev environment. |
| 46 | + |
| 47 | + git clone https://github.com/<your-username>/bbpyp.git |
| 48 | + |
| 49 | +Next, create a venv and install the latest pip and setuptools. |
| 50 | + |
| 51 | + cd bbpyp |
| 52 | + python -m venv venv |
| 53 | + source venv/bin/activate |
| 54 | + python -m pip install --upgrade pip setuptools |
| 55 | + |
| 56 | +Lastly, install the *dev* extra requirements declared in [setup.py](setup.py) extras<sub>require</sub> and run the unit tests. |
| 57 | + |
| 58 | + python -m pip install -e .[dev] |
| 59 | + python -m unittest discover |
| 60 | + |
| 61 | + |
| 62 | +<a id="org80c01b6"></a> |
| 63 | + |
| 64 | +## Where to do your work |
| 65 | + |
| 66 | +Make your changes in a feature branch keeping your mainline up to date with upstream. |
| 67 | + |
| 68 | + git checkout -b branch_name |
| 69 | + |
| 70 | + |
| 71 | +<a id="org296fb67"></a> |
| 72 | + |
| 73 | +## Don't forget unit tests |
| 74 | + |
| 75 | +Unit tests are written using python's [unittest framework](https://docs.python.org/3/library/unittest.html) and [mock library](https://docs.python.org/3/library/unittest.mock.html). Please do write unit tests to accommodate your contribution. |
| 76 | + |
| 77 | + |
| 78 | +<a id="org44907d6"></a> |
| 79 | + |
| 80 | +## Making commits |
| 81 | + |
| 82 | +Please read Chris Beams excellent [article on writing commit messages](https://chris.beams.io/posts/git-commit/) and do your best to follow his advice. |
| 83 | + |
| 84 | + |
| 85 | +<a id="org344437c"></a> |
| 86 | + |
| 87 | +## Making a pull request |
| 88 | + |
| 89 | +If you feel that your changes would be appreciated upstream then it is time to create a pull request. Please [write unit tests](#org296fb67) and run all the tests again before making a pull request to defend against inadvertently braking something. |
| 90 | + |
| 91 | + python -m unittest discover |
| 92 | + |
| 93 | +Then create a squash branch and [rebase with a single squashed commit](https://blog.carbonfive.com/2017/08/28/always-squash-and-rebase-your-git-commits/). A squash branch is just a spin-off branch where you can perform the squash and rebase without the fear of corrupting your feature branch. My preference is to perform an interactive rebase. Note, that a squash branch is pointless if you only made a single commit. |
| 94 | + |
| 95 | +First switch to master and fast forward to HEAD. This will reduce the risk of having a merge conflict later. |
| 96 | + |
| 97 | + git checkout master |
| 98 | + git fetch origin --prune |
| 99 | + git merge --ff-only origin/master |
| 100 | + |
| 101 | +Next, switch back to your feature branch and pull any changes fetched to master. If there are conflicts, then resolve them. Be sure to run all the tests once more if you had to merge with changes from upstream. |
| 102 | + |
| 103 | + git checkout branch_name |
| 104 | + git pull origin/master |
| 105 | + python -m unittest discover |
| 106 | + |
| 107 | +Then, create your squash branch and begin the interactive rebase following [this guidance](https://blog.carbonfive.com/2017/08/28/always-squash-and-rebase-your-git-commits/). |
| 108 | + |
| 109 | + git checkout -b branch_name_squash |
| 110 | + git rebase -i branch_name_squash |
| 111 | + |
| 112 | +Finally, push the squash branch to remote and [create a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request). |
| 113 | + |
| 114 | + |
| 115 | +<a id="orgc67d713"></a> |
| 116 | + |
| 117 | +# License |
| 118 | + |
| 119 | +[Apache License v2.0](LICENSE-2.0.txt) |
| 120 | + |
0 commit comments