Archive

Author Archive

Sane GitHub Labels

January 15, 2019 Leave a comment

TLDR; the default GitHub labels kinda suck; use a sane labelling scheme instead; and use git-labelmaker to simplify GitHub label editing.

https://medium.com/@dave_lunny/sane-github-labels-c5d2e6004b63

Advertisements
Categories: Interesting

GNU Makefile setting env variables

January 12, 2019 Leave a comment

Problem:
Exporting env variables in Makefiles. The issue was that the environment variables were not visible across different targets. I needed the same env vars to be seen in both target1 and target2 below.

Solution:
Export the variables outside the target, eg at the top of the file.

VALUE1="myvalue1"
VALUE2="myvalue2"

export VALUE1
export VALUE2

target1:
    echo $VALUE1

target2:
    echo $VALUE2

Source:
https://stackoverflow.com/questions/2826029/passing-additional-variables-from-command-line-to-make
https://www.linuxquestions.org/questions/programming-9/exporting-makefile-variables-to-%24-shell-environment-807422/

Categories: bash, Interesting Tags: ,

DevTernity 2017: Ian Cooper – TDD, Where Did It All Go Wrong

January 9, 2019 Leave a comment

Since Kent Beck wrote the book on TDD in 2002 a lot of words have been dedicated to the subject. But many of them propagated misunderstandings of Kent’s original rules so that TDD practice bears little resemblance to Kent’s original ideas. Key misunderstandings around what do I test, what is a unit test, and what is the ‘public interface’ have led to test suites that are brittle, hard to read, and do not support easy refactoring. In this talk, we re-discover Kent’s original proposition, discover where key misunderstandings occurred and look at a better approach to TDD that supports software development instead of impeding it. Be prepared from some sacred cows to be slaughtered and fewer but better tests to be written.

Categories: Interesting Tags: ,

Keep a Changelog

January 4, 2019 Leave a comment

What is a changelog?

A changelog is a file which contains a curated, chronologically ordered list of notable changes for each version of a project.
Why keep a changelog?

To make it easier for users and contributors to see precisely what notable changes have been made between each release (or version) of the project.
Who needs a changelog?

People do. Whether consumers or developers, the end users of software are human beings who care about what’s in the software. When the software changes, people want to know why and how.


https://keepachangelog.com/en/1.0.0/

Categories: Interesting

Designing Well-Structured REST APIs with Flask-RestPlus: Part 1

December 11, 2018 Leave a comment

This is the first part of a two-part series. In this post, I will introduce Flask-RestPlus and demonstrate how to start organising APIs around its simple REST-based conventions. Next time, I will address the topic of request/response marshalling (serialisation) and validation.

https://preslav.me/2018/12/02/designing-well-structured-rest-apis-with-flask-restplus-part-1/

Categories: python Tags:

5 Lessons Learned From Writing Over 300,000 Lines of Infrastructure Code

December 10, 2018 Leave a comment
Categories: Interesting

pip – ImportError: cannot import name main

December 7, 2018 Leave a comment

Problem:
Getting above error when running pip

ubuntu@ubuntu-xenial:~$ pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 646kB/s 
Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


ubuntu@ubuntu-xenial:~$ pip install --upgrade pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main

Solution:

ubuntu@ubuntu-xenial:~$ python -m pip install -U pip
Requirement already up-to-date: pip in ./.local/lib/python2.7/site-packages (18.1)

Source:
https://stackoverflow.com/questions/28210269/importerror-cannot-import-name-main-when-running-pip-version-command-in-windo

Categories: python