pylibtemplate 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.0.1'
32
+ __version_tuple__ = version_tuple = (0, 0, 1)
33
+
34
+ __commit_id__ = commit_id = None
@@ -0,0 +1,392 @@
1
+ Metadata-Version: 2.4
2
+ Name: pylibtemplate
3
+ Version: 0.0.1
4
+ Summary: A Python library that generates `git` repository templates for building Python libraries that are suitable for publication on PyPI.
5
+ Author-email: Matthew Fitzpatrick <matthew.rc.fitzpatrick@gmail.com>
6
+ Project-URL: Homepage, https://mrfitzpa.github.io/pylibtemplate
7
+ Project-URL: Repository, https://github.com/mrfitzpa/pylibtemplate
8
+ Keywords: library,template
9
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Natural Language :: English
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: czekitout>=1.2.0
24
+ Requires-Dist: GitPython
25
+ Provides-Extra: tests
26
+ Requires-Dist: pytest-cov; extra == "tests"
27
+ Provides-Extra: examples
28
+ Provides-Extra: docs
29
+ Requires-Dist: sphinx<7; extra == "docs"
30
+ Requires-Dist: sphinx_rtd_theme; extra == "docs"
31
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
32
+ Requires-Dist: numpydoc; extra == "docs"
33
+ Requires-Dist: docutils; extra == "docs"
34
+ Provides-Extra: all
35
+ Requires-Dist: pylibtemplate[docs,examples,tests]; extra == "all"
36
+ Dynamic: license-file
37
+
38
+ # Python Library Template (PyLibTemplate)
39
+
40
+ [![Test library](https://github.com/mrfitzpa/pylibtemplate/actions/workflows/test_library.yml/badge.svg)](https://github.com/mrfitzpa/pylibtemplate/actions/workflows/test_library.yml)
41
+ [![Code Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/mrfitzpa/7baba2a56d07b59cc49b8323f44416e5/raw/pylibtemplate_coverage_badge.json)](https://github.com/mrfitzpa/pylibtemplate/actions/workflows/measure_code_coverage.yml)
42
+ [![Documentation](https://img.shields.io/badge/docs-read-brightgreen)](https://mrfitzpa.github.io/pylibtemplate)
43
+ [![PyPi Version](https://img.shields.io/pypi/v/pylibtemplate.svg)](https://pypi.org/project/pylibtemplate)
44
+ [![Conda-Forge Version](https://img.shields.io/conda/vn/conda-forge/pylibtemplate.svg)](https://anaconda.org/conda-forge/pylibtemplate)
45
+ [![License](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
46
+
47
+ `pylibtemplate` (short for 'Python Library Template') is a Python library that
48
+ generates `git` repository templates for building Python libraries that are
49
+ suitable for publication on PyPI.
50
+
51
+ Visit the `pylibtemplate` [website](https://mrfitzpa.github.io/pylibtemplate)
52
+ for a web version of the installation instructions, the reference guide, and the
53
+ examples archive.
54
+
55
+
56
+
57
+ ## Table of contents
58
+
59
+ - [Instructions for installing and uninstalling
60
+ `pylibtemplate`](#instructions-for-installing-and-uninstalling-pylibtemplate)
61
+ - [Installing `pylibtemplate`](#installing-pylibtemplate)
62
+ - [Installing `pylibtemplate` using
63
+ `pip`](#installing-pylibtemplate-using-pip)
64
+ - [Installing `pylibtemplate` using
65
+ `conda`](#installing-pylibtemplate-using-conda)
66
+ - [Uninstalling `pylibtemplate`](#uninstalling-pylibtemplate)
67
+ - [How to create a Python library using `pylibtemplate`](#how-to-create-a-python-library-using-pylibtemplate)
68
+ - [Create a new empty GitHub repository for your new Python library](#create-a-new-empty-github-repository-for-your-new-python-library)
69
+ - [Create a new GitHub gist for your new Python library](#create-a-new-github-gist-for-your-new-python-library)
70
+ - [Create a new GitHub token for your new Python library](#create-a-new-github-token-for-your-new-python-library)
71
+ - [Create a new GitHub environment for your new Python library](#create-a-new-github-environment-for-your-new-python-library)
72
+ - [Configure GitHub Pages for your new Python library](#configure-github-pages-for-your-new-python-library)
73
+ - [Create local `git` repository template using `pylibtemplate`](#create-local-git-repository-template-using-pylibtemplate)
74
+ - [Add GitHub remote repository to local `git` repository](#add-github-remote-repository-to-local-git-repository)
75
+ - [Modify local repository files](#modify-local-repository-files)
76
+
77
+
78
+
79
+ ## Instructions for installing and uninstalling `pylibtemplate`
80
+
81
+
82
+
83
+ ### Installing `pylibtemplate`
84
+
85
+ For all installation scenarios, first open up the appropriate command line
86
+ interface. On Unix-based systems, you could open e.g. a terminal. On Windows
87
+ systems you could open e.g. an Anaconda Prompt as an administrator.
88
+
89
+
90
+
91
+ #### Installing `pylibtemplate` using `pip`
92
+
93
+ Before installing `pylibtemplate`, make sure that you have activated the
94
+ (virtual) environment in which you intend to install said package. After which,
95
+ simply change into the root of the repository, and run the following command:
96
+
97
+ pip install pylibtemplate
98
+
99
+ The above command will install the latest stable version of `pylibtemplate`.
100
+
101
+ To install the latest development version from the main branch of the
102
+ [pylibtemplate GitHub repository](https://github.com/mrfitzpa/pylibtemplate),
103
+ one must first clone the repository by running the following command:
104
+
105
+ git clone https://github.com/mrfitzpa/pylibtemplate.git
106
+
107
+ Next, change into the root of the cloned repository, and then run the following
108
+ command:
109
+
110
+ pip install .
111
+
112
+ Note that you must include the period as well. The above command executes a
113
+ standard installation of `pylibtemplate`.
114
+
115
+ Optionally, for additional features in `pylibtemplate`, one can install
116
+ additional dependencies upon installing `pylibtemplate`. To install a subset of
117
+ additional dependencies (along with the standard installation), run the
118
+ following command from the root of the repository:
119
+
120
+ pip install .[<selector>]
121
+
122
+ where `<selector>` can be one of the following:
123
+
124
+ * `tests`: to install the dependencies necessary for running unit tests;
125
+ * `examples`: to install the dependencies necessary for executing files stored
126
+ in `<root>/examples`, where `<root>` is the root of the repository;
127
+ * `docs`: to install the dependencies necessary for documentation generation;
128
+ * `all`: to install all of the above optional dependencies.
129
+
130
+ Alternatively, one can run:
131
+
132
+ pip install pylibtemplate[<selector>]
133
+
134
+ elsewhere in order to install the latest stable version of `pylibtemplate`,
135
+ along with the subset of additional dependencies specified by `<selector>`.
136
+
137
+
138
+
139
+ #### Installing `pylibtemplate` using `conda`
140
+
141
+ To install `pylibtemplate` using the `conda` package manager, run the following
142
+ command:
143
+
144
+ conda install -c conda-forge pylibtemplate
145
+
146
+ The above command will install the latest stable version of `pylibtemplate`.
147
+
148
+
149
+
150
+ ### Uninstalling `pylibtemplate`
151
+
152
+ If `pylibtemplate` was installed using `pip`, then to uninstall, run the
153
+ following command from the root of the repository:
154
+
155
+ pip uninstall pylibtemplate
156
+
157
+ If `pylibtemplate` was installed using `conda`, then to uninstall, run the
158
+ following command from the root of the repository:
159
+
160
+ conda remove pylibtemplate
161
+
162
+
163
+
164
+ ## How to create a Python library using `pylibtemplate`
165
+
166
+ The following instructions assume that the reader understands completely the
167
+ purpose of each file in the [`pylibtemplate` GitHub
168
+ repository](https://github.com/mrfitzpa/pylibtemplate), in relation to the
169
+ corresponding Python library `pylibtemplate`.
170
+
171
+
172
+
173
+ ### Create a new empty GitHub repository for your new Python library
174
+
175
+ Before generating your `git` repository template for building your new Python
176
+ library, several other actions need to be performed, the first of which is to
177
+ create a new empty public GitHub repository, which will serve as the remote
178
+ repository for your new Python library. The GitHub repository should share the
179
+ same name as your new Python library, as it would appear in a `pip install`
180
+ command. We will refer to the name of your new Python library as
181
+ `<your_lib_name>`.
182
+
183
+
184
+
185
+ ### Create a new GitHub gist for your new Python library
186
+
187
+ We need to create a new GitHub gist that will be used to record the code
188
+ coverage from your unit tests. To create a new gist, first go to
189
+ [https://gist.github.com](https://gist.github.com). Next, in the field
190
+ containing the placeholder text "Gist description" write:
191
+
192
+ To store the code coverage of the `<your_lib_name>` library.
193
+
194
+ Next, in the field containing the placeholder text "Filename including
195
+ extension...", write:
196
+
197
+ <your_lib_name>_coverage_badge.json
198
+
199
+ Next, in the field directly below --- where the gist contents are suppose to be
200
+ written --- write:
201
+
202
+ {}
203
+
204
+ Next, click on the green down arrow button in the bottom right corner, select
205
+ the "Create public gist" option, and then click the "Create public gist" button.
206
+
207
+ Upon creating the new gist, you will be redirected to a new page that presents
208
+ the gist. Copy or save somewhere the string of characters following the last `/`
209
+ in the URL of said page. This string of characters is the ID of the gist that
210
+ you just created. We will refer to the gist ID as `<your_gist_id>`.
211
+
212
+
213
+
214
+ ### Create a new GitHub token for your new Python library
215
+
216
+ Next, we need to create a new GitHub token with gist scope. To do this, first go
217
+ to
218
+ [https://github.com/settings/tokens](https://github.com/settings/tokens). Next,
219
+ click on the button "Generate new token" and select the "Generate new token
220
+ (classic)" option. Next, in the field directly below "Note", write:
221
+
222
+ To access the `<your_lib_name>` code coverage file.
223
+
224
+ Next, in the field directly below "Expiration", select whatever expiration date
225
+ that you prefer. Next, select the "gist" box amongst the options of scope. Next,
226
+ click on the "Generate token" button. Next, copy or save somewhere the personal
227
+ access token that appears on the current page. We will refer to the personal
228
+ access token as `<your_access_token>`. Next, go to the main page of the
229
+ `<your_lib_name>` GitHub repository. Next, click on "Settings", then "Secrets
230
+ and variables" in the side menu that appears, followed by "Actions" in the
231
+ sub-menu. Next, click on the "New repository secret" button. In the field
232
+ containing the placeholder text "YOUR_SECRET_NAME", write:
233
+
234
+ CODE_COVERAGE_SECRET
235
+
236
+ In the field directly below "Secret *", copy and paste `<your_access_token>`.
237
+
238
+
239
+
240
+ ### Create a new GitHub environment for your new Python library
241
+
242
+ In order to add your GitHub repository as a pending publisher on PyPI, you need
243
+ to create a specific GitHub environment for said repository. To do this, first
244
+ go to the main page of the `<your_lib_name>` GitHub repository. Next, click on
245
+ "Settings", then "Environments" in the side menu that appears. Next, click on
246
+ the "New environment" button. In the field directly below "Name *", write:
247
+
248
+ release
249
+
250
+ and then click on the "Configure environment" button.
251
+
252
+
253
+
254
+ ### Configure GitHub Pages for your new Python library
255
+
256
+ Next, we need to configure the GitHub Pages for you new Python library. To do
257
+ this, first go to the main page of the `<your_lib_name>` GitHub
258
+ repository. Next, click on "Settings", then "Pages" in the side menu that
259
+ appears. In the field directly below "Source", select "GitHub Actions".
260
+
261
+
262
+
263
+ ### Create local `git` repository template using `pylibtemplate`
264
+
265
+ Next, we need to create a local `git` repository template using
266
+ `pylibtemplate`. To do this, activate an environment in which `pylibtemplate` is
267
+ installed, and then execute the following Python code block:
268
+
269
+ import pylibtemplate
270
+
271
+ kwargs = {"lib_name_for_imports": \
272
+ <your_lib_name>,
273
+ "abbreviated_lib_name_for_docs": \
274
+ <your_abbreviated_lib_name_for_docs>,
275
+ "non_abbreviated_lib_name_for_docs": \
276
+ <your_non_abbreviated_lib_name_for_docs>,
277
+ "author": \
278
+ <author>,
279
+ "email": \
280
+ <email>,
281
+ "gist_id": \
282
+ <your_gist_id>,
283
+ "path_to_directory_to_contain_new_repo": \
284
+ <path_to_directory_to_contain_new_repo>}
285
+ pylibtemplate.generate_local_git_repo_template(**kwargs)
286
+
287
+ This code block will perform several actions: First, it will clone the `git`
288
+ commit of the `pylibtemplate` GitHub repository corresponding to the version of
289
+ `pylibtemplate` being used currently, in the directory at the patth
290
+ `<path_to_directory_to_contain_new_repo>`, i.e. the `git clone` command is
291
+ executed while the working directory is set temporarily to the path
292
+ `path_to_directory_to_contain_new_repo`; Next, it will rename the cloned
293
+ repository to `<your_lib_name>` such that the path to the cloned repository
294
+ becomes `<path_to_directory_to_contain_new_repo>/<your_lib_name>`; Next, all
295
+ instances of the string of characters "pylibtemplate" are replaced with
296
+ `<your_lib_name>`, be it in file contents, directory basenames, or file
297
+ basenames; Next, all instances of the string of characters "PyLibTemplate" are
298
+ replaced with `<your_abbreviated_lib_name_for_docs>`; Next, all instances of the
299
+ string of characters "Python Library Template" are replaced with
300
+ `<your_non_abbreviated_lib_name_for_docs>`; Next, all email address placeholders
301
+ (i.e. instances of the string of characters "matthew.rc.fitzpatrick@gmail.com")
302
+ are replaced with `<email>`; Next, all instances of the gist ID of
303
+ `pylibtemplate` are replaced with `<your_gist_id>`; Next, all author
304
+ placeholders (i.e. instances of the string of characters "Matthew Fitzpatrick")
305
+ are replaced with `<author>`; Next, all copyright statements are updated
306
+ according to the current year; And lastly, the following file is removed:
307
+
308
+ - `<local_repo_root>/docs/how_to_create_a_python_library_using_pylibtemplate.rst`
309
+
310
+ where `<local_repo_root>` is the root of the local ``git`` repository, as well
311
+ as the following directory:
312
+
313
+ - `<local_repo_root>/.git`
314
+
315
+ Instead of executing the above Python code block, one can achieve the same
316
+ result by running `pylibtemplate` as a command line too. To do this, activate an
317
+ environment in which `pylibtemplate` is installed, and then execute the
318
+ following command in the terminal:
319
+
320
+ pylibtemplate --lib_name_for_imports=<your_lib_name> --abbreviated_lib_name_for_docs=<your_abbreviated_lib_name_for_docs> --non_abbreviated_lib_name_for_docs=<your_non_abbreviated_lib_name_for_docs> --author=<author> --email=<email> --gist_id=<your_gist_id> --path_to_directory_to_contain_new_repo=<path_to_directory_to_contain_new_repo>
321
+
322
+
323
+
324
+ ### Add GitHub remote repository to local `git` repository
325
+
326
+ Once you have created your local `git` repository template, you should add to it
327
+ the GitHub repository that you created in the very first step above. To do this,
328
+ run the following commands in a terminal:
329
+
330
+ git init
331
+ git remote add origin https://github.com/<your_username>/<your_lib_name>.git
332
+ git branch -M main
333
+ git push -u origin main
334
+
335
+ where `<your_username>` is the name of the GitHub user that created the GitHub
336
+ repository.
337
+
338
+
339
+
340
+ ### Modify local repository files
341
+
342
+ Of course, now you must modify the local `git` repository files in order to
343
+ develop your new Python library.
344
+
345
+ The following files do not need to be modified under any circumstances:
346
+
347
+ * `<local_repo_root>/.coveragerc`
348
+ * `<local_repo_root>/tox.ini`
349
+ * `<local_repo_root>/docs/Makefile`
350
+ * `<local_repo_root>/docs/make.bat`
351
+ * `<local_repo_root>/docs/api.rst`
352
+ * `<local_repo_root>/docs/private_members_to_publish_to_docs.rst`
353
+
354
+ The following files may need to be modified to reflect the appropriate license
355
+ should it differ from that of `pylibtemplate`:
356
+
357
+ * `<local_repo_root>/run_tests.sh`
358
+ * `<local_repo_root>/setup.py`
359
+ * `<local_repo_root>/LICENSE`
360
+ * `<local_repo_root>/docs/license.rst`
361
+ * `<local_repo_root>/docs/build_docs.py`
362
+
363
+ The following files may need to be modified if a custom installation procecdure
364
+ is required to run your new Python library's unit tests, that differs from the
365
+ default installation procedure:
366
+
367
+ * `<local_repo_root>/.github/workflows/measure_code_coverage.yml`
368
+ * `<local_repo_root>/.github/workflows/test_library.yml`
369
+ * `<local_repo_root>/.github/workflows/publish_documentation_website.yml`
370
+ * `<local_repo_root>/.github/workflows/publish_release_to_pypi.yml`
371
+
372
+ The following files need to be modified according to the specifics of your new
373
+ Python library:
374
+
375
+ * `<local_repo_root>/README.md`
376
+ * `<local_repo_root>/pyproject.toml`
377
+ * `<local_repo_root>/.gitignore`
378
+ * `<local_repo_root>/docs/INSTALL.rst`
379
+ * `<local_repo_root>/docs/conf.py`
380
+ * `<local_repo_root>/docs/index.rst`
381
+ * `<local_repo_root>/docs/literature.rst`
382
+ * `<local_repo_root>/docs/examples.rst`
383
+
384
+ as well as the files stored in the directories:
385
+
386
+ * `<local_repo_root>/<your_lib_name>`
387
+ * `<local_repo_root>/tests`
388
+ * `<local_repo_root>/examples`
389
+ * `<local_repo_root>/docs/examples`
390
+
391
+ After making the necessary modifications, you can proceed to test and debug your
392
+ new Python library.
@@ -0,0 +1,8 @@
1
+ pylibtemplate/__init__.py,sha256=RHMGVOw9foAG7e9D1MuftXk_Vrx0HOdQ321EwCEKuUg,32074
2
+ pylibtemplate/version.py,sha256=qf6R-J7-UyuABBo8c0HgaquJ8bejVbf07HodXgwAwgQ,704
3
+ pylibtemplate-0.0.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
4
+ pylibtemplate-0.0.1.dist-info/METADATA,sha256=9dcaXg043cKj8o9sGei5qOEMLD7u1d6iZU6iUa7XWWo,16821
5
+ pylibtemplate-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ pylibtemplate-0.0.1.dist-info/entry_points.txt,sha256=lX33RgEzs9UByPT90FvYMpPshWLJcNu4mShQjx_Vi2w,77
7
+ pylibtemplate-0.0.1.dist-info/top_level.txt,sha256=pY0rl_JGpeTL6KwNkwptEPpv7hNUtxA7tI3PilhAcZw,14
8
+ pylibtemplate-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pylibtemplate = pylibtemplate:_run_pylibtemplate_as_an_app