c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.05k stars 135 forks source link

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

Open adamgranthendry opened 2 years ago

adamgranthendry commented 2 years ago

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.

florisla commented 2 years ago

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?

lowell80 commented 2 years ago

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.