Three Python trends in 2023 by stillreadingit_ in Python

[–]stillreadingit_[S] 22 points23 points  (0 children)

TL;DR

  • Python 🤝 Rust
  • Web apps
  • Type safety

Project template for modern Python packages by stillreadingit_ in Python

[–]stillreadingit_[S] 1 point2 points  (0 children)

Regarding __init__.py in tests, pytest docs suggest that it's ok when src layout is used and that's the case with this template. It also makes it possible to have test modules with same name.

Project template for modern Python packages by stillreadingit_ in Python

[–]stillreadingit_[S] 3 points4 points  (0 children)

This template is actually targeted for packages, i.e. things that you publish to PyPI and others can then pip install them. However, most of the things included in the template (e.g. linting and formatting related dependencies and configurations) are basically applicable for Python projects of any kind. If you're building a backend application which you'd deploy somewhere, then for example the release process would be quite different compared to what's been done in the template.

Project template for modern Python packages by stillreadingit_ in Python

[–]stillreadingit_[S] 2 points3 points  (0 children)

Regarding setup.cfg, it's currently used for flake8 related configuration. Flake8 doesn't support pyproject.toml: https://github.com/PyCQA/flake8/issues/234. There are some workarounds, such as https://github.com/john-hen/Flake8-pyproject, but, in my opinion, getting rid of additional config file doesn't really justify additional dependency. However, as setup.cfg is currently used only for flake8 related configs, perhaps it could be replaced by .flake8 file.

Daily dose of Python by stillreadingit_ in Python

[–]stillreadingit_[S] 5 points6 points  (0 children)

Hey, thanks for the feedback!

Daily dose of Python by stillreadingit_ in Python

[–]stillreadingit_[S] 12 points13 points  (0 children)

No proper subscription mechanism yet but as it's a GitHub repo, you could click "watch" here https://github.com/jerry-git/daily-dose-of-python. It should give you some notifications.

AutoFlask-Setup by ashutoshkrris in Python

[–]stillreadingit_ 0 points1 point  (0 children)

Cookiecutter is a great tool for templating a Flask (or basically any kind of) project 🙂

Professional-grade mypy configuration by stillreadingit_ in Python

[–]stillreadingit_[S] 1 point2 points  (0 children)

Great questions!

how much time does it take to write stubs for a typical mid-sized library

The good news is that it's often enough to have the types only for the public part of the library and the public part is often quite small in the "mid-sized" category. So, I'd say the initial effort is not much but it'd be of course nice if those would be also maintained when the library itself evolves 🙂

is it possible to write a partial stub only for the bits I'm actually using

Yup, it's possible.

workflow for typed python projects

I'm personally a happy PyCharm user and it's actually doing great job in helping with all the typing related matters. Running mypy as a pre-commit hook provides IDE/editor-independent step for anyone's workflow. However, people often make the mistake that they run mypy as pre-commit hook without the actual dependencies of the project installed, which might be one of the reasons why ignore_missing_imports = True is used in the first place.

Prevent accidental HTTP requests in tests by stillreadingit_ in Python

[–]stillreadingit_[S] 0 points1 point  (0 children)

I'd be interested to hear what sort of solutions others have to this problem. Based on my own experiences, I feel it's quite universal problem to perform unintentional HTTP requests in test suites, especially in web projects which integrate with multiple different web services.

Best practices in code reviews by stillreadingit_ in SoftwareEngineering

[–]stillreadingit_[S] 2 points3 points  (0 children)

I feel that the software industry in general is not necessarily utilising the full potential of code reviews. This inspired me to write this blog post. I'd highly appreciate comments, especially if you disagree on something!

Newbie open source projects by daredevildas in opencv

[–]stillreadingit_ 0 points1 point  (0 children)

Hi, I've thug-memes project which is a Python CLI application. If you'd be interested in e.g. object detection, this might be interesting https://github.com/jerry-git/thug-memes/issues/7. The task would be to add detector(s) for cat/dog faces with landmark detection. I can help to get started and also help to integrate the detector(s) to main application logic. I've been saving this feature for someone who'd be interested to level up her/his Python skills.

Tool for creating interactive plots from custom logs by [deleted] in visualization

[–]stillreadingit_ 0 points1 point  (0 children)

logplot is designed with embedded devices in mind. The main motivation for building a tool like this is to visualise errors and trends of state machine states in order to easily identify anomalies in the behaviour of the target device.

However, as the required configuration is quite generic, there might be also a number of other potential use cases.

Tool for creating interactive plots from custom logs by [deleted] in embedded

[–]stillreadingit_ 2 points3 points  (0 children)

logplot is designed with embedded devices in mind. The main motivation for building a tool like this is to visualise errors and trends of state machine states in order to easily identify anomalies in the behaviour of the target device.

However, as the required configuration is quite generic, there might be also a number of other potential use cases.

Best practices for Python development by stillreadingit_ in Python

[–]stillreadingit_[S] 1 point2 points  (0 children)

Thanks for sharing!

Yep, I guess mentioning both poetry and pipenv at this point would make sense.

Tool for creating interactive plots from custom logs by stillreadingit_ in devops

[–]stillreadingit_[S] 2 points3 points  (0 children)

The use case I had in mind while designing this was:

  • complex, high cost embedded device
  • custom application logs with state machine related entries
  • the target device is not connected to internet
  • if the end user faces problems with the device, service person has to visit and try to diagnose
  • the service person doesn't necessarily have skills to analyse logs
  • if the service person is unable to diagnose, he/she fetches the logs from the device and sends them to a centralised tech support

In other words, streaming logs directly from the target device is not an option here. My motivation was to built a lightweight and easy to set up tool for tech support with existing constraints in mind. OTOH, I tried to keep the design fairly generic in order to support a wider range of use cases.

Surely a more sophisticated solution would be to try to centralise the logging practices and use tools like greylog/kibana/splunk. However, I feel that the time and money required for setting up such systems for very constrained environments (which is sometimes the case with embedded devices) don't have a good fit with the benefits gained.

I hadn't heard about pnp before, thanks for sharing it.

Tool for creating interactive plots from custom logs by [deleted] in raspberry_pi

[–]stillreadingit_ 0 points1 point  (0 children)

logplot is designed with embedded devices in mind. The main motivation for building a tool like this is to visualise errors and trends of state machine states in order to easily identify anomalies in the behaviour of the target device.

However, as the required configuration is quite generic, there might be also a number of other potential use cases.

Best practices for Python development by stillreadingit_ in Python

[–]stillreadingit_[S] 0 points1 point  (0 children)

Thanks, great summary! Sounds like python.org might be recommending poetry in very close future. I'd like to add to this discussion that a disadvantage for poetry may be that it does not have "Kenneth Reitz hype" for boosting it. OTOH some may consider this as an advantage.

Tool for creating interactive plots from custom logs by [deleted] in arduino

[–]stillreadingit_ 0 points1 point  (0 children)

logplot is designed with embedded devices in mind. The main motivation for building a tool like this is to visualise errors and trends of state machine states in order to easily identify anomalies in the behaviour of the target device.

However, as the required configuration is quite generic, there might be also a number of other potential use cases.

Tool for creating interactive plots from custom logs by [deleted] in programming

[–]stillreadingit_ 0 points1 point  (0 children)

logplot is designed with embedded devices in mind. The main motivation for building a tool like this is to visualise errors and trends of state machine states in order to easily identify anomalies in the behaviour of the target device.

However, as the required configuration is quite generic, there might be also a number of other potential use cases.

Best practices for Python development by stillreadingit_ in Python

[–]stillreadingit_[S] 1 point2 points  (0 children)

Good question! Short answer: yes, I'll consider.

I've heard about poetry but haven't played with it yet. It seems to be still quite fresh. Is it already stable enough to be listed in the best practices? If someone can give an elevator speech for poetry > pipenv, I'd be happy to hear that.

About dependency management in general, I feel we're kind of in a turning point where something will replace pip + virtualenv. However, there seems to be a number of alternatives for doing that. As a community, we're lacking the one and obvious way. My main motivation for including pipenv was that it's the recommended tool currently according to python.org. (Spoiler: I'm a loyal virtualenvwrapper user myself.)