Skip to content

Commit 349960d

Browse files
committed
Prepare for deployment to PyPi
Updated README.org to include a basic introduction and some details on how to contribute. Export README.org to markdown. Set long_description in setup.py to the text from README.md. Improved keywords in setup.py and set url to GitHub repository. Removed test_suite attribute from setup.py. Moved common unittest helpers from test package to bbpy.test package. Signed-off-by: BloggerBust <[email protected]>
1 parent 34f01f5 commit 349960d

File tree

11 files changed

+210
-26
lines changed

11 files changed

+210
-26
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ __pycache__/
44
# Distribution / packaging
55
build/
66
*.egg-info/
7+
.eggs/
78
dist/
89

910
# Artifacts

.projectile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
-/venv
22
-/build
33
-__pycache__
4-
-/*.egg-info
4+
-/*.egg-info
5+
-/.eggs

README.md

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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+

README.org

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#+TITLE: Blogger Bust Python Projects
2+
#+AUTHOR: BloggerBust
3+
#+DESCRIPTION: A place for me to store python code that I might want to blog about
4+
#+STARTUP: showeverything
5+
6+
* Introduction
7+
BbPyP (Blogger Bust Python Projects) is a collection of python packages that I intend to use to help develop other more interesting python projects.
8+
9+
* Projects
10+
** [[https://github.com/BloggerBust/lexicomb][Lexicomb]]
11+
12+
* How to contribute
13+
I am happy to accept pull requests. If you need to get a hold of me you can [[https://github.com/BloggerBust/bbpyp/issues][create an issue]] or [[https://bloggerbust.ca/about/][email me directly]].
14+
15+
** How to setup a developer environment
16+
First, [[https://github.com/login?return_to=%2FBloggerBust%2Fbbpyp][fork this repository]] and clone your fork to a local dev environment.
17+
#+begin_src sh
18+
git clone https://github.com/<your-username>/bbpyp.git
19+
#+end_src
20+
21+
Next, create a venv and install the latest pip and setuptools.
22+
#+begin_src sh
23+
cd bbpyp
24+
python -m venv venv
25+
source venv/bin/activate
26+
python -m pip install --upgrade pip setuptools
27+
#+end_src
28+
29+
Lastly, install the /dev/ extra requirements declared in [[file:setup.py][setup.py]] extras_require and run the unit tests.
30+
#+begin_src sh
31+
python -m pip install -e .[dev]
32+
python -m unittest discover
33+
#+end_src
34+
35+
** Where to do your work
36+
Make your changes in a feature branch keeping your mainline up to date with upstream.
37+
#+begin_src sh
38+
git checkout -b branch_name
39+
#+end_src
40+
41+
** Don't forget unit tests
42+
Unit tests are written using python's [[https://docs.python.org/3/library/unittest.html][unittest framework]] and [[https://docs.python.org/3/library/unittest.mock.html][mock library]]. Please do write unit tests to accommodate your contribution.
43+
44+
** Making commits
45+
Please read Chris Beams excellent [[https://chris.beams.io/posts/git-commit/][article on writing commit messages]] and do your best to follow his advice.
46+
47+
** Making a pull request
48+
If you feel that your changes would be appreciated upstream then it is time to create a pull request. Please [[*Don't forget unit tests][write unit tests]] and run all the tests again before making a pull request to defend against inadvertently braking something.
49+
#+begin_src sh
50+
python -m unittest discover
51+
#+end_src
52+
53+
Then create a squash branch and [[https://blog.carbonfive.com/2017/08/28/always-squash-and-rebase-your-git-commits/][rebase with a single squashed commit]]. 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.
54+
55+
First switch to master and fast forward to HEAD. This will reduce the risk of having a merge conflict later.
56+
#+begin_src sh
57+
git checkout master
58+
git fetch origin --prune
59+
git merge --ff-only origin/master
60+
#+end_src
61+
62+
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.
63+
#+begin_src sh
64+
git checkout branch_name
65+
git pull origin/master
66+
python -m unittest discover
67+
#+end_src
68+
69+
Then, create your squash branch and begin the interactive rebase following [[https://blog.carbonfive.com/2017/08/28/always-squash-and-rebase-your-git-commits/][this guidance]].
70+
#+begin_src sh
71+
git checkout -b branch_name_squash
72+
git rebase -i branch_name_squash
73+
#+end_src
74+
75+
Finally, push the squash branch to remote and [[https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request][create a pull request]].
76+
77+
78+
* License
79+
[[file:LICENSE-2.0.txt][Apache License v2.0]]

bbpyp/test/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.

readme.org

-15
This file was deleted.

setup.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ def read(fname):
1111
version="0.0.1",
1212
author="Trevor Wilson",
1313
author_email="[email protected]",
14-
description=("BloggerBust Projects"),
14+
description=("BloggerBust Python Projects common packages"),
1515
license="Apache License v2.0",
16-
keywords="BloggerBust projects: Message Bus, State machine, Lexical State Machine",
17-
url="https://bloggerbust.ca",
18-
# read('README.md'),
19-
long_description="Blogger Bust Python Projects",
16+
keywords="BloggerBust, Blogger Bust, Blogger Bust Projects, state machine, combinator, lexical, interpreter, message bus",
17+
url="https://github.com/BloggerBust/bbpyp",
18+
long_description=read('README.md'),
19+
long_description_content_type="text/markdown"
2020
classifiers=[
2121
"Development Status :: 2 - Pre-Alpha",
2222
"Topic :: Software Development",
@@ -36,7 +36,5 @@ def read(fname):
3636
"autopep8== 1.3.2"
3737
]
3838
},
39-
zip_safe=False, # sorry, no eggs
40-
41-
test_suite='test'
39+
zip_safe=False
4240
)

test/interpreter_state_machine/test_interpreter_state_machine.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
from mock import Mock, PropertyMock, patch, call
33

4-
from test.mock_helpers import set_property_mock
4+
from bbpyp.test.mock_helpers import set_property_mock
55
from bbpyp.interpreter_state_machine.interpreter_state import InterpreterState
66
from bbpyp.interpreter_state_machine.interpreter_state_machine import InterpreterStateMachine
77

test/lexical_state_machine/test_lexical_state_machine.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
from mock import Mock, PropertyMock, patch, sentinel, DEFAULT, call
33

4-
from test.mock_helpers import set_property_mock
4+
from bbpyp.test.mock_helpers import set_property_mock
55
from bbpyp.lexical_state_machine.lexical_state_machine import LexicalStateMachine
66
from bbpyp.lexical_state_machine.model.lexical_state import LexicalState
77

0 commit comments

Comments
 (0)