Polyvers's lib to derive subproject versions from tags on Git monorepos.
Project description
- Version:
- 0.1.0a5
- updated:
2018-06-05T02:55:06.457783
- Documentation:
- repository:
- pypi-repo:
- Copyright:
- 2018 JRC.C4(STU), European Commission (JRC)
- license:
The python 2.7+ library needed by (sub-)projects managed by polyvers cmd to derive their version-ids on runtime from Git.
Specifically, the configuration file .polyvers.yaml is NOT read - you have to repeat any non-default configurations as function/method keywords when calling this API.
Here only a very rudimentary documentation is provided - consult polyvers documents provided in the link above.
Quickstart
- There are 4 ways to use this library:
As a setuptools plugin;
through its Python-API (to dynamically version your project);
through its barebone cmdline tool: polyversion (installation required);
through the standalone executable wheel: bin/pvlib.run (no installation, but sources required; behaves identically to polyversion command).
setuptools usage
currentmodule: polyversion
The polyversion library function as a setuptools “plugin”, and adds two new setup() keywords for deriving subproject versions from PKG-INFO or git tags (see func(polyversion.init_plugin_kw)):
- keyword: polyversion --> (bool | dict)
When a dict, its keys roughly mimic those in func(polyversion()), and can be used like this:
from setuptools import setup setup( project='myname', version='' # omit (or None) to abort if cannot auto-version polyversion={ # dict or bool 'mono_project': True, # false by default ... # See `polyversion.init_plugin_kw()` for more keys. }, setup_requires=[..., 'polyversion'], ... )
- keyword: skip_polyversion_check --> bool
When true, disable bdist-check, when false (default), any bdist_* (e.g. bdist_wheel), commands will abort if not run from a release tag. You may bypass this check and create a package with non-engraved sources (although it might not work correctly) by adding skip_polyversion_check option in your setup.cfg file, like this:
[global] skip_polyversion_check = true ...
API usage
An API sample of using also func(polytime()) from within your myproject.git/myproject/__init__.py file:
from polyversion import polyversion, polytime # no hack, dependency already installed
__version__ = polyversion() # project assumed equal to this module-name: 'myproject'
__updated__ = polytime()
...
Console usage
The typical command-line usage of this library (assuming you don’t want to install the full blown polyvers command tool) is given below:
user@host:~/ $ polyversion --help
Describe the version of a *polyvers* projects from git tags.
USAGE:
polyversion [PROJ-1] ...
polyversion [-v | -V ] # print my version information
user@host:~/ $ polyversion polyversion # fails, not in a git repo
b'fatal: not a git repository (or any of the parent directories): .git\n'
cmd: ['git', 'describe', '--match=cf-v*']
Traceback (most recent call last):
File "/pyenv/site-packages/pvlib/polyversion/__main__.py", line 18, in main
polyversion.run(*sys.argv[1:])
File "/pyenv/site-packages/pvlib/polyversion/__init__.py", line 340, in run
res = polyversion(args[0], repo_path=os.curdir)
File "/pyenv/site-packages/pvlib/polyversion/__init__.py", line 262, in polyversion
pvtag = _my_run(cmd, cwd=repo_path)
File "/pyenv/site-packages/pvlib/polyversion/__init__.py", line 106, in _my_run
raise sbp.CalledProcessError(proc.returncode, cmd)
subprocess.CalledProcessError: Command '['git', 'describe', '--match=cf-v*']' returned non-zero exit status 128.
user@host:~/ $ cd polyvers.git
user@host:~/polyvers.git (dev) $ polyversion polyvers polyversion
polyvers: 0.0.2a10
polyversion: 0.0.2a9
Standalone wheel
Various ways to use the standalone wheel from bash (these will still work without having installed anything):
user@host:~/polyvers.git (master) $
user@host:~/polyvers.git (master) $ ./bin/pvlib.run polyversion
polyversion: 0.0.2a9
user@host:~/polyvers.git (master) $ python ./bin/pvlib.run --help
...
user@host:~/polyvers.git (master) $ python ./bin/pvlib.run -m polyversion -v
version: 0.0.2a9
user@host:~/polyvers.git (master) $ PYTHONPATH=./bin/pvlib.run python -m polyversion -V
version: 0.0.2a9
updated: Thu, 24 May 2018 02:47:37 +0300
For the rest, consult the polyvers project: https://polyvers.readthedocs.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file polyversion-0.1.0a5-py2.py3-none-any.whl
.
File metadata
- Download URL: polyversion-0.1.0a5-py2.py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2942b05bc03dcb74ba09817f7514b55e8c909d7a2008ce5b6e950c1059806346 |
|
MD5 | 11a13b8ff3e14c15e8d2a75e45be597f |
|
BLAKE2b-256 | 226e9b864ec0549b3d2fbadced646c9b480ec3e1e5f139787678c161b02b0fcd |