The call to logging.basicConfig happens at import time, which could cause issues in certain scenarios. For a one-off script, it's probably fine, but for a production app, you'd probably want to set up logging during app startup from whatever your main entry point is.
The Python standard library has a configparser module, which should be used instead of custom code. It's safer and easier than manual parsing. The standard library also has a tomllib module, which would be an even better option IMO.
Logging configuration is done at import time for "utils" module.
Imagine code like this:
main.py:
import logging
logging.basicConfig(...)
logging.info("foo") # uses above config
if __name__ == "__main__":
import utils # your config is overridden with the one in utils
logging.info("bar") # uses utils configuration
...
Or two "commands", one importing utils and another not: they would non-obviously use different logging configuration.
It gets even crazier: you could import utils to set the configuration, override it, but a second import would not re-set it, as module imports are cached.
Basically, don't do it and no unexpected, confusing behaviour anywhere.
As a non Python developer, what would be the use-case(s) for importing a module inside of the main function instead of importing it at the top of main.py with the others?
Since the entire evaluation and running is dynamic, you don't need to import (and thus evaluate) a module in certain branches.
Eg. that `if __name__` trick is used to allow a module to be both a runnable script and importable module.
Top it off with plenty of common libraries being dog-slow to import because they are doing some of the anti-pattern stuff too, and you end up executing a lot of code when you just want to import a single module.
Eg. I've seen large Python projects that take 75s just importing all the modules because they are listing imports at the top, and many are executing code during import — imagine wanting to run a simple unit test, and your test runner takes 75s just to get to the point where it can run that 0.01s test for your "quick" TDD iteration.
You can also look at Instagram's approach to solving this over at their engineering blog.
I've been writing client-side JS/TS for many years and still enjoy it, but there are scenarios—quite a few in my opinion—where targeting WASM is a better technical and business choice. It's just a "right tool for the job" kind of thing.
In its heyday, before the most recent acquisition, Twitter was really good for local info (ignoring celebrities, shitposting, and the like). Not just news but announcements, alerts, and other local stuff if you followed the right accounts.
Mastodon is cool, but it's hard to consistently find that local info. Bluesky seems like it has a chance of supplanting Twitter in this way, but it's not there yet. Some of the accounts I used to follow on Twitter are on Bluesky, but they don't post. If they started, I think they'd get tons of followers now.
I used to see a lot of furry accounts in the Discover feed, but I mute them when I see them, and now I rarely see them any more. I don't have anything against furries, but it's not content I'm interested in. This is more a comment that Bluesky does seem to have an algorithm (at least in the Discover feed) that is sensitive to what you do or don't show interest in. Or it could just be that a lot more people have joined recently, so the furry stuff just isn't as prevalent.
Discover has a separate "show more/less like this" button too.
Every feed on the site is its own algorithm, and most are made by third-parties. Some of the more interesting ones have fallen over and broken a little as the volume of posts has increased. The various "catch up" feeds that show the most popular recent posts give a good impression of what's happening site wide (minus any blocks/mutes).
This is awesome. Here are a couple bits of feedback:
- It took me a while to find the Metadata tab to edit a request's name, I guess because I don't think of the name and description as metadata (even if in a technical sense they are, relative to the request config). My inclination would be to make this the first tab and rename it to Info.
- I somehow managed to save two requests into the same file with no warning/confirmation from the UI.
- When using the up/down arrows to navigate between requests in a collection, I found it counterintuitive to have to hit Enter to actually select the request.
Considering how important style is in most genres, I think the swipe interface could be a good way to quickly find better potential matches, assuming there's a pre-filter based on your selected genres.
If I was looking to start a band today, I'd definitely give this kind of thing a try.
I've recently started using Lighthouse to test sites for accessibility compliance, and you can easily get a score of 100 without actually addressing all the accessibility issues a site might have. So, if you're not conscientious, you can just point at the score and say "all good" while your site might still have major issues.
I assume the same is true of the other checks Lighthouse does for performance, best practices, etc.
Lighthouse and other such tools are a good starting point, and using them is better than doing nothing, but a thorough understanding of accessibility etc is necessary to create truly accessible and performant sites.
I used to be one of those devs, thinking I had the most beautiful coding style.
When I embraced formatters, I started spending so much less time and effort keeping the style "correct" and worrying about how other people on the team format code. I love just hitting save in my editor and having the code formatted without having to fiddle with quotes, wrapping, etc.
With regard to bike-shedding about style, it mostly goes away once a team adopts one of the standard formatters for a given language. That's sort of the whole point.
The Python standard library has a configparser module, which should be used instead of custom code. It's safer and easier than manual parsing. The standard library also has a tomllib module, which would be an even better option IMO.