Skip to content

Commit 3969bbf

Browse files
committed
[DOCS] Reference the 'biskotaki' pypi package as a generated example from this Template
2 parents 29ffada + 1973d2c commit 3969bbf

File tree

5 files changed

+171
-48
lines changed

5 files changed

+171
-48
lines changed

README.rst

Lines changed: 130 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ Python Package (pypi) Cookiecutter, with emphasis on CI/CD and automation.
77
88
| |build| |release_version| |wheel| |supported_versions| |commits_since_specific_tag_on_master| |commits_since_latest_github_release|
99
10-
1110
|
1211
| **Source Code:** https://github.com/boromir674/cookiecutter-python-package
1312
| **Pypi Package:** https://pypi.org/project/cookiecutter-python/
14-
|
15-
13+
| **CI Pipeline:** https://github.com/boromir674/cookiecutter-python-package/actions/
1614
1715
.. Test Workflow Status on Github Actions for specific branch <branch>
1816
@@ -34,9 +32,9 @@ Python Package (pypi) Cookiecutter, with emphasis on CI/CD and automation.
3432
:alt: Supported Python versions
3533
:target: https://pypi.org/project/cookiecutter_python
3634

37-
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v0.6.1/master?color=blue&logo=github
35+
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v0.7.2/master?color=blue&logo=github
3836
:alt: GitHub commits since tagged version (branch)
39-
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v0.6.1..master
37+
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v0.7.2..master
4038

4139
.. |commits_since_latest_github_release| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/latest?color=blue&logo=semver&sort=semver
4240
:alt: GitHub commits since latest release (by SemVer)
@@ -55,63 +53,131 @@ Python Package (pypi) Cookiecutter, with emphasis on CI/CD and automation.
5553
:target: https://scrutinizer-ci.com/g/boromir674/cookiecutter-python-package/?branch=master
5654

5755

58-
59-
6056
Features
6157
========
6258

63-
- Python Package Project generation
64-
- CI pipeline to test against multiple Python versions and Platforms
65-
- One-line commands for DevOps activities such as 'package', 'build', 'deploy'
66-
- Test Suite, using Pytest
59+
1. Fresh **Python Package Project Generation**, "packaged" with a **Test Suite** and a **CI** Pipeline (see `Quickstart`_)
60+
2. **Python Package Template** (source code at `src/cookiecutter_python/`_) implemented as a `Cookiecutter`
61+
3. **Tested** on python versions **3.6, 2.7, 3.8, 3.9 and 3.10**, for both **"Linux"** and **"MacOS"** platforms (see `Test Workflow` on `CI`_)
62+
63+
See the **Biskotaki** *Python Package Project*, which was entirely generated using this **Python Package Template:**
64+
65+
* **Source Code** hosted on *Github* at https://github.com/boromir674/biskotaki
66+
* **Python Package** hosted on *pypi.org* at https://pypi.org/project/biskotaki/
67+
* **CI Pipeline** hosted on *Github Actions* at https://github.com/boromir674/biskotaki/actions
68+
69+
Generated Python Package Features
70+
---------------------------------
71+
72+
1. **Test Suite** using `pytest`_
73+
2. **Parallel Execution** of Unit Tests, on multiple cpu's
74+
3. **Automation**, using `tox`_
75+
76+
a. **Code Coverage** measuring
77+
b. **Build Command**, using the `build`_ python package
78+
c. **Pypi Deploy Command**, supporting upload to both `pypi.org`_ and `test.pypi.org`_ servers
79+
d. **Type Check Command**, using `mypy`_
80+
4. **CI Pipeline**, running on `Github Actions`_
81+
82+
a. **Job Matrix**, spanning different `platform`'s and `python version`'s
83+
84+
1. Platfroms: `ubuntu-latest`, `macos-latest`
85+
2. Python Interpreters: `3.6`, `3.7`, `3.8`, `3.9`, `3.10`
86+
b. **Parallel Job** execution, generated from the `matrix`, that runs the `Test Suite`
87+
6788

