Are there any explicit or implicit file naming con...
# tools
m
Are there any explicit or implicit file naming conventions for tools? Yesterday late at night without overthinking things, I just went with
cls_workflow_repo.py
for a file that will essentially hold a single class to be used by several subtools related to downloads. We have a legacy file called
synced_repo.py
that has a quite similar functionality elsewhere. Do you think using a prefix like
cls_
to make clear that this file contains a class that is imported into other parts of the code is 👍 or rather 👎?
👍🏻 1
👎🏻 1
👎 2
j
sorry to disagree 😅 we don't use this prefix anywere else even if we import the class in different places
m
Yes, but that was exactly the point to make this clearer than before. For example
downloads.py
is currently a 2000 lines long file that defines several classes with relevance also to other code. But because nobody is looking for a generally applicable useful class there when doing something unrelated, it will not be found. mashehu for example wrote the
PipelineRepo
class in
utils.py
, even though the preexisting
WorkflowRepo
in
downloads.py
would probably have worked for this use case as well. I do not know his rationale - maybe it was a deliberate decision, maybe he just wasn’t aware of
WorkflowRepo
. Arguably, one could have put it to
utils.py
instead, but a huge utils is equally hard to navigate. Therefore, I am sympathetic moving classes with a general applicability to separate files each. In this way, I hope to reduce code duplication and make them easier to discover?
But this is also no decision we have to take now. We can decide this after the Hackathon with a bit more time for discussion.
j
🤔 then if it's really very general I would say it belongs to utils
we could split utils into sub-utils files
but anyway, I agree we can discuss this more after the hackathon 😄
a
Such prefixes are not really "pythonic" imo (not a huge issue but it's about reducing friction for new people). And as Julia says not consistent with how we currently structure and name.
m
That is why am asking. I have a poor understanding what is considered Pythonic 😉
Would having them as a separate file without the prefix still be valid or should there be a
utils.py
and nothing more?
a
Separate file without pefix could be OK imo. There is a long-outstanding issue to refactor
synced_repo
and
repo
though and I worry a bit about yet another class with overlap being in some far-flung file. Velocity is great at the hackathon but if there is much overlap/shared functionality I’d be keen if someone (read: me throwing others under bus) was able to commit to getting that refactor over the line ASAP down the line