Skip to main content

astropy@GSoC Blog Post #4, Week 4 - Lessons in CodeStyle

Damn yaar! 
I didn't know this. Astropy can be a dangerous place. There are codestyle ninjas present. Hidden in plain sight. It's not just the PEP8 speaks from GitHub actions. There are real people in it too. And worse of all they don't allow merging the Pull Request (PR) until we do what they say. All in the name of adhering to modern standards that improve readability. What has open source come to! Really?

This and the past week, below listed is what the codestyle ninjas have made me do to my otherwise perfectly working code: (copied without permission from GitHub)
  • TABLE should not be used as a variable name
  • No camelCase anywhere. For example, tableDescription should be table_description.
  • Module level variables as SCREAMING_SNAKE_CASE. E.g. BYTE_BY_BYTE_TEMPLATE not ByteByByteTemplate.
  • Regular variables, functions, methods are lower_case_underscore_separated, never camelCase or CapsCase.
  • Private methods start with one underscore not two, e.g. def _split_float_format instead of def __splitFloatFormat.
  • No inline blocks like, if sign: col.meta.size += 1
  • Avoid one-line variable names, but especially l that looks like 1.
  • List values alignment, dictionary values alignment, function definition line alignment, alignment this and alignment that and so on...
  • And no white-spaces please, trailing or whatever!
Yeah! For some weird reason, the codestyle ninjas at Astropy seem to hate Camels and are extravagantly fond of Snakes! Dunno why? I for one reallyLikeCamelsAndTheirCase. Ha! Ha!


Disclaimer: The above post is in jest and should not be taken seriously. Sometimes Snakes are better than Camels. AND SCREAMING SNAKES ARE MORE BETTER. All hail PEP8!

Comments

Popular posts from this blog

astropy@GSoC Blog Post #3, Week 3

So, it's the start of the 3rd week now. I will be virtually meeting Aarya and Moritz again Tom. For the past few weeks now, I have been pushing commits to a Draft PR  https://github.com/astropy/astropy/pull/11835  on GitHub. I wanted to have something working quite early in the project, in order to be able to pinpoint accurately when something doesn't work. This is why I started with directly adding the cdspyreadme code within Astropy. Afterwards, I am also writing the code from scratch. As more of the required features from cdspyreadme get integrated into cds.py , those files and codes added earlier will be removed. About the reading/writing to Machine Readable Table format, in fact I wrote about it briefly in my GSoC Proposal that I could attempt it as an extension. I don't have an opinion on whether or not it should have it's own format classes etc. However, since the title of my GSoC project is to Add a CDS format writer to Astropy , I would prefer to work on the ...

Why do my poems be?

Why do my poems be like water rushing in a rapid I seem to love four four letters in a row four lines in a tow Why do my poems be like joyful bursts of sporadic laughter short sweet fragrant after as if they need reader till writer greets Why do my poems be like dreamy sunrise on mountain summit I seem to have taken the road hither nobody seldom goes thither Why do my poems be like hazy reflections upon silent sea roaring rolling beneath before perhaps the one sought perhaps the one aft

astropy@GSoC Blog Post #6.5 - Week 10, Final Evaluations

Hey there, How you holding up? So, this is the end of astropy@GSoC  time period. There was a time growing up when I used to wonder about Astropy people. About those science wizards who worked on writing computer programs for an esoteric software thing that made calculations of the universe, with a bizarre portmanteau of a name, astro-pie . Haha, and now, as the project finishes up, I am one of those fabled wizards. Well, it has been quite a ride, hasn't it? Let's first take a step back to recap what the context of my Google Summer of Code project was and then have a detailed look at what has been done. Below is part of the short project synopsis I had submitted during the application process back in April. One important feature of Astropy is reading and writing tabular data in a wide variety of useful formats. One such astronomical data storage format is the CDS-ASCII format employed by Centre de DonnĂ©es astronomiques de Strasbourg (CD...