-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add 'black' formatter #8
Conversation
Currently, I do not understand why we need another configuration and packaging format called @eine do you have an introduction to tox and why tox does not replace the other two formats. Moreover tox is not so widely supported like requirements.txt |
I'd say that Precisely, the proposed tox file has a two purposes:
|
@eine I saw with Python-based venv CI platforms that they have a use system packages checkbox or option. This means use pre-installed global packages if not defined with other versions or additional packages in a venv description. |
To what branch will black push the changes? |
None at all. In the CI job, black is executed with option If you want, I can run it locally once and push all the format modifications in a single commit. Or, you can do it yourself: |
|
||
with open("README.md", "r") as file: | ||
long_description = file.read() | ||
|
||
projectName = "pyVHDLParser" | ||
|
||
rfile = Path("requirements.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Pathlib is even much simpler :).
-from pathlib import Path, PurePath
+from pathlib import Path
projectName = "pyVHDLParser"
rfile = Path("requirements.txt")
-root = PurePath(__file__)
-if not Path.is_file(rfile):
- rfile = Path(root.parent, projectName + ".egg-info", "requires.txt")
- if not Path.is_file(rfile):
+root = Path(__file__)
+if not rfile.is_file():
+ rfile = root.parent / (projectName + ".egg-info") / "requires.txt"
+ if not rfile.is_file():
exit(1)
requirements = []
-with open(rfile) as file:
+with rfile.open() as file:
Pathlib is fully OO.
- They overloaded the
/
operator for path concatenation :). is_file
is a method, not a classmethod -> data knows best how to test itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! I updated the PR accordingly...
3c716c8
to
fb38242
Compare
@eine after seeing how dumb I need to reject this PR. Maybe with another formatter (supporting rules and don't touch regions), but NOT black. |
Close #7
This PR is a proposal to use psf/black as the formatter for this project. It includes a
tox
configuration file and a GitHub Actions workflow to check the format after each push/PR.Note that I did not format the code. This can be done with
tox -e py37-fmt
.Currently, there is an error when installing this package. See https://github.com/eine/pyVHDLParser/runs/380246563
FTR, see related discussion in VUnit: VUnit/vunit#554