89+
Quickstart
90+
==========
6891

6992
Prerequisites
70-
=============
93+
-------------
7194

7295
You need to have Cookiecutter installed.
7396
Check the `Cookiecutter documentation`_ pages for more on Cookiecutter.
7497

7598

7699
Usage
77-
=====
78-
79-
Simply, get (clone) the code and generate a Project based on the (downloaded) template.
100+
-----
80101

81102
Open a console/terminal and run:
82103

83-
.. code-block:: sh
104+
.. code-block:: sh
84105
85-
git clone git@github.com:boromir674/cookiecutter-python-package.git
106+
git clone git@github.com:boromir674/cookiecutter-python-package.git
107+
cookiecutter cookiecutter-python-package/src/cookiecutter_python
86108
87-
cookiecutter cookiecutter-python-package/src/cookiecutter_python
109+
Now, you should have generated a new Project for a Python Package, based on the `Template`_!
88110

111+
Just 'enter' (`cd` into) the newly created directory, ie `cd <my-great-python-package>`.
89112

90-
This will generate a new `Python Package Project` (in the currect dir), using the template from github.
91-
It shall prompt you to enter the necessary initial information to generate the project in a typical cookiecutter fashion.
113+
Develop your package's **Source Code** (`business logic`) inside `src/my_great_python_package` dir :)
92114

115+
Develop your package's **Test Suite** (ie `unit-tests`, `integration tests`) inside `tests` dir :)
93116

94-
Modifying the Template
95-
======================
96117

97-
You can always adjust the template to your needs, before generating a new Project.
118+
Try yourself!
119+
^^^^^^^^^^^^^
98120

99-
Open a console/terminal and run:
121+
You are ready to enjoy some of the package's **features** available out-of-the-box!
122+
123+
For instance:
124+
125+
1. Leverage the supplied `tox environments` to automate various **Testing** and **DevOps** related activities.
126+
127+
Assuming you have `tox` installed (example installation command: `python3 -m pip install --user tox`)
128+
and you have done a `cd` into the newly generated Project directory, you can do for example:
129+
130+
a. Run the **Test Suite** against different combinations of `Python versions` (ie 3.7, 3.8) and different ways of installing (ie 'dev', 'sdist', 'wheel') the `<my_great_python_package>` package:
131+
132+
.. code-block:: sh
133+
134+
tox -e "py{3.7, 3.8}-{dev, sdist, wheel}"
135+
136+
b. Check the code for **compliance** with **best practises** of the `Python packaging ecosystem` (ie PyPI, pip),
137+
build `sdist` and `wheel` distributions and store them in the `dist` directory:
138+
139+
.. code-block:: sh
140+
141+
tox -e check && tox -e build
142+
143+
c. **Deploy** the package's distributions in a `pypi` (index) server:
100144

101-
.. code-block:: bash
145+
1. Deploy to **staging**, using the `test` pypi (index) server at `test.pypi.org`_:
102146

103-
git clone git@github.com:boromir674/cookiecutter-python-package.git
104-
cd cookiecutter-python-package
147+
.. code-block:: sh
105148
149+
TWINE_USERNAME=username TWINE_PASSWORD=password PACKAGE_DIST_VERSION=1.0.0 tox -e deploy
106150
107-
Now, you should be inside the `cookiecutter-python-package` repository (directory)
108-
and the actual Template, that you can modify, is inside the `src/cookiecutter_python` sub directory.
151+
2. Deploy to **production**, using the `production` pypi (index) server at `pypi.org`_:
109152

