TIL this helpful tool exists, for puzzling out just the right version specs for your dependencies.

darius.page/pipdev/

Had a great chat with my colleague Henrique Bastos today. He's done a lot of cool stuff. Check out this project to decouple app settings from code -- so you don't have to redeploy just to change a setting.

github.com/henriquebastos/pyth

Wow, a job posting that explicitly does not want "10x rockstar developers" and says that "properly tested and easy to understand often beats clever".

As a senior software engineer this is the kind of thing I want to hear from my boss. If I were in the location they want, I'd be applying right now.

If you're a engineer in the UK you should check it out.

If you're an engineering hiring manager anywhere you should read it too.

blog.textualize.io/2022/03/06/

I've always liked doctests so I was sad when I realized my doctest hack in my Django project's test suite had silently stopped working.

Happily, I've fixed it. TLDR: I now use `doctest.run_docstring_examples` from a wrapper test in my unit test suite.

What's your preferred type checking tool for ?

I'm glad that type annotations got added to -- not only because they improve the language, but also because otherwise by now there'd be some semi-compatible "Typethon" dialect and all the attendant ecosystem hassles.

If like me you have been confounded by inscrutable `jls_extract_var` and `jls_extract_def` suggestions in your in , the cause is the default Python language server (Jedi, hence "jls"). Install PyLance and select its language server instead.

Good answer (edited for space) to "Why use double-quotes in ?" from the Black docs:

"They anticipate apostrophes in English text. They match the docstring standard in PEP 257. An empty string in double quotes ("") is impossible to confuse with a single double-quote. Double quotes for strings are consistent with C, which Python interacts a lot with."

TIL that if you have an error in your logging `format` string, it may just... silently stop logging.

Somebody on Quora asked how to write a program that takes numbers from the user and returns them sorted in descending order.

I was like, ok kid, here's the answer to your homework problem. Good luck explaining it to your teacher.

print("Sorted descending:\n{}".format("\n".join(sorted(input("Enter numbers separated by spaces: ").split(), reverse=True, key=int)))) 

Seriously considering adding a pre-commit check that looks for `print` calls in code.

Came across this cool package today: whitenoise.evans.io/ "Radically simplified static file serving for Python web apps". The basic proposition seems to be, serve static files in a way that will make the most of your CDN, while reducing the complexity of your server setup.

Reminds me a bit of the Varnish HTTP cache system, which leverages operating system virtual memory facilities in a smart way rather than reinventing them.

When creating library code, how do you feel about __init__.py files that import all the public names, so that client code imports them from one place?

Reasons for your answer are welcome. Notes on this issue from the perspective of a library user are welcome too.

Presuming there are other developers besides me who periodically go looking for a simple visual catalog of code-colorizing styles, I'll share this page I made last weekend: dpaste.com/styles

After 15+ years of professional Python work I published my first package on PyPI today. Something small that I extracted from my pastebin project. Poetry made it a snap to publish. pypi.org/project/basewhat/

"Black reformats entire files in place. It is not configurable. It doesn't take previous formatting into account." github.com/psf/black

I just reformatted 2,500 lines of code with Black and literally have no complaints. It even removed some superfluous parens I had missed. And it turns out I use single quotes a hell of a lot more than I would have guessed.

I came across this new-to-me itertools function via a code-challenge site puzzle; now I'm wishing for an excuse to use it in production code! docs.python.org/3/library/iter

- just migrated myself over from mastodon.social, because this seemed like a more fitting spot. I'm a software engineer focused primarily on and .

Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.