auxlib.packaging¶
Usage¶
Method #1: auxlib.packaging as a run time dependency¶
Place the following lines in your package’s main __init__.py
from auxlib.packaging import get_version __version__ = get_version(__file__)
Method #2: auxlib.packaging as a build time-only dependency¶
import auxlib
# When executing the setup.py, we need to be able to import ourselves, this # means that we need to add the src directory to the sys.path. here = os.path.abspath(os.path.dirname(__file__)) src_dir = os.path.join(here, “auxlib”) sys.path.insert(0, src_dir)
- setup(
version=auxlib.__version__, cmdclass={
‘build_py’: auxlib.packaging.BuildPyCommand, ‘sdist’: auxlib.packaging.SDistCommand, ‘test’: auxlib.packaging.Tox,},
)
Place the following lines in your package’s main __init__.py
from auxlib.packaging import get_version __version__ = get_version(__file__)
Method #3: write .version file¶
Configuring python setup.py test for Tox¶
must use setuptools (distutils doesn’t have a test cmd)
- setup(
version=auxlib.packaging.__version__, cmdclass={
‘build_py’: auxlib.packaging.BuildPyCommand, ‘sdist’: auxlib.packaging.SDistCommand, ‘test’: auxlib.packaging.Tox,},
)
-
class
auxlib.packaging.
Response
(stdout, stderr, rc)¶ -
__getnewargs__
()¶ Return self as a plain tuple. Used by copy and pickle.
-
__getstate__
()¶ Exclude the OrderedDict from pickling
-
__repr__
()¶ Return a nicely formatted representation string
-
rc
¶ Alias for field number 2
-
stderr
¶ Alias for field number 1
-
stdout
¶ Alias for field number 0
-
-
class
auxlib.packaging.
Tox
(dist, **kw)[source]¶ -
-
user_options
= [('tox-args=', 'a', 'Arguments to pass to tox')]¶
-
-
auxlib.packaging.
get_version
(dunder_file)[source]¶ Returns a version string for the current package, derived either from git or from a .version file.
This function is expected to run in two contexts. In a development context, where .git/ exists, the version is pulled from git tags. Using the BuildPyCommand and SDistCommand classes for cmdclass in setup.py will write a .version file into any dist.
In an installed context, the .version file written at dist build time is the source of version information.