code formatting guidelines #1589
Replies: 18 comments
-
With travis we execute flake8 which does some basic style checks. I think this should be the minimum requirement. So far I do not have experience with black. |
Beta Was this translation helpful? Give feedback.
-
Hey @white-gecko, flake8 uses pycodestyle to check code formatting, which does conflict with black in some cases. I would recommend to either remove black from the Having a code formatter as guide instead of a checker makes it easier for everyone imho ... but there is a certain pain involved when it reformats the code someone formatted by hand and disagrees with the decision made by the formatter. In the end, formatting does not matter that much to argue to much about it. |
Beta Was this translation helpful? Give feedback.
-
Yes, we recommend that all PRs are formatted using Black. That is why it is in You mention:
Please refer to these commits: The whole codebase (well, just everything in the I believe the inconsistencies are from merging very old PRs, this causes non-blacked code to come in, necessitating re-running Black occasionally on the whole codebase. Can you let us know which files you believe to be not fully black formatted in master now? I also find sometimes when working on a small change within one file, when I run Black before I commit the change, Black will make a small change in an unrelated file. I don't understand why it does that, because the other files should already be blacked, but I do still occasionally see it happen. Note, I say its recommended to format PRs in Black, but it is not required or mandatory yet. We will eventually add the |
Beta Was this translation helpful? Give feedback.
-
Files outside of the
black itself is deterministic, so running it again on the same input gives the same output. If the output changes there might have been changes by others that where run through black - or your black version or black config might have changed.
I will update my PRs then :) |
Beta Was this translation helpful? Give feedback.
-
Following up on:
Here some ideas on encourage new developers:
Speaking of docs and getting started, here a question I got:
The PS I will volunteer to make a |
Beta Was this translation helpful? Give feedback.
-
Okay, I tried running the tests on the master branch to run with python2.7 - doesn't seem like it's supposed to run. Since f69df42 it's python3 only. |
Beta Was this translation helpful? Give feedback.
-
You might not know, but we are actually new maintainers on this project. @nicholascar , @white-gecko and myself took over maintainership of the RDFLib project in February 2020. We understand it is frustrating that the code repository is not of a modern standard, and is not what new developers expect in 2020. Please remember there is code and documentation in this repository from 2003 or before. There is code in this repository written by Tim Berners-Lee for the W3C RDF and Turtle standards. So while it is very old, it should be respected for what it is. Our main tasks as new maintainers was to get v5.0.0 release-candidate out, create a 5.0.0 changelog, make a 4.x to 5.0 migration document, and finally publish v5.0.0 for everyone who was patiently waiting more than 4 years since the 4.2 release. Thanks for your advice:
Yes, we know! At our last three maintainer meetings this has been on the list to discuss, and certainly needs to be done, and we know generally how to fix it. It just takes time.
Looks like you've done that in #1161, thanks.
To be honest I think its pretty good already. Getting a reply within a week or two (on average) is much better than the 6 to 18 months average response that it used to be. We do try to give good feedback in code reviews to help contributors create high quality contributions.
I got a very similar question recently: #1115 RDFLib, like most code repositories, uses Trunk-based Development. That means all new features and changes go into So just because the 5.0.0 release is python2 compliant, the same assumption cannot be made for |
Beta Was this translation helpful? Give feedback.
-
@ashleysommer Thanks for the explanations and background info - always helps to understand the context. Only question left on my mind is: You were mentioning a 5.1.0 release - where would that be developed since |
Beta Was this translation helpful? Give feedback.
-
But I do see now where your confusion comes from.
Actually I guess if it has caused this much confusion, that wording should be changed in |
Beta Was this translation helpful? Give feedback.
-
Yes, |
Beta Was this translation helpful? Give feedback.
-
Oohh, yeah, I misunderstood that - and actually my merge request to update the README to clear it up now carries that misunderstanding with it. I though
Which I understood as master = 6.0 not 5.1. Which is now on the frontpage/readme: |
Beta Was this translation helpful? Give feedback.
-
btw, does RDFLib strive to follow semantic versioning? |
Beta Was this translation helpful? Give feedback.
-
Ok, yeah that PR should've been reviewed more thoroughly before making it to the frontpage readme. |
Beta Was this translation helpful? Give feedback.
-
semver as a formal concept has only existed since 2011, this project was around for at least 8 years before that. As fast as I can tell, the versions of RDFLib in the past were bumped a major version when support for a new major version of python was added, or support for a old major version of python was dropped. I don't think it ever correlated with features being added or removed, or breaking changes. We'd like to start to implement semantic versioning going forward. While our current versions try to communicate meaning to an extent, we are not yet actively doing semantic versioning. To do it properly requires a lot more coordination and planning put into the repository in general. More extensive unit tests, more integrated integration tests, deeper understanding of our user's use-cases. |
Beta Was this translation helpful? Give feedback.
-
If going forward semver is an interesting concept, I'd say the current master should be 6.x as otherwise it would be breaking changes in a minor release. |
Beta Was this translation helpful? Give feedback.
-
@FlorianLudwig After the latest round of Pull-request merges today, I've manually run Now when I run black, I see: > black --version
black, version 19.10b0
> black ./rdflib
All done! ✨ 🍰 ✨
75 files left unchanged. Do I understand that you are seeing a different result when you run |
Beta Was this translation helpful? Give feedback.
-
But |
Beta Was this translation helpful? Give feedback.
-
Ah yes, you are right. I mixed something up here. |
Beta Was this translation helpful? Give feedback.
-
Hey there,
i noticed that there is
black
in therequirements.dev.txt
. Does it mean that all merge requests are supposed to be formatted with black? The current code in master is not fully formatted by black though, making it harder to run black since it results in unrelated changes.Beta Was this translation helpful? Give feedback.
All reactions