Skip to content

Commit 3e09403

Browse files
committed
[NEW] Python Generator CLI and Async features
2 parents c1f9b39 + c9b125f commit 3e09403

32 files changed

+958
-248
lines changed

.github/biskotaki.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ default_context:
99
author_email: k.lampridis@hotmail.com
1010
github_username: boromir674
1111
project_short_description: Project generated from the https://github.com/boromir674/cookiecutter-python-package/tree/master/src/cookiecutter_python cookiecutter
12-
initialize_git_repo: "no"
12+
initialize_git_repo: yes

.github/workflows/generate.yaml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,23 @@ jobs:
8787
8888
- name: Generate Biskotaki from Template
8989
run: |
90+
pip install --user -e .
9091
echo " version: \"${{ env.BISKOTAKI_VERSION }}\"" >> .github/biskotaki.yaml
91-
cookiecutter ./src/cookiecutter_python -o gen --config-file ./.github/biskotaki.yaml --no-input
92+
generate-python -o gen --config-file ./.github/biskotaki.yaml --no-input
9293
93-
# - name: Test against multiple 'installation' scenarios
94-
# run: |
95-
# cd gen/biskotaki
96-
# tox -e "py38{, -path, -sdist, -wheel, -dev}"
97-
# env:
98-
# PKG_VERSION: ${{ env.BISKOTAKI_VERSION }}
99-
# - name: Test Operations such as 'build process' and 'linting'
100-
# run: |
101-
# cd gen/biskotaki
102-
# tox -e check
103-
# tox -e build
104-
# tox -e lint
105-
# tox -e graphs
94+
- name: Test against multiple 'installation' scenarios
95+
run: |
96+
cd gen/biskotaki
97+
tox -e "py38{, -path, -sdist, -wheel, -dev}"
98+
env:
99+
PKG_VERSION: ${{ env.BISKOTAKI_VERSION }}
100+
- name: Test Operations such as 'build process' and 'linting'
101+
run: |
102+
cd gen/biskotaki
103+
tox -e check
104+
tox -e build
105+
tox -e lint
106+
tox -e graphs
106107
107108
- name: Push to dedicated branch in biskotaki repo
108109
uses: cpina/github-action-push-to-another-repository@main

.github/workflows/test.yaml

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
strategy:
2222
matrix:
2323
platform: [ubuntu-latest, macos-latest]
24-
# platform: [ubuntu-latest]
25-
# python-version: ["3.6", "3.10"]
2624
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
2725

2826
steps:
@@ -45,32 +43,32 @@ jobs:
4543
- name: Check for compliance with Python Best Practices
4644
run: tox -e check -vv -s false
4745

48-
# - name: Specify current package version to assist build tool
49-
# run: echo "PKG_VERSION=$(python scripts/parse_version.py)" >> $GITHUB_ENV
46+
- name: Specify current package version to assist build tool
47+
run: echo "PKG_VERSION=$(python scripts/parse_version.py)" >> $GITHUB_ENV
5048

51-
# - name: Run Test Suite
52-
# run: tox -vv -s false
53-
# env:
54-
# PLATFORM: ${{ matrix.platform }}
49+
- name: Run Test Suite
50+
run: tox -vv -s false
51+
env:
52+
PLATFORM: ${{ matrix.platform }}
5553

56-
# - name: Install coverage.py
57-
# run: python -m pip install coverage
54+
- name: Install coverage.py
55+
run: python -m pip install coverage
5856

59-
# - name: Aggregate Test Suite Coverage Data
60-
# run: |
61-
# python -m pip install coverage
62-
# tox -e coverage --sitepackages -vv -s false
57+
- name: Aggregate Test Suite Coverage Data
58+
run: |
59+
python -m pip install coverage
60+
tox -e coverage --sitepackages -vv -s false
6361
64-
# # TODO Delegate uploading to codecov to a another Job
65-
# - name: Upload coverage to Codecov
66-
# uses: codecov/codecov-action@v2
67-
# with:
68-
# directory: ./.tox/
69-
# env_vars: OS,PYTHON
70-
# fail_ci_if_error: true
71-
# files: ./.tox/coverage.xml
72-
# flags: unittests
73-
# name: codecov-umbrella
74-
# verbose: true
62+
# TODO Delegate uploading to codecov to a another Job
63+
- name: Upload coverage to Codecov
64+
uses: codecov/codecov-action@v2
65+
with:
66+
directory: ./.tox/
67+
env_vars: OS,PYTHON
68+
fail_ci_if_error: true
69+
files: ./.tox/coverage.xml
70+
flags: unittests
71+
name: codecov-umbrella
72+
verbose: true
7573

