bump2version icon indicating copy to clipboard operation
bump2version copied to clipboard

`bumpversion` does not work in directories below `.bumpversion.cfg` top-level directory

Open adamgranthendry opened this issue 4 years ago • 2 comments

In a "typical" project directory structure:

project/
|
└───.venv/
|
└───project/
|   |
|   └─── file1.py
|   |
|   └─── file2.py
|
└─── .bumpversion.cfg

bumpversion will incorrectly tell the user that --new-project is required if running bumpversion from a subdirectory of the top-level directory:

project/project> bumpversion minor
usage: bumpversion [-h] [--config-file FILE] [--verbose] [--list] [--allow-dirty] [--parse REGEX] [--serialize FORMAT] [--search SEARCH] [--replace REPLACE]
                   [--current-version VERSION] [--no-configured-files] [--dry-run] --new-version VERSION [--commit | --no-commit] [--tag | --no-tag] [--sign-tags | --no-sign-tags]    
                   [--tag-name TAG_NAME] [--tag-message TAG_MESSAGE] [--message COMMIT_MSG] [--commit-args COMMIT_ARGS]
                   part [file [file ...]]
bumpversion: error: the following arguments are required: --new-version

but works perfectly well when run from the top-level directory where .bumpversion.cfg is visible.

adamgranthendry avatar Aug 03 '21 00:08 adamgranthendry

I'm not sure if this a bug or a design choice.

Many configuration files (e.g. .pylintrc) also only work when they're present at the right level.

Would it help if the error message can indicate if you're in the wrong directory?

florisla avatar Aug 18 '21 13:08 florisla

I've hit this many times myself and when training new developers to use bumpversion. I'd say "YES", a better error message telling me that a higher level has a .bumpversion.cfg would be reduce confusion!

That's my 2 cents.

lowell80 avatar Apr 05 '22 19:04 lowell80