110-
After, finishing the modifications you can run something like:
153+
.. code-block:: sh
111154
112-
.. code-block:: bash
155+
TWINE_USERNAME=username TWINE_PASSWORD=password PACKAGE_DIST_VERSION=1.0.0 PYPI_SERVER=pypi tox -e deploy
113156
114-
cookiecutter src/cookiecutter_python --output-dir <your-new-project-dir>
157+
.. note::
158+
Setting PYPI_SERVER=pypi indicates to deploy to `pypi.org` (instead of `test.pypi.org`).
159+
160+
.. note::
161+
Please modify the TWINE_USERNAME, TWINE_PASSWORD and PACKAGE_DIST_VERSION envronment variables, accordingly.
162+
163+
TWINE_USERNAME & TWINE_PASSWORD are used to authenticate (user credentials) with the targeted pypi server.
164+
165+
PACKAGE_DIST_VERSION is used to avoid accidentally uploading distributions of different versions than intented.
166+
167+
168+
2. Leverage the **CI Pipeline** and its **build matrix** to run the **Test Suite** against a combination of
169+
different Platforms, different Python interpreter versions and different ways of installing the subject Python Package:
170+
171+
`Trigger` the **Test Workflow** on the **CI server**, by `pushing` a git commit to a remote branch (ie `master` on github).
172+
173+
`Navigate` to the `CI Pipeline web interface` (hosted on `Github Actions`) and inspect the **build** results!
174+
175+
176+
.. note::
177+
You might have already `pushed`, in case you answered `yes`, in the `initialize_git_repo` prompt, while generating the Python Package,
178+
and in that case, the **Test Workflow** should have already started running!
179+
180+
Out-of-the-box, `triggering` the **Test Workflow** happens only when pushing to the `master` or `dev` branch.
115181

116182

117183
License
@@ -120,7 +186,39 @@ License
120186
* Free software: Affero GNU General Public License v3.0
121187

122188

189+
Notes
190+
=====
191+
192+
Currently, since the actual `cookiecutter` template does not reside on the `root` directory
193+
of the repository (but rather in `src/cookiecutter_python`), 'cloning' the repository
194+
locally is required at first.
195+
196+
This was demonstrated in the `quickstart` section, as well.
197+
198+
For more complex use cases, you can modify the Template and also leverage all of
199+
`cookiecutter`'s features, according to your needs.
200+
123201

124202
.. URL LINKS
125203
126204
.. _Cookiecutter documentation: https://cookiecutter.readthedocs.io/en/stable/
205+
206+
.. _CI: https://github.com/boromir674/cookiecutter-python-package/actions
207+
208+
.. _tox: https://tox.wiki/en/latest/
209+
210+
.. _pytest: https://docs.pytest.org/en/7.1.x/
211+
212+
.. _build: https://github.com/pypa/build
213+
214+
.. _pypi.org: https://pypi.org/
215+
216+
.. _test.pypi.org: https://test.pypi.org/
217+
218+
.. _mypy: https://mypy.readthedocs.io/en/stable/
219+
220+
.. _Github Actions: https://github.com/boromir674/cookiecutter-python-package/actions
221+
222+
.. _src/cookiecutter_python/: https://github.com/boromir674/cookiecutter-python-package/tree/master/src/cookiecutter_python
223+
224+
.. _Template: https://github.com/boromir674/cookiecutter-python-package/tree/master/src/cookiecutter_python

setup.cfg

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[metadata]
22
## Setuptools specific information
33
name = cookiecutter_python
4-
version = 0.6.1
4+
version = 0.7.2
55
# renders on pypi as subtitle
66
description = Yet another modern Python Package (pypi) with emphasis in CI/CD and automation
77
long_description = file: README.rst
@@ -15,16 +15,19 @@ author_email = k.lampridis@hotmail.com
1515
# represents the web home page of the project
1616
url = https://github.com/boromir674/cookiecutter-python-package
1717

18-
download_url = https://github.com/boromir674/cookiecutter-python-package/archive/v0.6.1.tar.gz
18+
download_url = https://github.com/boromir674/cookiecutter-python-package/archive/v0.7.2.tar.gz
1919