7674
# TODO find build tar.gz whl files and upload as artefacts

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@ node_modules
2020
dependency-graphs/
2121
test-results/
2222
uml-diagrams/
23-
pydoer-graphs/
23+
pydoer-graphs/
24+
25+
package-lock\.json
26+
package\.json

.pylintrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ contextmanager-decorators=contextlib.contextmanager
227227
# List of members which are set dynamically and missed by pylint inference
228228
# system, and so shouldn't trigger E1101 when accessed. Python regular
229229
# expressions are accepted.
230-
generated-members=_transform|self\.objects|self\._observers
230+
generated-members=_transform|self\.objects|self\._observers|subclasses
231231

232232
# Tells whether missing members accessed in mixin class should be ignored. A
233233
# mixin class is detected if its name ends with "mixin" (case insensitive).
@@ -279,7 +279,12 @@ missing-member-hint-distance=1
279279
missing-member-max-choices=1
280280

281281
# List of decorators that change the signature of a decorated function.
282-
signature-mutators=
282+
signature-mutators=click.decorators.option,
283+
click.decorators.argument,
284+
click.decorators.version_option,
285+
click.decorators.help_option,
286+
click.decorators.pass_context,
287+
click.decorators.confirmation_option
283288

284289

285290
[BASIC]

CHANGELOG.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22
Changelog
33
=========
44

5+
1.1.0 (2022-05-17)
6+
==================
7+
8+
Wrapping everything in a *command line interface* (cli).
9+
Speed up performance by using *futures* for http requests.
10+
11+
Changes
12+
^^^^^^^
13+
14+
feature
15+
"""""""
16+
- allow user to control parameters of the project generation process
17+
- expose project generator through an interactive cli
18+
- add async capabilities to the pre_gen_project.py for faster network bound operations
19+
20+
documentation
21+
"""""""""""""
22+
- demonstrate how to install and use the cli
23+
24+
ci
25+
""
26+
- update workflow to install and use the 'generate-python' cli
27+
28+
529
1.0.0 (2022-05-11)
630
==================
731

README.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ Generated Python Package Features
6161
Quickstart
6262
==========
6363

64-
Prerequisites
65-
-------------
64+
Installation
65+
------------
6666

67-
You need to have Cookiecutter installed.
68-
Check the `Cookiecutter documentation`_ pages for more on Cookiecutter.
67+
.. code-block: shell
68+
69+
pip install --user cookiecutter-python
6970
7071
7172
Usage
@@ -75,8 +76,7 @@ Open a console/terminal and run:
7576

7677
.. code-block:: sh
7778
78-
git clone git@github.com:boromir674/cookiecutter-python-package.git
79-
cookiecutter cookiecutter-python-package/src/cookiecutter_python
79+
generate-python
8080
8181
Now, you should have generated a new Project for a Python Package, based on the `Template`_!
8282

@@ -89,7 +89,7 @@ Now, you should have generated a new Project for a Python Package, based on the
8989
Try Running the Test Suite!
9090

9191
.. code-block:: shell
92-
92+
9393
tox
9494
9595
@@ -147,7 +147,7 @@ For more complex use cases, you can modify the Template and also leverage all of
147147

148148
.. _Template: https://github.com/boromir674/cookiecutter-python-package/tree/master/src/cookiecutter_python
149149

150-
.. _Use Cases: https://python-package-generator.readthedocs.io/en/master/usage/use_cases.html
150+
.. _Use Cases: https://python-package-generator.readthedocs.io/en/master/contents/30_usage/index.html#new-python-package-use-cases
151151

152152
.. _GNU Affero General Public License v3.0: https://github.com/boromir674/cookiecutter-python-package/blob/master/LICENSE
153153

@@ -196,9 +196,9 @@ For more complex use cases, you can modify the Template and also leverage all of
196196

197197
.. Github Releases & Tags
198198
199-
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v1.0.0/master?color=blue&logo=github
199+
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v1.1.0/master?color=blue&logo=github
200200
:alt: GitHub commits since tagged version (branch)
201-
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v1.0.0..master
201+
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v1.1.0..master
202202

