Package: template-pypackage-builder
template_pypackage_builderA simple tool for packaging pythonTable of ContentsDescriptionInstallationUsageAuthorLicenseDescriptionThis tool walks you through the process of python packaging. Well it doesnot create actual package, more like a template with initial files to start with. The tool conatin following functions to help with package deployment.README makerLIcense creatersetup file createrdirectory tree builderpip code generater to install package from subdirectory of github repomain function to initial package building from scratchInstallationInstall from pypipip install template-pypackage-builderInstall from GitHubpip install git+https://github.com/dipson94/packagemakerInstall requirespkg_resourcespypercliposUsageDirect function from packages. Use main function to start initial package build.import template_pypackage_builder as pb
pb.main()Use pip_code() function to generate pip code to install package from subdirectory of github repoimport template_pypackage_builder as pb
pb.pip_code()Alternatively use key words pysetup and gitpip directly in terminal to execute the main and pip_code functions respectively@terminalpysetup@terminalgitpipAdditional notes on package BuildingAdditional info about package buildingincluding pathTo include path in package file use the following commandimport pkg_resources
relative_path=pkg_resources.resource_filename("packagemaker", "types")This command is used if you want to use the path inside package in site-packages folder. Otherwise the path will be relative to the directory where you imported the package (while programming after importing the module).
Here relative_path refers to the path to types folder inside installed package template_pypackage_builder.__init__.pyfile handelingThe following is the tree structure of a package showing basic files and directories. From main package directory in source, each modules ( also directories) contain an__init__.pyfile.└── package_name
    ├── License.txt
    ├── MANIFEST.in
    ├── README.md
    ├── setup.py
    └── src
        └── package_name
            ├── __init__.py
            ├── module_1
            │   ├── __init__.py
            │   └── module_1.py
            ├── module_2
            │   ├── __init__.py
            │   └── module_2.py
            └── module_3
                ├── __init__.py
                └── module_3.pyThere are numberous ways to handel__init__.pyfileRule of thumb : keep all__init__.pyfiles empty at first and then start addding data from main__init__.pyfile.Methodsif you wish to include all the functions and classes in one file, then write all in main__init__.pyfile and discard other sub-directories (modules).if you wish to follow the structure shown in the illustration then you can include those modules in main__init__.pyfile byfrom . import (module_1,module_2,module_3)
__all__ = ["module_1","module_2","module_3"]Another approachfrom .module_1 import (function_1,function_2,function_3)
from .module_2 import (function_1,function_2,function_3)
from .module_3 import (function_1,function_2,function_3)Here we are importing functions directly to main__init__.pyfile, so the functions are readly availble when the main module is called (or imported).Final thoughtstemplate_pypackage_builder only helps with making a template or initial structure of a package. For making better package, work on the files manually using the editor.AuthorDipsonLicenseGNU GPL V3