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

Using 'root' in pyproject.toml file raises a TypeError when invoked from __main__.py #691

Closed
FedericoVaga opened this issue Feb 23, 2022 · 1 comment

Comments

@FedericoVaga
Copy link

Hello,

I'm using the following versions

setuptools          50.3.2
setuptools-scm      6.4.2

I've a pyproject.toml file which setuptools_scm section is

   [tool.setuptools_scm]                                                                                                                                                                                                            
   write_to = "_version.txt"                                                                                                                                                                                                  
   root = "../.."                                                                                                                                                                                                                   
   relative_to = "__file__" 

When used with python3 -m build it works. However, when I run just tool to see the output version, I get the following

$ python -m setuptools_scm       
Traceback (most recent call last):
  File "<some-path>/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "<some-path>/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "<some-path>/lib/python3.7/site-packages/setuptools_scm/__main__.py", line 83, in <module>
    main()
  File "<some-path>/lib/python3.7/site-packages/setuptools_scm/__main__.py", line 18, in main
    config = Configuration.from_file(pyproject, root=root)
  File "<some-path>/lib/python3.7/site-packages/setuptools_scm/config.py", line 216, in from_file
    return cls(dist_name=dist_name, **section, **kwargs)
TypeError: type object got multiple values for keyword argument 'root'

The variable "root" get defined twice, first by __main__.py when setting the default 'root' or the one from the command line (--root); and the second time by the user (me) when I add 'root' to my pyproject.toml file

@GDYendell
Copy link

GDYendell commented Apr 8, 2022

I have experienced the same problem. Hopefully the linked PR will fix it.

RonnyPfannschmidt added a commit that referenced this issue Jun 26, 2022
fix #691 - support root in pyproject.toml even for cli
RonnyPfannschmidt added a commit to RonnyPfannschmidt/setuptools_scm that referenced this issue Jun 28, 2022
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 a pull request may close this issue.

2 participants