Provide (more) consistent linting and formatting with black and flake8 #251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #245.
The goal of this PR is to provide the necessary basis to facilitate contribution from different people to the python code in the future while at the same time keeping disruption to the existing workflow and changes to a minimum.
Features of this PR:
requirements.txt
to thescripts
folder to keep track of dependenciesMakefile
to easily install the necessary dependencies and setup linting and formattingscripts
.flake8
ignore list with a description of the problem. This prevents yellow and red flags from popping up all over the code in the IDE but allows for progressive removal of the flags and enhancement of the code style if desired.I've tried to do justice to most of the points raised by @ivan-aksamentov in his comment on #245 and tried to keep this as light and unobtrusive as possible but I'm aware that this is an opinionated solution that may require changes.
Debatable point may include:
/scripts/.vscode/settings.json
since this is an IDE-specific feature?Makefile
for setup: The reason behind this is to make linting and formatting completely optional and only part of thescripts
folder. However other solutions might be providing a bash script for setup or integrating themake
endpoint into the project's mainMakefile
.scripts
folder, their paths could be added topython.analysis.extraPaths
in the VS Codesettings.json
.requirements.txt
file currently only contains the package names but not their versions, perhaps the output ofpip freeze
could be added here to add exact versioning.Due to missing data it is also not possible for me to test all of the functions. Since only the formatting has been changed their functionality should not be affected but it would probably be good to test and confirm this anyway.
Happy to hear your feedback and to either move forward with this draft or reconsider the approach or certain aspects.