Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'verbose' option #21

Closed
wants to merge 2 commits into from
Closed

Add 'verbose' option #21

wants to merge 2 commits into from

Conversation

juanmb
Copy link

@juanmb juanmb commented Oct 25, 2013

This commit adds a 'verbose' optional argument to the CLI, which is very useful if you want to retrieve the version string from a script.
When used, the output will show something like this:

0.2.2 -> 0.2.3

@peritus
Copy link
Owner

peritus commented Oct 25, 2013

Yes, I like this idea very much, this project needs more verbose output!

However:

Could you fix the tests and add documentation ? I also really like this to be based on the python logging framework, kindof similar to https://github.com/peritus/hashedassets/blob/e2e553562f651f443203a8254a4f563ffae85dcf/src/hashedassets/__init__.py#L249-254 (and the rest of the file). Also there are a few more lines where informing the user would make sense, we can expand on this.

@juanmb
Copy link
Author

juanmb commented Oct 26, 2013

Sorry, it was a quick hack. I have fixed the tests and documentation in my last commit.

I use the python logging module extensively in some of my projects, but they are mainly long running processes. I don't see the advantage of using the logging framework in a small and fast script like bumpversion.

Currently, '--verbose' only causes the printing of the version strings. Certainly, it would be useful to show more info.
I am considering using bumpversion in a production environment, so maybe in the future I could provide more patches.

@peritus
Copy link
Owner

peritus commented Oct 27, 2013

The python3-tests are still failing on Travis (print is a function now http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function)..

Using the python logging framework would make a future-proof implementation, especially since I want bumpversion to be usable as a library some time in the future. Also makes loglevel (or verbose-level for that matter) easy as pie.

I'd love to merge a patch that really thinks about output to stderr and what (also machine readable, that is for other shell scripts) output should be in -v, -vv by default. Also output from Git and Mercurial VCS is currently echoed, that needs to be silenced and replaced with equally verbose information.

While I appreciate your quick hack efforts, I'd rather merge a more complete patch that adresses the aspect all in all to make bumpversion's stdout/stderr fun.

@juanmb
Copy link
Author

juanmb commented Oct 27, 2013

Damn, I was calling py.test directly! Now I've installed tox and see the failing tests :(

OK, compatibility seems to be a good reason for using the logging framework.
If I find the time, I will implement what you have proposed.

@peritus
Copy link
Owner

peritus commented Jan 29, 2014

The fresh version 0.4.0 (now on PyPI!) includes a new --verbose option, here's a log of me using a prelimitary version to version bump bumpversion itself:

~/workspace/bumpversion git:(master) ○ bumpversion --verbose minor
Reading config file .bumpversion.cfg:
[bumpversion]
files = setup.py bumpversion/__init__.py
commit = True
tag = True
current_version = 0.3.8


Parsing current version '0.3.8' with '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'
Parsed the following values: major=0, minor=3, patch=8
Attempting to increment part 'minor'
Values are now: major=0, minor=4, patch=0
Available serialization formats: '{major}.{minor}.{patch}'
Found '{major}.{minor}.{patch}' to be a usable serialization format
Selected serialization format '{major}.{minor}.{patch}'
Serialized to '0.4.0'
New version will be '0.4.0'
Asserting files setup.py, bumpversion/__init__.py contain string '0.3.8':
Found '0.3.8' in setup.py at line 4:     version='0.3.8',
Found '0.3.8' in bumpversion/__init__.py at line 29: __VERSION__ = '0.3.8'
Changing file setup.py:
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@

 setup(
     name='bumpversion',
-    version='0.3.8',
+    version='0.4.0',
     url='https://github.com/peritus/bumpversion',
     author='Filip Noetzel',
     author_email='filip+bumpversion@j03.de',
Changing file bumpversion/__init__.py:
--- a/bumpversion/__init__.py
+++ b/bumpversion/__init__.py
@@ -27,7 +27,7 @@
 import codecs
 sys.stdout = codecs.getwriter('utf8')(sys.stdout)

-__VERSION__ = '0.3.8'
+__VERSION__ = '0.4.0'

 DESCRIPTION = 'bumpversion: v{} (using Python v{})'.format(
     __VERSION__,
Writing to config file .bumpversion.cfg:
[bumpversion]
files = setup.py bumpversion/__init__.py
commit = True
tag = True
current_version = 0.3.8


Preparing Git commit
Adding changes in file 'setup.py' to Git
Adding changes in file 'bumpversion/__init__.py' to Git
Adding changes in file '.bumpversion.cfg' to Git
Committing to Git with message 'Bump version: 0.3.8 → 0.4.0'
Tagging 'v0.4.0' in Git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants