Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
I have finally released a new version for my package, Arrest 0.1.10

After many months of procrastination, I have finally managed to release version 0.1.10 of my package Arrest.

What it does

It is a package that lets you declaratively write a REST service client, configured with the sets of resources, routes and methods you want to call, and provide Pydantic models for request and responses to automatically parse them during the HTTP calls. Arrest also provides retry mechanisms, exception handling, automatic code generation from the OpenAPI specification, and much more.

Target audience

Primarily backend developers working on communicating with multiple web services from a Python client. It can also be useful in a microservice architecture where you have to write API bindings for all the dependant sevices for another service.

Comparison

There are packages that does similar things which I got to know about from this subreddit after my initial post. For example:

1. flask-muck by u/beef-runner
2. django-rest-client by u/16withScars

The key highlights of the new version are:

1. Support for arbitrary python types for request and response. These can be `list`, `dict`, `dataclass`, or `pydantic.BaseModel`, or anything that is JSON serializable.
2. Added custom hooks for handling different types of exceptions.
3. Revamped retry mechanism to make it more configurable and no implicit retries built-in

/r/Python
https://redd.it/1ghjt23
Any flask github suggestion

I'm currently learning Flaks and i want to improve my quality of code.

Do you have any good repo to look for ?

/r/flask
https://redd.it/1ghcthh
pgmooncake: run python on your Postgres tables

**What it does**

