Repository: freqtrade/freqtrade

Issue:
Build number in -dev versioning
Since we do not have a build number in the -dev version, it may be quite complex to understand which particular version of freqtrade the user runs (especially with that your conda). So if we change user interface I guess it's better for a while to make those changes along with changing the version of both develop and master...

Is it possible to introduce the build number into the -dev versioning, which will change with every merge, as ccxt employs, for example?

It's not necessary for master (2019-8 is completely enough), but for develop changing every day this may be useful since `freqtrade -V` will give particular version info (even when a user has current codebase from github fetched in a dir, but installed an outdated version with that your conda, which is used instead of latest develop from the dir; that's the confusing usecase when it's complicated to find out the actual version of freqtrade that runs at the user site...)

It's not necessary to be an increasing number, it can be a short commit id (merged into develop), for example...



Discussion:
there's a few things to this ... it's definitely possible, however 
it would require us to:

a) open the develop branch to direct push (which is 2 clicks away - but i don't like it from a workflow perspective)
b) create a helper-api-key to allow travis / ci to push to the github repository.

I don't really like either of the two, mainly not the 2nd one since travis themselfs claim that they cannot really guarantee to protect secrets (it's always custom code that runs ...).

However, since using develop implies using a checked out git repository, we could return the commit-id instead (there's a python `git` module iirc which can do this).

This should then work for all branches, not just develop - so we can hopefully immediately see if someone is on any other branch.

Basically, the result would be `2019-8-dev_af51ff41' ... 

The downside is that this will (probably) only work when installed using `pip install -e .` - but not when intalled using `pip install .` (non linked install).

Agree completely, thanks for detailed explanation. This requires changing the total project workflow, in a doubtful way...

I think I have a better solution, that would allow to print in the `-V` option output the exact state of the git repo clone at the user's site (if found):

https://github.com/metaperl/sample-market-maker/blob/1a70c34ebf421f1fc2f4f2299fef730f6f1fba26/market_maker/utils/constants.py#L5-L9

This can be only run for the `-V` option, not during normal bot run.

(The output of `git log -1 --pretty=format:%h`, for example may be taken and printed in the `-V` output in this way)


Resolving patch:
diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py
--- a/freqtrade/__init__.py
+++ b/freqtrade/__init__.py
@@ -1,5 +1,16 @@
 """ FreqTrade bot """
-__version__ = '2019.7-dev'
+__version__ = 'develop'
+
+if __version__ == 'develop':
+
+    try:
+        import subprocess
+        __version__ = 'develop-' + subprocess.check_output(
+            ['git', 'log', '--format="%h"', '-n 1'],
+            stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"')
+    except Exception:
+        # git not available, ignore
+        pass
 
 
 class DependencyException(Exception):


Test patch: