A django-project-version documentation
======================================
|GitHub|_ |Coveralls|_ |pypi-license|_ |pypi-version|_ |pypi-python-version|_ |pypi-django-version|_ |pypi-format|_ |pypi-wheel|_ |pypi-status|_
*django-project-version is a Django reusable app to show your project version*
.. contents::
Installation
------------
* Obtain your copy of source code from the git repository: ``$ git clone https://github.com/DCOD-OpenSource/django-project-version.git``. Or download the latest release from https://github.com/DCOD-OpenSource/django-project-version/tags/.
* Run ``$ python ./setup.py install`` from the repository source tree or unpacked archive. Or use pip: ``$ pip install django-project-version``.
Configuration
-------------
* Add ``"djversion"`` to ``settings.INSTALLED_APPS``.
.. code-block:: python
# settings.py
INSTALLED_APPS += [
"djversion",
]
Settings
--------
``DJVERSION_VERSION``
Contains project version. Defaults to ``None``.
``DJVERSION_UPDATED``
Contains project update date or datetime. Defaults to ``None``.
``DJVERSION_FORMAT_STRING``
Contains version and updated format string. Defaults to ``"{version} ({updated})"``.
``DJVERSION_GIT_REPO_PATH``
Contains path to git repository from where version info can get. Defaults to ``None``.
``DJVERSION_GIT_USE_TAG``
Indicate usage of git repository current tag as project version. Defaults to ``False``.
``DJVERSION_GIT_USE_COMMIT``
Indicate usage of git repository last commit hash as project version. Defaults to ``False``.
Usage
-----
If you want always have ``"VERSION"`` variable in templates context, just add ``"djversion.context_processors.version"`` to ``settings.TEMPLATE_CONTEXT_PROCESSORS``
.. code-block:: python
# settings.py
TEMPLATE_CONTEXT_PROCESSORS += [
"djversion.context_processors.version",
]
Or you can use ``project_version`` templatetag which can be loaded from ``djversion_tags``.
.. code-block:: django
{# footer.html #}
{% load djversion_tags %}
{% project_version as VERSION %}
{{ VERSION }}
Also simple management command ``print-version`` which prints project version to stdout is available. Just run:
.. code-block:: bash
django-admin print-version
or
.. code-block:: bash
./manage.py print-version
Advanced features
-----------------
If you want to have REST-style view with your project version:
* Install ``django-project-version`` with additional dependencies: ``$ pip install django-project-version[rest]``.
* Extend you ``settings.INSTALLED_APPS`` by adding ``"rest_framework"``.
.. code-block:: python
# settings.py
INSTALLED_APPS += [
"rest_framework",
]
* Add ``"djversion"`` to your URLs definitions:
.. code-block:: python
# urls.py
from django.urls import re_path, include
urlpatterns += [
re_path(r"^version/", include("djversion.urls")),
]
Or to use information from the project git repository as project version:
* Install ``django-project-version`` with additional dependencies: ``$ pip install django-project-version[git]``.
* Configure git related settings.
Contributing
------------
- `Fork it <https://github.com/DCOD-OpenSource/django-project-version/>`_
- Install `GNU Make <https://www.gnu.org/software/make/>`_
- Install and configure `pyenv <https://github.com/pyenv/pyenv/>`_ and `pyenv-virtualenv plugin <https://github.com/pyenv/pyenv-virtualenv/>`_
- Install and configure `direnv <https://github.com/direnv/direnv/>`_
- Create environment config from example
.. code-block:: bash
cp .env.example .env
- Install development dependencies:
.. code-block:: bash
make install
- Create your fix/feature branch:
.. code-block:: bash
git checkout -b my-new-fix-or-feature
- Check code style and moreover:
.. code-block:: bash
make check
- Run tests:
.. code-block:: bash
make test
- Push to the branch:
.. code-block:: bash
git push origin my-new-fix-or-feature
- `Create a new Pull Request <https://github.com/DCOD-OpenSource/django-project-version/compare/>`_
Licensing
---------
django-project-version uses the MIT license. Please check the MIT-LICENSE file for more details.
Contacts
--------
**Project Website**: https://github.com/DCOD-OpenSource/django-project-version/
**Author**: DCOD <contact@d-cod.com>
For contributors list see CONTRIBUTORS file.
.. |GitHub| image:: https://github.com/DCOD-OpenSource/django-project-version/workflows/build/badge.svg
:alt: GitHub
.. |Coveralls| image:: https://coveralls.io/repos/github/DCOD-OpenSource/django-project-version/badge.svg?branch=master
:alt: Coveralls
.. |pypi-license| image:: https://img.shields.io/pypi/l/django-project-version
:alt: License
.. |pypi-version| image:: https://img.shields.io/pypi/v/django-project-version
:alt: Version
.. |pypi-django-version| image:: https://img.shields.io/pypi/djversions/django-project-version
:alt: Supported Django version
.. |pypi-python-version| image:: https://img.shields.io/pypi/pyversions/django-project-version
:alt: Supported Python version
.. |pypi-format| image:: https://img.shields.io/pypi/format/django-project-version
:alt: Package format
.. |pypi-wheel| image:: https://img.shields.io/pypi/wheel/django-project-version
:alt: Python wheel support
.. |pypi-status| image:: https://img.shields.io/pypi/status/django-project-version
:alt: Package status
.. _GitHub: https://github.com/DCOD-OpenSource/django-project-version/actions/
.. _Coveralls: https://coveralls.io/github/DCOD-OpenSource/django-project-version?branch=master
.. _pypi-license: https://pypi.org/project/django-project-version/
.. _pypi-version: https://pypi.org/project/django-project-version/
.. _pypi-django-version: https://pypi.org/project/django-project-version/
.. _pypi-python-version: https://pypi.org/project/django-project-version/
.. _pypi-format: https://pypi.org/project/django-project-version/
.. _pypi-wheel: https://pypi.org/project/django-project-version/
.. _pypi-status: https://pypi.org/project/django-project-version/
Raw data
{
"_id": null,
"home_page": "https://github.com/DCOD-OpenSource/django-project-version/",
"name": "django-project-version",
"maintainer": "",
"docs_url": "https://pythonhosted.org/django-project-version/",
"requires_python": "",
"maintainer_email": "",
"keywords": "django,version,project,django-project-version",
"author": "DCOD",
"author_email": "contact@d-cod.com",
"download_url": "https://files.pythonhosted.org/packages/95/e5/d05f976f41b48abc04b19e439b43b43c3f1143493cbea8077bed3a7fe69f/django-project-version-0.19.0.zip",
"platform": null,
"description": "A django-project-version documentation\n======================================\n\n|GitHub|_ |Coveralls|_ |pypi-license|_ |pypi-version|_ |pypi-python-version|_ |pypi-django-version|_ |pypi-format|_ |pypi-wheel|_ |pypi-status|_\n\n *django-project-version is a Django reusable app to show your project version*\n\n.. contents::\n\nInstallation\n------------\n* Obtain your copy of source code from the git repository: ``$ git clone https://github.com/DCOD-OpenSource/django-project-version.git``. Or download the latest release from https://github.com/DCOD-OpenSource/django-project-version/tags/.\n* Run ``$ python ./setup.py install`` from the repository source tree or unpacked archive. Or use pip: ``$ pip install django-project-version``.\n\nConfiguration\n-------------\n* Add ``\"djversion\"`` to ``settings.INSTALLED_APPS``.\n\n.. code-block:: python\n\n # settings.py\n\n INSTALLED_APPS += [\n \"djversion\",\n ]\n\nSettings\n--------\n``DJVERSION_VERSION``\n Contains project version. Defaults to ``None``.\n\n``DJVERSION_UPDATED``\n Contains project update date or datetime. Defaults to ``None``.\n\n``DJVERSION_FORMAT_STRING``\n Contains version and updated format string. Defaults to ``\"{version} ({updated})\"``.\n\n``DJVERSION_GIT_REPO_PATH``\n Contains path to git repository from where version info can get. Defaults to ``None``.\n\n``DJVERSION_GIT_USE_TAG``\n Indicate usage of git repository current tag as project version. Defaults to ``False``.\n\n``DJVERSION_GIT_USE_COMMIT``\n Indicate usage of git repository last commit hash as project version. Defaults to ``False``.\n\nUsage\n-----\nIf you want always have ``\"VERSION\"`` variable in templates context, just add ``\"djversion.context_processors.version\"`` to ``settings.TEMPLATE_CONTEXT_PROCESSORS``\n\n.. code-block:: python\n\n # settings.py\n\n TEMPLATE_CONTEXT_PROCESSORS += [\n \"djversion.context_processors.version\",\n ]\n\n\nOr you can use ``project_version`` templatetag which can be loaded from ``djversion_tags``.\n\n.. code-block:: django\n\n {# footer.html #}\n\n {% load djversion_tags %}\n\n {% project_version as VERSION %}\n {{ VERSION }}\n\nAlso simple management command ``print-version`` which prints project version to stdout is available. Just run:\n\n.. code-block:: bash\n\n django-admin print-version\n\nor\n\n.. code-block:: bash\n\n ./manage.py print-version\n\n\nAdvanced features\n-----------------\nIf you want to have REST-style view with your project version:\n\n* Install ``django-project-version`` with additional dependencies: ``$ pip install django-project-version[rest]``.\n* Extend you ``settings.INSTALLED_APPS`` by adding ``\"rest_framework\"``.\n\n.. code-block:: python\n\n # settings.py\n\n INSTALLED_APPS += [\n \"rest_framework\",\n ]\n\n* Add ``\"djversion\"`` to your URLs definitions:\n\n.. code-block:: python\n\n # urls.py\n\n from django.urls import re_path, include\n\n\n urlpatterns += [\n re_path(r\"^version/\", include(\"djversion.urls\")),\n ]\n\nOr to use information from the project git repository as project version:\n\n* Install ``django-project-version`` with additional dependencies: ``$ pip install django-project-version[git]``.\n* Configure git related settings.\n\nContributing\n------------\n- `Fork it <https://github.com/DCOD-OpenSource/django-project-version/>`_\n- Install `GNU Make <https://www.gnu.org/software/make/>`_\n- Install and configure `pyenv <https://github.com/pyenv/pyenv/>`_ and `pyenv-virtualenv plugin <https://github.com/pyenv/pyenv-virtualenv/>`_\n- Install and configure `direnv <https://github.com/direnv/direnv/>`_\n- Create environment config from example\n\n.. code-block:: bash\n\n cp .env.example .env\n\n- Install development dependencies:\n\n.. code-block:: bash\n\n make install\n\n- Create your fix/feature branch:\n\n.. code-block:: bash\n\n git checkout -b my-new-fix-or-feature\n\n- Check code style and moreover:\n\n.. code-block:: bash\n\n make check\n\n- Run tests:\n\n.. code-block:: bash\n\n make test\n\n- Push to the branch:\n\n.. code-block:: bash\n\n git push origin my-new-fix-or-feature\n\n- `Create a new Pull Request <https://github.com/DCOD-OpenSource/django-project-version/compare/>`_\n\nLicensing\n---------\ndjango-project-version uses the MIT license. Please check the MIT-LICENSE file for more details.\n\nContacts\n--------\n**Project Website**: https://github.com/DCOD-OpenSource/django-project-version/\n\n**Author**: DCOD <contact@d-cod.com>\n\nFor contributors list see CONTRIBUTORS file.\n\n\n.. |GitHub| image:: https://github.com/DCOD-OpenSource/django-project-version/workflows/build/badge.svg\n :alt: GitHub\n.. |Coveralls| image:: https://coveralls.io/repos/github/DCOD-OpenSource/django-project-version/badge.svg?branch=master\n :alt: Coveralls\n.. |pypi-license| image:: https://img.shields.io/pypi/l/django-project-version\n :alt: License\n.. |pypi-version| image:: https://img.shields.io/pypi/v/django-project-version\n :alt: Version\n.. |pypi-django-version| image:: https://img.shields.io/pypi/djversions/django-project-version\n :alt: Supported Django version\n.. |pypi-python-version| image:: https://img.shields.io/pypi/pyversions/django-project-version\n :alt: Supported Python version\n.. |pypi-format| image:: https://img.shields.io/pypi/format/django-project-version\n :alt: Package format\n.. |pypi-wheel| image:: https://img.shields.io/pypi/wheel/django-project-version\n :alt: Python wheel support\n.. |pypi-status| image:: https://img.shields.io/pypi/status/django-project-version\n :alt: Package status\n.. _GitHub: https://github.com/DCOD-OpenSource/django-project-version/actions/\n.. _Coveralls: https://coveralls.io/github/DCOD-OpenSource/django-project-version?branch=master\n.. _pypi-license: https://pypi.org/project/django-project-version/\n.. _pypi-version: https://pypi.org/project/django-project-version/\n.. _pypi-django-version: https://pypi.org/project/django-project-version/\n.. _pypi-python-version: https://pypi.org/project/django-project-version/\n.. _pypi-format: https://pypi.org/project/django-project-version/\n.. _pypi-wheel: https://pypi.org/project/django-project-version/\n.. _pypi-status: https://pypi.org/project/django-project-version/\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Django reusable app to show your project version",
"version": "0.19.0",
"project_urls": {
"Homepage": "https://github.com/DCOD-OpenSource/django-project-version/"
},
"split_keywords": [
"django",
"version",
"project",
"django-project-version"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f134c8cf48a975be845cb088e3989a0019569267b14eaffd29f4ac6a9c37a189",
"md5": "ea7b26fbcacea5290cf1849cfd4d0dc7",
"sha256": "e13ea9e70b1bb09dce78dc6d791948bc40be137702f94e6181318f4b15954d38"
},
"downloads": -1,
"filename": "django_project_version-0.19.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ea7b26fbcacea5290cf1849cfd4d0dc7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12524,
"upload_time": "2024-01-08T16:50:20",
"upload_time_iso_8601": "2024-01-08T16:50:20.975518Z",
"url": "https://files.pythonhosted.org/packages/f1/34/c8cf48a975be845cb088e3989a0019569267b14eaffd29f4ac6a9c37a189/django_project_version-0.19.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "95e5d05f976f41b48abc04b19e439b43b43c3f1143493cbea8077bed3a7fe69f",
"md5": "fb55e32eab18185b4f889f943df77282",
"sha256": "6232a0f099eb04541325aa03e29f86b6ebbe33be98f5dfcf293beefd68a536d6"
},
"downloads": -1,
"filename": "django-project-version-0.19.0.zip",
"has_sig": false,
"md5_digest": "fb55e32eab18185b4f889f943df77282",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 24753,
"upload_time": "2024-01-08T16:50:23",
"upload_time_iso_8601": "2024-01-08T16:50:23.899802Z",
"url": "https://files.pythonhosted.org/packages/95/e5/d05f976f41b48abc04b19e439b43b43c3f1143493cbea8077bed3a7fe69f/django-project-version-0.19.0.zip",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-08 16:50:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DCOD-OpenSource",
"github_project": "django-project-version",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-project-version"
}