GTest Submodule
Posted on October 7, 2015
(Last modified on May 22, 2026)
| Henry Schreiner
Note: There is a better way to do this described
here.
If you’ve ever tried apt-get or brew to try to install gtest, you are
probably familiar with the fact that gtest is not “recommend” for global install
on your system. As an alternative, the recommendation is that you make it part
of your project. The process for making gtest part of your project, however, is
not well documented, at least for modern git projects. What follows is the
procedure I used to do so.
[Read More]Slots in Python
Posted on August 6, 2015
(Last modified on May 22, 2026)
| Henry Schreiner
Slots seem to be poorly documented. What they do is simple, but whether they are
used is tricky. This is a little mini-post on slots.
[Read More]Basics of metaclasses
Posted on August 6, 2015
(Last modified on May 22, 2026)
| Henry Schreiner
This is a quick tutorial over the basics of what metaclasses do.
Metaclasses, while seemingly a complex topic, really just do something very
simple. They control what happens when you have code that turns into a class
object. The normal place they are executed is right after the class statement.
Let’s see that in action by using print as our metaclass.
[Read More]Factory classmethods in Python
Posted on July 29, 2015
(Last modified on May 22, 2026)
| Henry Schreiner
I haven’t seen a great deal of practical documentation about using classmethods
as factories in Python (which is arguably the most important use of a
classmethod, IMO). This post hopes to fill in that gap.
[Read More]Making an autoload extension for IPython
Posted on July 24, 2015
(Last modified on May 22, 2026)
| Henry Schreiner
I recently decided to try my hand at making an auto-load extension for Python
and Plumbum. I was planning to suggest it as a new feature, then I thought it
might be an experimental feature, and now it’s just a blog post. But it was an
interesting idea and didn’t seem to be well documented process on the web. So,
here it is.
The plan was to make commands like this:
[Read More]Uncertainty extension for IPython
Posted on July 24, 2015
(Last modified on May 22, 2026)
| Henry Schreiner
Wouldn’t it be nice if we had uncertainty with a nice notation in IPython? The
current method would be to use raw Python,
from uncertainties import ufloat
print(ufloat(12.34, 0.01))
12.340+/-0.010
Let’s use the infix library to make the notation easier. We’ll define |pm| to
mean +/-.
[Read More]Plumbum color
Posted on July 22, 2015
(Last modified on May 22, 2026)
| Henry Schreiner
I’ve been working on a color addition to Plumbum for a little while, and I’d
like to share the basics of using it with you now. This library was originally
built around a special str subclass, but now is built on the new Styles
representation and is far more powerful than the first implementation. It safely
does nothing if you do not have a color-compatible systems (posix + tty
currently), but can be forced if need be. It is included with Plumbum, so you
don’t have to add a requirement for your scripts that is non-essential (as color
often is). It is integrated with plumbum.cli, too. Also, I’ve managed to
accelerate the color selection algorithms about 8x, allowing near game-like
speeds. (see the fullcolor.py example).
[Read More]University of Texas Doctoral Thesis Template
Posted on July 12, 2015
(Last modified on May 11, 2022)
| Henry Schreiner
I have created a thesis class file for a UT Thesis in LaTeX. It has already been
used for at least one passing thesis, so it does meet the current UT guidelines.
(Please let me know if there are any issues!)
Since I use Bitbucket for all my private repositories (like my thesis itself),
the code is in a Bitbucket repository rather than GitHub. Here is the link if
you want to create a pull request or want to compile the class and documentation
from the source .dtx file.
[Read More]