Recent Posts (Page 2)

Git: How to add and remove execute permissions

Careful management of permissions on Windows.

POSIX permissions include the execute permission, which allows the file to be executed as a program. The permission can be set for each of the three classes: user, group, and others. So, for example, you can have a file that is executable only by its owning user.

Read more...

Tidelift for five packages I maintain

Here’s how the tide lifts…

Since December, several of my open source packages have been “lifted” on Tidelift. This means that Tidelift are paying me a portion of their subscription fee for continued, standardized maintenance of these packages. These funds are very appreciated, so thanks to Tidelift subscribers 🫡.

Read more...

Git: How to change the case of filenames

Dang, didn’t realize capslock was on!

Different filesystems have different case sensitivity, for example:

Read more...

Django Settings Patterns to Avoid

Settings are the engine of your project.

Here are some potential mistakes made with Django settings that you can avoid.

Read more...

Django-related Deals for Black Friday and Cyber Monday 2022

Discounts, discounts, read all about them!

Here are some Django-related deals for this year’s Black Friday (25th Nov) and Cyber Monday (28th Nov), including my own. For more deals on general Python-related products, see Trey Hunner’s post.

Read more...

unittest’s new context methods in Python 3.11 (with backports)

A testing concerto

Python 3.11 only made one change to unittest, but it’s a good one: context manager methods. These methods can simplify setup and teardown logic in many cases, such as dynamic use of unittest.mock.

Read more...

Git: How to disable status advice

Unwanted advice is annoying, no matter how it’s dressed up (generated by Stable Diffusion)

Many Git commands output “advice”, with hints about which commands you could run next. Most notably, git status gives you advice for what to do about files in each state:

Read more...

Git: An alias to speed up fixing merge conflicts

Fixing merge conflicts can feel like untangling knots…

There you are, minding your own business, rebasing your branch and… surprise! A merge conflict!

Read more...

How to search your virtualenv for mystery error messages

Now, look here… (generated by Stable Diffusion)

Sometimes error reporting loses details, and you don’t know where an error message comes from. In such cases, I have often found that the fastest way to track down the source is to search through the project and its virtualenv.

Read more...

pre-commit: How to run hooks during a rebase

Let’s make your rebases soar!

pre-commit uses Git’s hook system to run tools when you commit. Unfortunately, Git doesn’t run any hooks when making a commit during a rebase. This can lead to you rebasing a branch and not realizing some code needs fixing, at least not until your CI system runs pre-commit (say, with pre-commit.ci).

Read more...