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

inline comments not supported in configuration file #2292

Open
thomas-paul-ohara opened this issue Sep 18, 2024 · 0 comments
Open

inline comments not supported in configuration file #2292

thomas-paul-ohara opened this issue Sep 18, 2024 · 0 comments

Comments

@thomas-paul-ohara
Copy link

The isort configuration file doesn't support inline comments. For example,

$ head .isort.cfg hello.py
==> .isort.cfg <==
[settings]
force_single_line=1                  # every import will appear on its own

==> hello.py <==
import sys
sys.stdout.write("hello\n")

$ isort .
/Users/eafqe/virtual-environments/py-3-11/lib/python3.11/site-packages/isort/settings.py:783: UserWarning: Failed to pull configuration information from /Users/eafqe/temp/Gen-AI-Product-Geo-Extractor-tom/src/isort/bug/.isort.cfg
  warn(f"Failed to pull configuration information from {potential_config_file}")
Fixing /Users/eafqe/temp/Gen-AI-Product-Geo-Extractor-tom/src/isort/bug/hello.py

$ perl -i.bak -pe 's/#/\n#/;' .isort.cfg
$ isort .

$ cat .isort.cfg
[settings]
force_single_line=1
# every import will appear on its own

It would be good if comments can be stripped, because inline comments make it simpler to explain settings rather than alternating comments and settings.

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

No branches or pull requests

1 participant