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

fix #691 - support root in pyproject.toml even for cli #731

Merged

Conversation

RonnyPfannschmidt
Copy link
Contributor

superseeds #702 which served as inspiration
adds integration tests

superseeds pypa#702 which served as inspiration
adds integration tests
@baodrate
Copy link

@RonnyPfannschmidt A minor edge case, but it seems that this PR still behaves oddly when both -c and -r are specified. When -c is specified, -r seems to be resolved relative to the config file specified by -c. e.g. given a directory tree:

repo
├── .git
└── subdir
    └── pkg
        └── pyproject.toml

specifying -r relative to a PWD doesn't work:

repo/subdir$ python3 -m setuptools_scm -c pkg/pyproject.toml -r ..
('ERROR: no version found for', Namespace(root='..', config='pkg/pyproject.toml', strip_dev=False, command=None))    

you have to specify it as a path relative to the config file instead:

repo/subdir$ python3 -m setuptools_scm -c pkg/pyproject.toml -r ../..
../setuptools_scm/config.py:256: UserWarning: root .. is overridden by the cli arg ../..
  warnings.warn(
1.0.4.dev0+g7d7bd26.d20220627

My intuition as a CLI user is that relative paths specified on the command line are relative to the PWD.

If this is intended behavior, it should at least be mentioned in the --help or documentation. (although root .. is overridden by the cli arg seems to imply that -r should retain its behavior whether or not -c is specified)

I addressed this case in my PR against #702 (you may have missed me mentioning it)

@RonnyPfannschmidt
Copy link
Contributor Author

Tja for the note

Root is intentionally relative to the config file

But we ca take a look at managing the cli one relative to the cwd

@RonnyPfannschmidt RonnyPfannschmidt deleted the cli-setup-root-option branch March 14, 2023 09:24
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.

2 participants