Tag Archives: configuration

Week 3004

Z-Ray is walking like crazy now. Her tiny feet are hilarious and she now just toddles everywhere. This morning she just ran into a room and hugged me.  She brought me my shoes!  She definitely understands when I ask her to put her shoes into the shoe bench.

I love her so much I want to squeeze her for hours.

Max Lazer is going to kindergarten next week! He’s not excited yet, but I think he’ll love it. Just got a call that his ear is large and swollen, but hopefully he’s ok. We’ve been reading a lot of choose your own adventure – I like that he’s seeing how different choices control consequences. When Z cries, he’s very loving and helpful and is doing his best to comfort her or distract her.

Code

I’m thinking about how we will enhance our python support at work. As part of that I’m researching better ways to standardize configuration of objects.  You want to be able to initialize an object foo from a class Foo.

class Foo(object):
    def __init__(bar='baz')
        self.bar = bar
foo = Foo()

print(f"bar = {foo.bar}")
# "bar = baz"

Swell!  But some people may think that bar should be set to “bazzz”.

foo2 = Foo(bar='bazzz')
print(f"bar = {foo2.bar}")
# "bar = bazzz"

Easy enough. But what if I work in a place where we need to change hundreds of uses of bar among tons of different scripts and applications and whatnot?

I may want to get it from an environment variable automatically on startup. Or maybe I work in a place where we like configuring things with a .env file. Or a settings.toml.

Or maybe we want to just this once pass it in as a commandline parameter. Flexibility is really good to have.

Ideally, we can say there’s a hierarchy.

  1. A parameter passed into the constructor is the highest priority.
  2. An environment variable is the next.
  3. A config file is the next most concrete. (I could be convinced to switch these, but as long as there’s a consistent pattern, it’s good enough)
  4. The default value of the parameter in a constructor if there’s not other choice.

There are lots of good libraries out there for achieving this, at least partially. Ideally, I think I’d want to have either something we can apply as a class decorator or as through multiple inheritance.

Some good python configuration libraries I came across that I really like:

For my problem with dreamhost, I’m making progress and have been able to get a set of forward rules pretty much ready. I’m hoping to publish it pretty soon.

I don’t think I’ll get around to auto fixing the mailbox filter rules though.

Reading

I got my Kobo back after it fizzled. I’ve missed having an e-reader so much! I did get to read “The Moon is Down” by Steinbeck because we had a paperback on our shelves, but it’s so nice to be able to read a book in bed or in the bath or in the dark while a kid settles down. It’s also nice to be able to just squeeze in A Road to Common Lisp in between things because of the integration with Pocket.

Bike

Only 50 miles this week. I skipped a day because there were some team drinks on Tuesday.

I also was gently hit by a car. An Uber driver pulled into the bike lane while I was riding to drop off his passenger. As it was happening I was pounding on his window and yelling stop. I was powerless, a thing I’ve known intellectually but I never really believe. He didn’t stop, he knocked me over. I ran up to his window and explained that I am a person, that people die this way and that my children want to see me. I’m fine. Scrapes and bruises and a tendency to replay it in my head.

It spurred me to donate to Transportation Alternatives. They advocate for better laws, for protected bike lanes that don’t get used as parking spaces. For bike lanes that aren’t truck unloading zones. Things that can really save my life and help me get home.

I also finally replaced my speaker.  It’s louder, but I’m not sure how awesome.  It’s designed with push buttons instead of a volume dial, it fucking talks to you instead of doing things and it isn’t clear what it’s doing. Physical interfaces are SO MUCH BETTER than this. On the other hand, it is louder and my old one was broken.

Politics

A good thing you can do about weeknotes is talk about what is going on in the world so you can notice slow changes and not think things were always the way they are.

The government has started confiscating passports from US Citizens who are Latino. There are a very small number of cases where some midwives fraudulently filled out birth certificates. This is the pretext that a racist administration is using to attack Hispanics. Midwife births are more common for those who cannot afford hospitals or who live in areas that are too poor to support a hospital. This is not a thing that started under the current administration – but the character of what is happening has changed.

I am renewed in my determination to work continuously to replace these terrible people with less terrible people. I would love to do that with you! If you wonder what you would do in a time of crisis, the answer is that it is what you are doing right now.

Boob sweat

My buddy Dawn Hunter is smart and charming as hell. She is working on a startup that helps with sweaty ta-tas. I’m no expert, but for people that have boobs and want more comfort with them, she’s writing tips on managing boob sweat and gathering interest from people who might want a product. Get in touch with her!