diff --git a/CHANGELOG.md b/CHANGELOG.md index b641706..2618be6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,20 @@ # Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + ## [2024-01-02] 1.0.3 -- docs: added `docs/requirements.txt` with rtd theme (RTD is not building) +- docs: added docs own `requirements.txt` with sphinx rtd theme (#19) +- build: now build automatically reads the current git tag, instead of relying + on `version.py` and `get_version()` function (removed) -NOTE: switching to gitflow to handle branches and versions +NOTE: switching to gitflow to handle branches and versions. ## [2023-08-04] 1.0.2 -- docs: added `.readthedocs.yaml` file as required by Read The Docs +- docs: added `.readthedocs.yaml` file as required by Read The Docs (#18) ## [2020-02-22] 1.0.1 - docs: added an `important` block to guide about how to avoid `RecursionError`. diff --git a/drypy/__init__.py b/drypy/__init__.py index a8b0172..84a320d 100644 --- a/drypy/__init__.py +++ b/drypy/__init__.py @@ -4,28 +4,12 @@ """ import logging -from . import version + logger = logging.getLogger(__name__) _dryrun = False # dryrun switcher flag -def get_version(short=False): - """Returns the current drypy version. - - Optional args: - short (bool): If True return just "major.minor" - - Returns: - A string with the current drypy version. - - """ - if short: - # extract the first two parts of version (eg '1.2' from '1.2.3') - return '.'.join(version._version.split('.')[:2]) - else: - return version._version - def dryrun(state=None): """Return current dryrun mode, If *state* is provided activate/deactivate dryrun before returning the status @@ -40,6 +24,7 @@ def dryrun(state=None): set_dryrun(state) return get_status() + def get_status(): """Returns True if the dryrun system is active. @@ -54,6 +39,7 @@ def get_status(): set_dryrun(False) return _dryrun + def set_dryrun(value): """Set the dryrun mode on or off. @@ -66,6 +52,7 @@ def set_dryrun(value): raise TypeError("Boolean required") _dryrun = value + def toggle_dryrun(): """Toggle the current dryrun mode. diff --git a/drypy/version.py b/drypy/version.py deleted file mode 100644 index e96c37c..0000000 --- a/drypy/version.py +++ /dev/null @@ -1,9 +0,0 @@ -""" -.. module:: version - :platform: Unix - :synopsis: Holds the version - -.. moduleauthor:: Daniele Zanotelli -""" - -_version = "1.0.1" diff --git a/setup.py b/setup.py index 0323f46..15b26b5 100644 --- a/setup.py +++ b/setup.py @@ -5,12 +5,18 @@ """ from setuptools import setup, find_packages +from subprocess import check_output from codecs import open from os import path -from drypy import get_version + here = path.abspath(path.dirname(__file__)) + +def get_version(): + return check_output(['git', 'describe',]).decode('ascii').strip() + + # get the long description from the README file with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read()