qiime2-graveyard / rfcs

Other
0 stars 3 forks source link

Should formats use `UpperCase` or `under_scores`? #7

Open ebolyen opened 8 years ago

ebolyen commented 8 years ago

The recommendation of PEP 8 is to use UpperCase for classes, but it does not require it, the typical exception being under_scores for callables.

It wouldn't be the craziest thing if they were primarily callables. We could imagine that formats are actually just pathlib.Path factories, e.g. path = biom_v2_1_0() and path = biom_v2_1_0('some/path.biom'). This ties in a bit with what @gregcaporaso is currently exploring w.r.t. returning straight paths instead of instances.

Reasons this might be a good idea:

Using UpperCase makes it hard to delimit version numbers, e.g. BIOMV210Format vs biom_v2_1_0.

Using under_scores would also be visually distinct from standard object views meaning that Format/DirFmt suffixes could be assumed by convention.

If formats were primarily understood as callables, they get quite a bit simpler conceptually.

Additional examples:

CasavaOneEightSingleLanePerSampleDirFmt casava_1_8_single_lane_per_sample

SingleLanePerSamplePairedEndFastqDirFmt single_lane_per_sample_paired_end_fastq

OrdinationFormat ordination

OrdinationDirectoryFormat ordination ← we may still need some kind of suffix, but this conflict mostly comes up with single file directory formats. Usually that isn't what you actually want anyways, so perhaps directory formats could have a trailing _?

gregcaporaso commented 8 years ago

I think underscores would be better for the format names for the reasons you suggest.

jairideout commented 8 years ago

👍 for underscore names

ebolyen commented 8 years ago

How do we want to handle OrdinationFormat and OrdinationDirectoryFormat? I am starting to like the idea of ordination and ordination_ respectively. This situation actually comes up a lot, and there isn't a great reason to ask for the directory form (instead of the single file) of a single-file directory format anyhow.

ebolyen commented 8 years ago

Additionally if we could get this change in sooner rather than later, then we can just drop support for the UpperCase forms since we are still breaking the archive format atm. Then we would be in a position to actually guarantee some level of backwards compatibility.