2020
## PyPi specific information
2121
project_urls =
22-
Documentation = https://cookiecutter-python-package.readthedocs.io/
2322
Bug Tracker = https://github.com//cookiecutter-python-package/issues
23+
CI: Github Actions = https://github.com/boromir674/cookiecutter-python-package/actions
24+
Documentation = https://cookiecutter-python-package.readthedocs.io/
2425
Source Code = https://github.com/boromir674/cookiecutter-python-package
2526
; Changelog = https://cookiecutter-python-package.readthedocs.io/en/stable/changelog.html
27+
; Code of Conduct = TODO
28+
; Mailing lists =
2629

27-
keywords = python library
30+
keywords = python package template, python package generator, cookiecutter, python package
2831
classifiers =
2932
Development Status :: 5 - Production/Stable
3033
Intended Audience :: Developers
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.6.1'
1+
__version__ = '0.7.2'

src/cookiecutter_python/{{ cookiecutter.project_slug }}/README.rst

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,36 @@
4444
Features
4545
========
4646

47-
- TODO-feature 1
48-
- TODO-feature 2
47+
48+
1. **{{ cookiecutter.pkg_name }}** `python package`
49+
50+
a. **Great Feature**
51+
b. **Nice Feature**
52+
53+
2. **Test Suite** using `Pytest`
54+
3. **Parallel Execution** of Unit Tests, on multiple cpu's
55+
4. **Automation**, using `tox`
56+
57+
a. **Code Coverage** measuring
58+
b. **Build Command**, using the `build` python package
59+
c. **Pypi Deploy Command**, supporting upload to both `pypi.org` and `test.pypi.org` servers
60+
d. **Type Check Command**, using `mypy`
61+
5. **CI Pipeline**, running on `Github Actions`
62+
63+
a. **Job Matrix**, spanning different `platform`'s and `python version`'s
64+
65+
1. Platfroms: `ubuntu-latest`, `macos-latest`
66+
2. Python Iterpreters: `3.6`, `3.7`, `3.8`, `3.9`, `3.10`
67+
b. **Parallel Job** execution, generated from the `matrix`, that runs the `Test Suite`
68+
4969

5070
Prerequisites
5171
=============
5272

53-
You need to have Python installed.
73+
You need to have `Python` installed.
5474

55-
Installation
56-
============
75+
Quickstart
76+
==========
5777

5878
Using `pip` is the approved way for installing `{{ cookiecutter.pkg_name }}`.
5979

@@ -62,10 +82,7 @@ Using `pip` is the approved way for installing `{{ cookiecutter.pkg_name }}`.
6282
python3 -m pip install {{ cookiecutter.pkg_name }}
6383
6484
65-
Usage
66-
=====
67-
68-
TODO
85+
TODO demonstrate a use case
6986

7087
License
7188
=======

src/cookiecutter_python/{{ cookiecutter.project_slug }}/setup.cfg

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ url = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo
1717

1818
download_url = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}/archive/v{{ cookiecutter.version }}.tar.gz
1919

20+
2021
## PyPi specific information
2122
project_urls =
23+
Bug Tracker = https://github.com/{{ cookiecutter.repo_name }}/issues
24+
CI: Github Actions = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}/actions
2225
Documentation = https://{{ cookiecutter.repo_name }}.readthedocs.io/
23-
Bug Tracker = https://github.com//{{ cookiecutter.repo_name }}/issues
2426
Source Code = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}
2527
; Changelog = https://{{ cookiecutter.repo_name }}.readthedocs.io/en/stable/changelog.html
28+
; Code of Conduct = TODO
29+
; Mailing lists =
30+
2631

27-
keywords = python library
32+
keywords = python package,
2833
classifiers =
2934
Development Status :: 5 - Production/Stable
3035
Intended Audience :: Developers

0 commit comments

Comments
 (0)