2.1. pylibtemplate.generate_local_git_repo_template
- generate_local_git_repo_template(lib_name_for_imports='pylibtemplate', abbreviated_lib_name_for_docs='PyLibTemplate', non_abbreviated_lib_name_for_docs='Python Library Template', author='Matthew Fitzpatrick', email='matthew.rc.fitzpatrick@gmail.com', gist_id='7baba2a56d07b59cc49b8323f44416e5', path_to_directory_to_contain_new_repo='')[source]
Generate a local
gitrepository template.The primary purpose of generating a local
gitrepository template is to modify it subsequently to develop a new Python library.This Python function will perform several actions: First, it will clone the
gitcommit of thepylibtemplateGitHub repository corresponding to the version ofpylibtemplatebeing used currently, in the directory at the pathpath_to_directory_to_contain_new_repo, i.e. thegit clonecommand is executed while the working directory is set temporarily to the pathpath_to_directory_to_contain_new_repo; Next, it will rename the cloned repository tolib_name_for_importssuch that the path to the cloned repository becomespath_to_directory_to_contain_new_repo+"/"+lib_name_for_imports; Next, all instances of the string of characters “pylibtemplate” are replaced withlib_name_for_imports, be it in file contents, directory basenames, or file basenames; Next, all instances of the string of characters “PyLibTemplate” are replaced withabbreviated_lib_name_for_docs; Next, all instances of the string of characters “Python Library Template” are replaced withnon_abbreviated_lib_name_for_docs; Next, all email address placeholders (i.e. instances of the string of characters “matthew.rc.fitzpatrick@gmail.com”) are replaced withemail; Next, all instances of the gist ID ofpylibtemplateare replaced withgist_id; Next, all author placeholders (i.e. instances of the string of characters “Matthew Fitzpatrick”) are replaced withauthor; Next, all copyright statements are updated according to the current year; And lastly, the following file is removed:* ``<local_repo_root>/docs/how_to_create_a_python_library_using_pylibtemplate.rst``
where
<local_repo_root>is the root of the localgitrepository, as well as the following directory:* ``<local_repo_root>/.git``
On a unrelated note, for the purposes of demonstrating the citing of literature, we cite Ref. [RefLabel1] and [RefLabel2].
- Parameters:
- lib_name_for_importsstr, optional
The name of the new Python library, as it would appear in Python import commands. This parameter needs to be a valid Python identifier.
- abbreviated_lib_name_for_docsstr, optional
An abbreviated format of the name of the new Python library that appears in documentation pages. This parameter needs to be a valid Python identifier. It can be set to the same value as
lib_name_for_imports.- non_abbreviated_lib_name_for_docsstr, optional
A non-abbreviated format of the name of the new Python library that appears in documentation pages.
- authorstr, optional
The name of the author of the new Python library.
- emailstr, optional
The email address of the author.
- gist_idstr, optional
The ID of the GitHub gist to be used to record the code coverage from your unit tests. See the How to create a Python library using pylibtemplate page for instructions on how to create a GitHub gist for your new Python library.
- path_to_directory_to_contain_new_repostr, optional
The path to the directory inside which the
gitcommit — of thepylibtemplateGitHub repository corresponding to the version ofpylibtemplatebeing used currently — is to be cloned, i.e. thegit clonecommand is executed while the working directory is set temporarily topath_to_directory_to_contain_new_repo.