[pg\
mooncake](https://github.com/Mooncake-Labs/pgmooncake) brings a columnstore table to Postgres with DuckDb execution. These tables are written as Iceberg and Delta tables (parquet files + metadata) to your object store.

Query them outside of Postgres with DuckDB, Polars, Pandas, Spark directly without complex pipelines, stitching together ad-hoc files, or dataframe wangling.


**Target audience**

Product engineers, data engineers, data scientist.


**Comparison**

You can use psycopg2 / sqlalchemy today. But the approach here is fundamentally different. You're writing data to an s3 bucket. You can share that bucket to your data science, engineering, analyst team without giving them access to your Postgres.


There are some Parquet exporters in Postgres (pg\
duckdb, pg_parquet, pg_analytics). pg_mooncake actually exposes table semantics inside of Postgres (updates, deletes, transactions). And table semantics outside of Postgres (Iceberg/Delta).

Story time!

I'm one of the founders of Mooncake Labs. We are building the simple lakehouse without the complex pipelines / data engineering infra.

Modern apps are built on Postgres. And we want to bring the python processing and analytics closer to this ecosystem.

Postgres and Python are all you need.



/r/Python
https://redd.it/1ghgmmq
Projects for open source contributions

I am a junior developer currently and I am interested in contributing to some good, impactful open source projects that are making people's lives easier. I am primarily looking for projects in Python and Django to contribute to.
Can I get some recommended projects, especially in django (or django-rest for that matter). Since I'm a beginner and do not have a rich experience (especially in large-scale projects) I would like to be recommended projects that are not so daunting (like django itself) :)

/r/django
https://redd.it/1ghpb2r
Run a command, then stream the stdout in real time?

Been researching how to do this and simply couldn't get any of the answers / idk if they are even relevant to me.

I have a command that runs after a POST to the server, via `subprocess.run`. Let's just say it's `ping -c 100 8.8.8.8`.

import subprocess

u/app.route("/whatever", methods=["POST"])
def whatever():
proc = subprocess.run(
"ping -c 100 8.8.8.8",
shell = True,
capture_output = True
)

I want to receive the stdout of that command from HTTP(S), appearing in real time as they come. I'm fine if we're just checking stdout every, say, 5 seconds, as long as the output is sent to the user as it

/r/flask
https://redd.it/1gi0vjs
A filesystem navigator for the terminal


## What My Project Does

Terminal-tree is an experimental terminal-based filesystem navigator. You can explore your filesystem and preview files within the terminal.

Very early stage, I've been playing with the look and feel, but it could form the basis of a larger tool. Possibly a file manager, or file picker.

It is built with the Textual framework (which I also develop), and is a reasonably good example of a more complex widget which integrates blocking calls with an async framework.

The code is currently a single file:

https://github.com/willmcgugan/terminal-tree/blob/main/tree.py

More details on the repository:

https://github.com/willmcgugan/terminal-tree


## Target Audience

Anyone interested in building a terminal app. It is fun to play with (hopefully) but doesn't have any functionality on top of navigating and previewing files.

I'm open to suggestions on what could be built on top of this.

## Comparison

You could compare it to Ranger, Midnight Commander, or similar tools.

/r/Python
https://redd.it/1gi3tqo
I discovered context processors

Today I discovered context processors, basically I needed a variable to be globally accessible across all the templates, and wola Django has a built-in and elegant solution.

I love this tool so much!

/r/django
https://redd.it/1ghxoy8
One thing about us developers is that we not business people so if you have experience working at a failed startup, what are some signs to look out for to see if you in a sinking ship?

As someone that has worked in a startup that did not do well. I think the signs were there when we client requests were inconsistent. We would serve a client there and there but there was no project that lasted a long time cause usually the service we provided would be complete in a month or 2. The company was funded to build a product so we can transition from providing a service to providing a Saas product but when the investors pulled out that's when it hit the fan that client work revenue was not enough to run a company and we were surviving off funding.

/r/django
https://redd.it/1ghzv3w
What would Enaml 2.0 look like? | nucleic/enaml | Declarative UI

From Enaml's docs:

> Enaml brings the declarative UI paradigm to Python in a seamlessly integrated fashion. The grammar of the Enaml language is a strict superset of Python. This means that any valid Python file is also a valid Enaml file, though the converse is not necessary true. The tight integration with Python means that the developer feels at home and uses standard Python syntax when expressing how their data models bind to the visual attributes of the UI.

> . . .

> Enaml’s declarative widgets provide a layer of abstraction on top of the widgets of a toolkit rendering library. Enaml ships with a backend based on Qt5/6 and third-party projects such as enaml-web and enaml-native provides alternative backends.

---

A maintainer of Enaml has just opened a brainstorm discussion on the next major development goals.

It's a project I've long admired, though rarely used, and I'd love to see it get some attention and a revamp. I think the bar these days has been raised by projects like QML and Slint, which provide a great context in which to set new goals.

/r/Python
https://redd.it/1gi2vwa
How to implement RBAC using Flask-Restful?

Hello Everyone
I am a newbie. I am using flask for a SaaS product for my company. Earlier I was using flask and custom decorators for Role Based Access Control(RBAC). But during code review they asked to change the API end points to Flask-Restful. So I am confused about this.

Thank You in advance.

/r/flask
https://redd.it/1gi2la3
Sunday Daily Thread: What's everyone working on this week?

# Weekly Thread: What's Everyone Working On This Week? 🛠️

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

## How it Works:

1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.

## Guidelines:

Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

## Example Shares:

1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟

/r/Python
https://redd.it/1gia4ox
Hello everyone I'm a beginner in django I took help of youtube to start my project of advance finance tracker but I'm lost as there are so many ways could you guys help me out

For my final year main project our group thought of doing django with data science but as I'm not a expert to be frank(I know only basics ) could you guys help me out 🙏 I'll be able to survive my last year

/r/django
https://redd.it/1gif0rw
Robyn finally supports OpenAPI/Swagger

Hey Everyone 👋

We just launched OpenAPI docs generation in Robyn. - https://github.com/sparckles/Robyn/releases/tag/v0.63.0

(For the unaware Robyn is a Super Fast Async Python Web Framework with a Rust runtime. )

It was one of our community's most requested features, and I hope you all will like it.

Do let us know what you think of it 😊

You can find the docs at - https://robyn.tech/documentation/api\_reference/openapi

/r/Python
https://redd.it/1gieai3
Python Institute Certs: Automation Track = Networking?

Hi there,

found that there is an automation certification track including the certs PCEA and PCAA at the Python Institute. Supposedly appearing in 2024.

https://pythoninstitute.org/certification-tracks

However, in the list that precedes the infographic, it is the python for networking track (certs PCEN and PCAN) that is mentioned next to the other tracks such as general programming etc.

Does anyone happen to know whether these are going to be the same certs/ merged?
In the sense of network automation? The different letters suggest they are different, but I’m confused why one appears in the list and the other one in the infographic.

/r/Python
https://redd.it/1gigwbg
How Do You Know When Your Project Idea is The One?

I’m curious about how other developers decide when a project idea is worth fully committing to. You know, that moment where you think, “This is it. This could be big,” and feel driven to go all-in and working on it nonstop.

For those who have had that experience how did you know this was the idea? Was it a response you got from potential users, or maybe just a gut feeling? And if you did go all in, how did it go?

I’m working on some ideas of my own and trying to figure out when to know if one of them has real potential. I’d love to hear your stories and any advice you might have.

/r/djangolearning
https://redd.it/1gif6o1
What features are missing in Django?

1. What features are missing in Django?

2. Are you happy with the current state of Django?



/r/django
https://redd.it/1gijjyw