Making versioning easy
Project description
``whatsmyversion``
--------------
Single module python package to make versioning simple. You add a couple of
configuration parameters to your top-most python module and ``whatsmyversion`` will
determine the version string based on your git history.
Using ``whatsmyversion``
~~~~~~~~~~~~~~~~~~~~
Add the following to the top level of your package (package_name/__init__.py
or single_module_package.py) ::
import whatsmyversion
__version__ = whatsmyversion.version(__file__)
del whatsmyversion
Add the following to your setup.py ::
import package_name
setup = (
version = package_name.__version__
...
)
Aaaaand that's it! ::
python -c "import package_name; print(package_name.__version__)"
For example, look at the ``setup.py`` and ``whatsmyversion.py`` of this project for
guidance in setting up your own project! ::
$ python -c "import whatsmyversion; print(whatsmyversion.__version__)"
v0.0.2.post6+g32c6562
Configuring ``whatsmyversion``
~~~~~~~~~~~~~~~~~~~~~~~~~~
There are a few configuration options that you can provide to the `version`
function. These are:
``version_prefix`` which is defaults to ``v``
``version_suffix`` which is one of ``a``, ``b``, ``rc``, ``.post``, ``.dev``
and defaults to ``.post``
``use_local_version_id`` which is a boolean flag to include (True) or not
(False) the git hash and defaults to ``True`` because information is power
These three configuration options combine to produce a PEP440 compliant
version string. `PEP440 <https://www.python.org/dev/peps/pep-0440/>`_
Use cases
~~~~~~~~~
Working:
* Determine the version of a git repository
* Installed with ``setup.py develop``
* Installed with ``setup.py install``
Not yet working:
- Determine the version of source code downloaded from github
--------------
Single module python package to make versioning simple. You add a couple of
configuration parameters to your top-most python module and ``whatsmyversion`` will
determine the version string based on your git history.
Using ``whatsmyversion``
~~~~~~~~~~~~~~~~~~~~
Add the following to the top level of your package (package_name/__init__.py
or single_module_package.py) ::
import whatsmyversion
__version__ = whatsmyversion.version(__file__)
del whatsmyversion
Add the following to your setup.py ::
import package_name
setup = (
version = package_name.__version__
...
)
Aaaaand that's it! ::
python -c "import package_name; print(package_name.__version__)"
For example, look at the ``setup.py`` and ``whatsmyversion.py`` of this project for
guidance in setting up your own project! ::
$ python -c "import whatsmyversion; print(whatsmyversion.__version__)"
v0.0.2.post6+g32c6562
Configuring ``whatsmyversion``
~~~~~~~~~~~~~~~~~~~~~~~~~~
There are a few configuration options that you can provide to the `version`
function. These are:
``version_prefix`` which is defaults to ``v``
``version_suffix`` which is one of ``a``, ``b``, ``rc``, ``.post``, ``.dev``
and defaults to ``.post``
``use_local_version_id`` which is a boolean flag to include (True) or not
(False) the git hash and defaults to ``True`` because information is power
These three configuration options combine to produce a PEP440 compliant
version string. `PEP440 <https://www.python.org/dev/peps/pep-0440/>`_
Use cases
~~~~~~~~~
Working:
* Determine the version of a git repository
* Installed with ``setup.py develop``
* Installed with ``setup.py install``
Not yet working:
- Determine the version of source code downloaded from github
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 Distribution
whatsmyversion-0.0.5.tar.gz
(4.4 kB
view details)
File details
Details for the file whatsmyversion-0.0.5.tar.gz
.
File metadata
- Download URL: whatsmyversion-0.0.5.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dced36c980b834c7ec88f8ee6082721ad98f6587d509d56e8b5885dd80df1b7 |
|
MD5 | c5c2b364319fb6a9d4928eb5e9882156 |
|
BLAKE2b-256 | 64a8bac58496be5a08fcd6506898d10d20c741eac43be8640590e801a70d623b |