spacetelescope/relic

Name: relic

Owner: Space Telescope Science Institute

Description: Version management package

Created: 2018-04-08 14:26:33.0

Updated: 2018-05-22 12:42:20.0

Pushed: 2018-05-22 12:42:18.0

Homepage:

Size: 23

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

RELIC

Jenkins Build Status

What is RELIC?

RELIC stands for “Release I Control” and maintains a git project's version information without the need for hardcoding values into the source code. It was designed to aid developers with rapid release cycles.

Just tag your code and get on with with your life. It's that simple.

License

BSD 3-Clause

Developing RELIC
clone https://github.com/spacetelescope/relic.git
elic
on setup.py develop
Incorporating RELIC into your project

Configure setup.py

The configuration below detects and handles obtaining and/or initializing RELIC. There are three possible scenarios:

  1. As a local clone of the repository
  2. As a git submodule
  3. As an installed package (e.g. site-packages)

Refrain from making changes to this code unless you know what you are doing.

rt os
rt pkgutil
rt sys
 setuptools import setup
 subprocess import check_call, CalledProcessError


ot pkgutil.find_loader('relic'):
relic_local = os.path.exists('relic')
relic_submodule = (relic_local and
                   os.path.exists('.gitmodules') and
                   not os.listdir('relic'))
try:
    if relic_submodule:
        check_call(['git', 'submodule', 'update', '--init', '--recursive'])
    elif not relic_local:
        check_call(['git', 'clone', 'https://github.com/spacetelescope/relic.git'])

    sys.path.insert(1, 'relic')
except CalledProcessError as e:
    print(e)
    exit(1)

rt relic.release

ion = relic.release.get_info()
c.release.write_template(version, 'sample/')

p(
name='sample',
version=version.pep386,
#...

To add RELIC as a submodule (optional)
submodule add https://github.com/spacetelescope/relic.git
Additional Requirements

Configure MANIFEST.in:

In order to build using a tarball generated by python setup.py sdist, you will need to create or edit MANIFEST.in to save the RELIC-INFO cache. RELIC-INFO stores your project's version data in an easy to read JSON array. [package_path]/version.py does not need to be packaged with your source distribution either, so it may be omitted.

ude RELIC-INFO
ude sample/version.py

t recommended: Uncomment below to bundle RELIC during `sdist`

ursive-include relic *
ne relic/.git
ne relic/tests

Configure .gitignore:

As RELIC-INFO and [package_path]/version.py are generated automatically they should never be committed to your repository. To prevent this from happening, append these paths to .gitignore:

C-INFO
rsion.py
Retreiving Information

A simple reading information from version.py:

from .version import *
print('Sample {0} (Date: {1}) [{2}]'.format(
__version__,
__version_date__, 
__build_status__))
le 0.0.6 (Date: 2016-03-25 17:34:17 -0400) [release]

Version module

Here are a few examples of what version.py might look like during different stages of development.

Standard release tag
TOMATICALLY GENERATED BY 'RELIC':
DO NOT EDIT THIS MODULE MANUALLY.
DO NOT COMMIT THIS MODULE TO YOUR GIT REPOSITORY

l__ = [
'__version__',
'__version_short__',
'__version_long__',
'__version_post__',
'__version_commit__',
'__version_date__',
'__version_dirty__',
'__build_date__',
'__build_status__'


rsion__ = '0.0.6'
rsion_short__ = '0.0.6'
rsion_long__ = '0.0.6-0-feaf392a
rsion_post__ = '0'
rsion_commit__ = 'feaf392a'
rsion_date__ = '2016-03-25 17:34:17 -0400'
rsion_dirty__ = False
ild_date__ = '2016-03-26'
ild_time__ = '17:13:50.997002'
ild_status__ = 'release' if not int(__version_post__) > 0 \
and not __version_dirty__ \
else 'development'
Post-commit on tag
TOMATICALLY GENERATED BY 'RELIC':
DO NOT EDIT THIS MODULE MANUALLY.
DO NOT COMMIT THIS MODULE TO YOUR GIT REPOSITORY

l__ = [
'__version__',
'__version_short__',
'__version_long__',
'__version_post__',
'__version_commit__',
'__version_date__',
'__version_dirty__',
'__build_date__',
'__build_status__'


rsion__ = '0.0.6.dev1+gadef541a'
rsion_short__ = '0.0.6'
rsion_long__ = '0.0.6-1-adef541a'
rsion_post__ = '1'
rsion_commit__ = 'adef541a'
rsion_date__ = '2016-03-26 00:55:27 -0400'
rsion_dirty__ = False
ild_date__ = '2016-03-26'
ild_time__ = '17:19:29.884038'
ild_status__ = 'release' if not int(__version_post__) > 0 \
and not __version_dirty__ \
else 'development'
Dirty post-commit on tag
TOMATICALLY GENERATED BY 'RELIC':
DO NOT EDIT THIS MODULE MANUALLY.
DO NOT COMMIT THIS MODULE TO YOUR GIT REPOSITORY

l__ = [
'__version__',
'__version_short__',
'__version_long__',
'__version_post__',
'__version_commit__',
'__version_date__',
'__version_dirty__',
'__build_date__',
'__build_status__'


rsion__ = '0.0.6.dev1+gadef541a'
rsion_short__ = '0.0.6'
rsion_long__ = '0.0.6-1-adef541a-dirty'
rsion_post__ = '1'
rsion_commit__ = 'adef541a'
rsion_date__ = '2016-03-26 00:55:27 -0400'
rsion_dirty__ = True
ild_date__ = '2016-03-26'
ild_time__ = '17:20:54.291836'
ild_status__ = 'release' if not int(__version_post__) > 0 \
and not __version_dirty__ \
else 'development'

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.