-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
(🎁) Automatically sync settings with config file #55
Comments
Without this and #44, this plugin is strictly less useful to me than simply adding a file watcher running With my global file watcher, I go into each project, check the checkmark, and commit |
I am sorry to hear that. To help me better understand your use case, please clarify the following: which specific setting do you struggle with and why do you change it so often? |
The settings in the config file rarely change, but when they do it is very frustrating to forget to also sync the BlackConnect settings (for every single person that is working on the project). Although more of an issue is initial setup. With a file watcher solution one can easily commit the config file and never have to think of it again, but with BlackConnect every time someone clones the project they also have to deal with configuring the entirely redundant settings in BlackConnect. |
Black’s string normalization, line length, magic comma, exclude, include, … settings for any Python project are defined in |
While that's not entirely true, I do agree with you about the settings UI. |
As mentioned above, blackd does not care about your Moreover, the plugin itself was initially created to satisfy use cases that came from my own experience and those of my colleagues. Many of those projects we had did not use I see merit in the suggestion of automatically trying to load settings from |
Yeah, that sounds reasonable!
That’s very surprising to me. The standard way to create Python packages since like 6 years involves specifying your build system in the Granted, the official packaging tutorial has only been updated recently. |
Well, that may seem surprising at first, but there exists a whole "terra incognita" of in-house Python projects, some of which alive for 10+ years and have their very special environment setups. Also, it is worth mentioning that "Python package" is not the default method of distributing your code in those environments. This plugin tries to be as conservative and non-opinionated as possible for the reasons outlined above. |
In some cases, sure. If people like reinventing the wheel. Companies I’ve been at try to utilize existing infrastructure. |
In projects that contain a |
While this seems like a rad suggestion, sadly in that case you cannot escape from dealing with two separate sets of settings:
Both of those sets can be modified independently of each other, which presents at least a couple of problems for transparent sync:
Workarounds can be implemented for all of these cases, but it will quickly get too burdensome and complicated for what I see mostly as a niche feature. At the moment, I plan to implement the following features:
Given that changes to code style in the project are usually infrequent this should be enough to help your use case. Hope that helps. |
I am proposing that in projects that contain
I'm not clear which file you are suggesting that it is writing to here, are you able to clarify? I do not see why it would need to write the settings loaded from
If the IDE has not noticed the changes, will it also have an old version of the source code being edited? Would it have to manage the conflicts from the source code changing on disk, in the IDE, and from blackd? For example, if I am working on the black project, which (at the time of writing) contains the following in [tool.black]
line-length = 88
target-version = ['py37', 'py38']
include = '\.pyi?$'
extend-exclude = '''
/(
# The following are specific to Black, you probably don't want those.
| blib2to3
| tests/data
| profiling
)/
'''
# We use preview style for formatting Black itself. If you
# want stable formatting across releases, you should keep
# this off.
preview = true Would it really make sense for my blackconnect settings (say I'd configured line length to be 100) to be used instead of what was in
How is this a niche feature? Wouldn't it be useful for most people working on open source python projects?
Yes, those would be helpful, but I think just using the settings from It would make sense to show a note to the user in the blackconnect settings like:
I'd be happy with this always applying, but I could understand if some users wanted to be able to configure this, with a choice like:
|
coming from vscode where the black plugin reads the settings from |
Any news? |
@eirnym PyCharm comes with black support built-in, or you could use ruff format, which has an excellent plugin |
And with builtin black plugin you basically can't create modules like |
|
Thank you, I'll use |
Attention
Use ruff instead of black + blackconnect, it's better in every way. (plugin)
Original issue
I think it's pretty silly to be specifying the exact same options twice, I think it would be optimal if BlackConnect supported automatic syncing from the
pyproject.toml
file, and that this is the default option.The text was updated successfully, but these errors were encountered: