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

Support package_data with empty key #4

Closed
mxr opened this issue Mar 12, 2019 · 2 comments
Closed

Support package_data with empty key #4

mxr opened this issue Mar 12, 2019 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mxr
Copy link
Contributor

mxr commented Mar 12, 2019

Given this minimal setup.py file (which admittedly needs more things to be filled in to be usable, but works for this example):

from setuptools import setup

setup(package_data={"": ["*.yaml"]})

setup-py-upgrade will produce the following setup.cfg:

[options.package_data]
 =
    *.yaml

However this file cannot be read by configparser or similar tools. For example:

$ pre-commit try-repo https://github.com/asottile/setup-cfg-fmt setup-cfg-fmt --files setup.cfg
===============================================================================
Using config:
===============================================================================
repos:
-   repo: https://github.com/asottile/setup-cfg-fmt
    rev: f1de3ef475160e6871983e3f0a9790b2b74b734e
    hooks:
    -   id: setup-cfg-fmt
===============================================================================
[INFO] Initializing environment for https://github.com/asottile/setup-cfg-fmt.
[INFO] Installing environment for https://github.com/asottile/setup-cfg-fmt.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
setup-cfg-fmt............................................................Failed
hookid: setup-cfg-fmt

Traceback (most recent call last):
  File "/var/folders/91/k4gwvn_n11v22vskgsvpm3fr0000gq/T/tmpdddrjpuh/repozbmcoj8d/py_env-python3/bin/setup-cfg-fmt", line 11, in <module>
    sys.exit(main())
  File "/var/folders/91/k4gwvn_n11v22vskgsvpm3fr0000gq/T/tmpdddrjpuh/repozbmcoj8d/py_env-python3/lib/python3.6/site-packages/setup_cfg_fmt.py", line 341, in main
    max_py_version=args.max_py_version,
  File "/var/folders/91/k4gwvn_n11v22vskgsvpm3fr0000gq/T/tmpdddrjpuh/repozbmcoj8d/py_env-python3/lib/python3.6/site-packages/setup_cfg_fmt.py", line 237, in format_file
    cfg.read_string(contents)
  File "/Users/mxr/.pyenv/versions/3.6.5/lib/python3.6/configparser.py", line 723, in read_string
    self.read_file(sfile, source)
  File "/Users/mxr/.pyenv/versions/3.6.5/lib/python3.6/configparser.py", line 718, in read_file
    self._read(f, source)
  File "/Users/mxr/.pyenv/versions/3.6.5/lib/python3.6/configparser.py", line 1111, in _read
    raise e
configparser.ParsingError: Source contains parsing errors: '<string>'
	[line  2]: ' =\n'
	[line  3]: '    *.yaml\n'
@asottile asottile added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Mar 12, 2019
@asottile
Copy link
Owner

Nice! Looks like the syntax for this is * = *.yaml

https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files

@hugovk
Copy link

hugovk commented Sep 28, 2021

See #61 for a similar one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants