Skip to main content

template_pypackage_builder

A simple tool for packaging python

Table of Contents

Description

This 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 maker
  • LIcense creater
  • setup file creater
  • directory tree builder
  • pip code generater to install package from subdirectory of github repo
  • main function to initial package building from scratch

Installation

Install from pypi

pip install template-pypackage-builder 

Install from GitHub

pip install git+https://github.com/dipson94/packagemaker

Install requires

  • pkg_resources
  • pyperclip
  • os

Usage

Direct 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 repo

import 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

@terminal

pysetup

@terminal

gitpip

Additional notes on package Building

Additional info about package building

including path

To include path in package file use the following command

import 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__.py file handeling

The 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__.py file.

└── 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.py

There are numberous ways to handel __init__.py file

Rule of thumb : keep all __init__.py files empty at first and then start addding data from main __init__.py file.

Methods

  • if you wish to include all the functions and classes in one file, then write all in main __init__.py file 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__.py file by
from . import (module_1,module_2,module_3)
__all__ = ["module_1","module_2","module_3"]

  • Another approach
from .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__.py file, so the functions are readly availble when the main module is called (or imported).

Final thoughts

template_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.

Author

Dipson

License

GNU GPL V3

Metadata

Release files for template-pypackage-builder 0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for template-pypackage-builder 0.9
File Size Uploaded Provenance Actions
template_pypackage_builder-0.9.tar.gz 32.9 kB Without provenance Details for template_pypackage_builder-0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for template-pypackage-builder 0.9
File Interpreter ABI Platform Actions
template_pypackage_builder-0.9-py3-none-any.whl Python 3 none any Details for template_pypackage_builder-0.9-py3-none-any.whl

Total release size: 69.5 kB

Release files / template_pypackage_builder-0.9.tar.gz

Download URL template_pypackage_builder-0.9.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
97d21bbf06224f8ada36321957607018c3b97bde945c487a39d48afdfc765aaa
BLAKE2b-256 checksum
How to use checksums
abc64a4b881f8332023ddf3f970fc69df170f5db31c873aa5ca3b5070217bf48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / template_pypackage_builder-0.9-py3-none-any.whl

Download URL template_pypackage_builder-0.9-py3-none-any.whl
Size 36.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2caab8cbd05d956524537d63ee2ab7323d12dedaf37f56d7eca41e85b67ebfd
BLAKE2b-256 checksum
How to use checksums
049af223bb04f545a742103fcd62f553f0d2b0246db0fd486d90c3a71230fefd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for template-pypackage-builder 0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page