Siv Scripts

Solving Problems Using Code




Mon 27 January 2020

Managing Python dependencies with pip-tools and requirements.txt

Posted by Aly Sivji in Quick Hits   

The paradox of choice in Python packaging tools makes dependency management more complex than it needs to be. In this Quick Hit, we will explore Python dependency management and demonstrate an easy-to-implement workflow to generate reproducible environments.

Note: this article assumes familiarity with virtual environments.


Background

We use dependency management …

Read more...


Wed 21 November 2018

Patching Import Inside Function

Posted by Aly Sivji in Quick Hits   

I started my first tech job at a large corporation. We have lots of internal tools and systems that allow us to solve large-scale data problems. It's been an interesting change from startup life where platforms weren't as mature, where systems weren't as integrated into workflows and processes.

While I'm …

Read more...


Sat 20 October 2018

Transfer Files with rsync

Posted by Aly Sivji in Quick Hits   

I recently purchased a new computer and needed to transfer files from the old computer to the new one. Tried a USB drive, no luck. Tried copying files over the network via the macOS Finder, but the sheer number of files (~500,000) made this an exercise in futility.

Googling …

Read more...







Mon 26 February 2018

PHP + MySQL using Docker Compose

Posted by Aly Sivji in Quick Hits   

Being a Software Engineer isn't just about being effective in a specific programming language, it's about being able to solve any given problem using the tools at hand.

This week at work I have to extend the functionality of a WordPress plug-in so it can fit into our microservices-based backend …

Read more...


Fri 05 January 2018

@ Python's Matrix Multiplication Operator

Posted by Aly Sivji in Quick Hits   

2017 will forever be etched in our memories as the year Python overtook R to become the leading language for Data Science. There are many factors that play into this: Python's simple syntax, the fantastic PyData ecosystem, and of course buy-in from Python's BDFL.

PEP 465 introduced the @ infix operator that is designated to be used for matrix multiplication. The acceptance and implementation of this proposal in Python 3.5 was a signal to the scientific community that Python is taking its role as a numerical computation language very seriously.

Read more...



Mon 01 January 2018

Increasing namedtuple Readability with Type Hints

Posted by Aly Sivji in Quick Hits   

Dynamic typing refers to programs checking variable types at runtime versus compile time. By not having to define the variable type as we write code, we can work faster and take advantage of duck typing.

On the other hand, we do miss out on some benefits that types bring. Similiar to how the principles of test-driven development force us to write smaller, more testable functions, thinking about types improves software design by making us cognizant of the values our variables hold as well as the values our functions can return.

Read more...




Sat 07 October 2017

Terminal Tricks: Directory Bookmarks

Posted by Aly Sivji in Quick Hits   

Even though my development folders are well organized, I still have to feel my way around the filesystem when I'm looking for a project directory. It's like trying to find a lightswitch in a dark room: a cd here, an ls there, maybe a find when I'm stuck.

I always …

Read more...



Sat 09 September 2017

Visualizing Stacks

Posted by Aly Sivji in Quick Hits   

A stack is a linear data structure that holds a collection of items. We can define operations performed in a stack from the point of view of a user:

  • .push() - add item to top
  • .pop() - remove and return item from top
  • .peek() - return top most element
  • .is_empty() - True if stack …

Read more...