Overview
Helper Functions
loadReadmeFile
The function loadReadmeFile()
reads a README
file. This text can then be used for the
package’s long description.
Supported file formats
loadRequirementsFile
The function loadRequirementsFile()
reads a requirements.txt
file and extracts all
specified dependencies into an array.
Features
Comments are skipped.
Special dependency entries like Git repository references are translates to match the syntax expected by setuptools.
extractVersionInformation
The function extractVersionInformation()
extracts version information from a Python source
file (module). Usually these module variables are defined in a __init__.py
file.
Supported fields
Author name (
__author__
)Author email address (
__email__
)Copyright information (
__copyright_
)License name (
__license__
)Version number (
__version__
)Keywords (
__keywords__
)
The function returns an instance of VersionInformation
, which offers the gathered
information as properties.
__init__.py
__author__ = "Patrick Lehmann"
__email__ = "Paebbels@gmail.com"
__copyright__ = "2017-2024, Patrick Lehmann"
__license__ = "Apache License, Version 2.0"
__version__ = "1.10.1"
__keywords__ = ["decorators", "meta classes", "exceptions", "platform", "versioning"]
Usage in setup.py
from setuptools import setup
from pyTooling.Packaging import extractVersionInformation
file = Path("../pyTooling/Common/__init__.py")
versionInfo = extractVersionInformation(file)
setup(
# ...
version=versionInformation.Version,
author=versionInformation.Author,
author_email=versionInformation.Email,
keywords=versionInformation.Keywords,
# ...
)
PackageDescriptions
Example:
from setuptools import setup
from pathlib import Path
from pyTooling.Packaging import DescribePythonPackageHostedOnGitHub
packageName = "pyTooling.Packaging"
setup(**DescribePythonPackageHostedOnGitHub(
packageName=packageName,
description="A set of helper functions to describe a Python package for setuptools.",
gitHubNamespace="pyTooling",
keywords="Python3 setuptools package wheel installation",
sourceFileWithVersion=Path(f"{packageName.replace('.', '/')}/__init__.py"),
developmentStatus="beta",
pythonVersions=("3.8", "3.9", "3.10")
))
DescribePythonPackage
Todo
PACKAGING:: Needs documentation for DescribePythonPackage
DescribePythonPackageHostedOnGitHub
Todo
PACKAGING:: Needs documentation for DescribePythonPackageHostedOnGitHub