@ehmatthes@fosstodon.org
@ehmatthes@fosstodon.org avatar

ehmatthes

@ehmatthes@fosstodon.org

Author, teacher, programmer, outdoor guy · ehmatthes.com · Python Crash Course · django-simple-deploy

This profile is from a federated server and may be incomplete. Browse more on the original instance.

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

I will admit to spending the first half hour of today's sprints figuring out why my tests weren't running, only to realize I had pytest installed system-wide on my laptop. 🤦‍♂️

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

There's been interesting takes on minimal single-file Hello World projects in Django. I think one of the values of this is building up a project from a single file to a standard, full Django project.

Interesting question: At what point in this process would you need to break out of the single file?

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

Python people, do you make short-lived intermediate variables to make your return statements readable?

For example, which of these would you tend to prefer?

def get_project_name(output_str): """Get project name from output of

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

What's everybody using to make their talk slides these days?

I've given a number of talks, but they've been spread out enough over the years that I've never developed deep familiarity with any one tool. I've mostly used PowerPoint and Keynote.

If you use reveal.js, do you use the basic setup? Full install? Hosted version?

ehmatthes, (edited ) to random
@ehmatthes@fosstodon.org avatar

Programmers, do you use your arrow keys, or do you use other keyboard shortcuts for navigation?

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

All right, for anyone wondering I am definitely planning to move off of quite soon. I want to take a moment to share some specifics about why it's hard for a lot of people to move off the platform, even though you "own your list".

I think most of the stories people are seeing about migrating away from Substack are from prominent writers. If you have a large subscriber base, it is cheaper to use a different platform:

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

Wow @webology, Syncthing made it so easy to jump back onto my desktop this morning and pick up right where I left off on the plane last night.

ehmatthes, to python
@ehmatthes@fosstodon.org avatar

TIL how to use itertools.dropwhile() to get all lines from a file after a specific line. I always used to write my own loop to solve this problem.

I'm curious, have you heard of dropwhile()? Have you used it?

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

Is there anyone at with a background in seismology?

I'm wondering if it's possible to recognize landslides from seismic data. If so, it would help identify exactly when some landslides in our community happened.

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

I believe I ran into a weird macOS bug that's been around for a long time. My headphones were sounding really odd, and I wondered if my hearing was off today.

I kept playing with the volume, and reconnecting, and finally listened to each side separately. I've never even looked at the macOS balance slider, but it had jumped almost all the way to the left?!

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

I finally used the walrus operator last night, and now I'm using it in a lot of places. I'll be curious to see if it's particularly applicable to this project, or if I start to use it more regularly.

It's another good use of GPT. "Can I use the walrus operator to improve this code?" was much more efficient than reading through docs to use it for the first time.

Of course, I was only aware of the possibility from having read the docs in the first place.

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

Here's my take on the single-file Django project:

https://www.mostlypython.com/django-from-first-principles-part-2/

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

I've finally set up a proper test suite for all the code in Python Crash Course. It's been a years-long journey from manual testing, to some attempt at walking the repo and running everything, and now to a dedicated test suite that does exactly what I want.

Testing code for a book is of course a lot like testing code for any project, with some interesting differences.

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

I've seen conversations recently about utils/, utils.py, toolbox, and other places for misc code.

Does anyone else make a sandbox/ dir, or a sandbox.py file, and add that to .gitignore?

Or do you run all your experiments outside your project? Or call it something different?

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

I wrote a "Django 5.0 is out" post.

Other people have covered new features well, so I focused on a few other things: understanding Django's version numbering system, how to upgrade a simple project, and a small section on deployment.

https://www.mostlypython.com/p/django-50-is-out

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

Would anyone in my Python circle here be willing to review an upcoming article about testing?

I'm not looking for a detailed review, just a quick "yeah that sounds good" or "no, you're way off!"

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

Where do people put guidelines around implementation choices in a project?

For example I want to make a note to use path.read_text() instead of with open(), and a brief rationale.

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

Earlier this year I invested in a Mac Studio so I could keep some VMs running without having to shut everything else down.

I'm happy to report that I have left a Windows VM running all day, and my tests in that VM run faster than they do on my older intel-based MacBook Pro.

I'm running tests simultaneously on the main macOS system, and in the VM. This is fantastic!

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

Is anyone here using the public hosting option from

I was excited to try it, but was appalled to see them requiring read and write access to all private repos just to work with a single public repo.

I found a workaround to avoid giving that permission, but I'm wondering what others are doing.

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

For anyone following Substack's content moderation issues, I finally posted my thoughts:

https://www.mostlypython.com/p/substacks-nazi-problem

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

All right, here's a fun Django question:

You start a simple project, using SQLite locally. You write a model, then call makemigrations, then call migrate.

At what point is the db.sqlite3 file created?

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

I finally wrote a small set of Git aliases, and life is already better. :)

gits -> git status
gcam -> git commit -am
gpo -> git push origin

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

One of the questions I get on a regular basis is some form of: "How do I start writing code for an [exercise | project]?"

My brief answer usually has two parts:

  1. In programming you can just try something and see if it works. So try something and see if it works! If it doesn't, troubleshoot what you tried and go from there.

This either leads to a path forward, or a more specific question.

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

I've been wanting to see better code blocks in email newsletters for a long time. I'm hoping Ghost makes that possible.

I'm trying to show it's possible with this week's post. Here's a default Ghost code block, and a revised version that seems to work:

Same code block, with highlighting applied.

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

If you happen to have a Mac Studio, you might want to pick it up and see what the intake looks like. I rearranged my desk space last night, and was surprised to find a ring of dust around the entire base.

That intake design seems to collect and hide dust.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • rosin
  • thenastyranch
  • ethstaker
  • InstantRegret
  • osvaldo12
  • DreamBathrooms
  • Durango
  • magazineikmin
  • khanakhh
  • Youngstown
  • everett
  • slotface
  • kavyap
  • JUstTest
  • mdbf
  • ngwrru68w68
  • tacticalgear
  • cubers
  • GTA5RPClips
  • modclub
  • Leos
  • tester
  • megavids
  • cisconetworking
  • normalnudes
  • anitta
  • lostlight
  • All magazines