203203
.. |commits_since_latest_github_release| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/latest?color=blue&logo=semver&sort=semver
204204
:alt: GitHub commits since latest release (by SemVer)
@@ -235,16 +235,16 @@ For more complex use cases, you can modify the Template and also leverage all of
235235
236236
.. |codacy| image:: https://app.codacy.com/project/badge/Grade/5be4a55ff1d34b98b491dc05e030f2d7
237237
:alt: Codacy
238-
:target: https://www.codacy.com/gh/boromir674/cookiecutter-python-package/dashboard?utm_source=github.com&utm_medium=referral&utm_content=boromir674/cookiecutter-python-package&utm_campaign=Badge_Grade
238+
:target: https://app.codacy.com/gh/boromir674/cookiecutter-python-package/dashboard?utm_source=github.com&utm_medium=referral&utm_content=boromir674/cookiecutter-python-package&utm_campaign=Badge_Grade
239239

240240

241241
.. Code Climate CI
242242
.. Code maintainability & Technical Debt
243243
244244
.. |maintainability| image:: https://api.codeclimate.com/v1/badges/1d347d7dfaa134fd944e/maintainability
245245
:alt: Maintainability
246-
:target: https://codeclimate.com/github/boromir674/cookiecutter-python-package/maintainability
246+
:target: https://codeclimate.com/github/boromir674/cookiecutter-python-package/
247247

248248
.. |tech-debt| image:: https://img.shields.io/codeclimate/tech-debt/boromir674/cookiecutter-python-package
249249
:alt: Code Climate technical debt
250-
:target: https://codeclimate.com/github/boromir674/cookiecutter-python-package/maintainability
250+
:target: https://codeclimate.com/github/boromir674/cookiecutter-python-package/
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11

22
| The most common way to generate a new Python Package Project (in the current working directory),
3-
| is to invoke the *cookiecutter* cli (while supplying the necessary initial information when prompted)
4-
| and provide this Template as input.
3+
| is to invoke the *generate-python* cli (while supplying the necessary initial
4+
| information if/when prompted).
55
66
Open a console (ie terminal) and run:
77

88
.. code-block:: shell
99
10-
# Get Template
11-
git clone git@github.com/boromir674/cookiecutter-python-package.git
12-
13-
# Install cookiecutter if you haven't
14-
python -m pip3 install cookiecutter
15-
16-
# Generate a new Python Package Project locally
17-
cookiecutter cookiecutter-python-package/src/cookiecutter_python
18-
10+
generate-python

docs/contents/30_usage/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
Generate New Python Package Project
33
===================================
44

5-
.. include:: generate_project.rst
6-
5+
This *pyton generator* was designed to be installed via *pip* and then invoked through
6+
the cli.
77

88
------------
99
Installation
1010
------------
1111

1212
.. include:: installation.rst
1313

14+
.. include:: generate_project.rst
1415

1516

1617
.. _Use Cases:
Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,51 @@
11

2-
| **Cookiecutter Python Package** is available directly as source code on github, but also being a Python Package Generator/Template,
3-
| available on pypi too.
2+
| **Cookiecutter Python Package**, available as source code on github, is also published
3+
| on *pypi.org*.
44
55

6-
Get Code from Github
7-
--------------------
6+
Install as PyPi package
7+
-----------------------
88

9-
.. code-block:: shell
109

11-
git clone git@github.com:boromir674/cookiecutter-python-package.git
10+
In virtual environment (recommended)
11+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13+
The recommended way of installing any python package, is use a *python virtual environment*.
1314

14-
Install PyPI package (in current environment)
15-
---------------------------------------------
15+
Open a console (aka terminal) and run:
1616

1717
.. code-block:: shell
1818
19-
python3 -m pip install cookiecutter-python
19+
virtualenv env --python=python3
20+
source env/bin/activate
21+
22+
pip install cookiecutter-python
23+
24+
deactivate
25+
26+
ln -s env/bin/generate-python ~/.local/bin/generate-python
27+
28+
Now the *generate-python* executable should be available (assuming ~/.local/bin is in your PATH)!
29+
30+
31+
For user
32+
^^^^^^^^
33+
34+
One could also opt for a *user* installation of *cookiecutter-python* package:
35+
36+
.. code-bloack: shell
37+
38+
python3 -m pip install --user cookiecutter-python
39+
40+
41+
For all users
42+
^^^^^^^^^^^^^
43+
44+
The least recommended way of installing *cookiecutter-python* package is to
45+
*directly* install in the *host* machine:
46+
47+
.. code-bloack: shell
48+
49+
sudo python3 -m pip install cookiecutter-python
50+
51+
Note the need to invoke using *sudo*, hence not that much recommended.

0 commit comments

Comments
 (0)