Skip to content

Commit

Permalink
version is now handled automatically
Browse files Browse the repository at this point in the history
* removed version.py module and functions
* now build uses `git describe` to gather the current tag
* updated changelog with "keep a changelog" and "semver" info
  • Loading branch information
dzanotelli committed Jan 2, 2024
1 parent 00e03bc commit 0a12a39
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 30 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
21 changes: 4 additions & 17 deletions drypy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -54,6 +39,7 @@ def get_status():
set_dryrun(False)
return _dryrun


def set_dryrun(value):
"""Set the dryrun mode on or off.
Expand All @@ -66,6 +52,7 @@ def set_dryrun(value):
raise TypeError("Boolean required")
_dryrun = value


def toggle_dryrun():
"""Toggle the current dryrun mode.
Expand Down
9 changes: 0 additions & 9 deletions drypy/version.py

This file was deleted.

8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0a12a39

Please sign in to comment.