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
How to think about the alpha parameter, when using Python's statsmodels.genmod.families.family.NegativeBinomial

I am using the Python statsmodels GLM function with family=sm.families.NegativeBinomial.

class statsmodels.genmod.families.family.NegativeBinomial(
link=None
alpha=1.0
check\_link=True
)

I want to learn what I should think about and how I should think when setting the alpha value.

Should I use a value for alpha that:
a. Gets the ratio Df Residuals / Pearson chi2 as close as possible to one?
b. Maximizes Log-Likelihood
c. Is a "compromise" between a and b?
d. Something else?

Thanks!

Here is documentation:  https://www.statsmodels.org/devel/generated/statsmodels.genmod.families.family.NegativeBinomial.html#statsmodels.genmod.families.family.NegativeBinomial

/r/pystats
https://redd.it/1eaac20
Streamlit or grade.io for Python web project

I struggle to decide between streamlit and grade.io for a little Python project I am running. I basically only need a few input and output fields to communicate with my Python app in the background. However, since I have to start learning one of the two - which one do you think is worth the time investment more than the other? Thanks in advance.

/r/Python
https://redd.it/1eaxr6w
Django SaaS boilerplates

What are your preferred Django boilerplates and why? If they include Vuejs + Tailwind as frontend even better! Thank you

/r/django
https://redd.it/1eawesw
Rio: WebApps in pure Python – Technical Description

Hey everyone!

Last month we recieved a lot of encouraging feedback from you and used it to improve our framework.

First up, we've completely rewritten how components are laid out internally.This was a large undertaking and has been in the works for several weeks now - and the results are looking great! We're seeing much faster layout times, especially for larger (1000+ component) apps. This was an entirely internal change, that not only makes Rio faster, but also paves the way for custom components, something we've been wanting to add for a while.

From all the feedback the most common question we've encountered is, **"How does Rio actually work?"**

The following topics have already been detailed in our [wiki](https://github.com/rio-labs/rio/wiki) for the technical description:

* What are components?
* How does observing attributes work?
* How does Diffing, and Reconciliation work?

We are working technical descriptions for:

* How does the Client-Server Communication work?
* How does our Layouting work?

Thanks and we are looking forward to your feedback! :)

[GitHub](https://github.com/rio-labs/rio)

/r/Python
https://redd.it/1eb2cta
Extending Zero Trust Network Access to a Private S3 Bucket using Boto3 and OpenZiti (both Python)

* **What My Project Does:** We use Boto3 (AWS SDK for Python) and the open source OpenZiti Python SDK to enable Zero Trust Network Access to a Private S3 Bucket with no inbound firewall ports, no need for sidecars, agents, or client proxies, nor any use of AWS Private Endpoints.
* **Target Audience**: Engineers and developers who need to connect distributed systems/apps to AWS S3 (though the technology can be used for many other use cases)
* **Comparison**: The company for whom we developed it previously used an AWS VPN client to connect from their robot to AWS Private S3 Bucket across the internet. Now they do not need to use a VPN, the zero trust overlay network is embedded in their Python apps running on/next to the robot. Further, they can close all inbound FW ports on AWS and only need outbound ports at source (opposed to inbound ports on both sides), no need for public DNS, L4 loadbalancers, and more.

[https://blog.openziti.io/extend-access-to-a-private-s3-bucket-using-python](https://blog.openziti.io/extend-access-to-a-private-s3-bucket-using-python)

Source code can be found here - [https://github.com/openziti/ziti-sdk-py/tree/main/sample/s3z#readme](https://github.com/openziti/ziti-sdk-py/tree/main/sample/s3z#readme)

/r/Python
https://redd.it/1eaz71k
Suggest me some paid django course

I want paid django course. I completed the basics of django and made some projects like blog, todo lists, portfolio, etc. I want to learn some advance cocepts too like middleware , rest api, signals...

Recently i learned js and postgresql too.
So suggest me some course please.

/r/django
https://redd.it/1eb4gd6
PuppySignal - An open source Pet's QR Tag

Hello everyone, this is a project I've been working on from a few years for my own-use with my pets, and this year I decided to share it with the community.

Project website: PuppySignal.com

What my project does

The functionality is pretty simple: when you log in, you create a profile for your pet, and a QR code will be generated and linked to its profile. When someone scans this code and decides to share its location, you will receive a notification on your phone with your pet's location, and the person who scanned it will see your contact information.

It consists of a few projects built with React (web and documentation), React Native (mobile), and Python for the backend (FastAPI and SQLAlchemy).

Target audience

Pet owners, but anyone could create codes and attach them to items, or whatever they want.

Comparison

Many QR pet tag alternatives already exist. The difference between them and PuppySignal is that you don't have to buy a QR tag and wait for it to be delivered. You can just clone it, self-host it, print the QR code, and attach it to your pet's collar.

Documentation: https://docs.puppysignal.com

Repository: https://github.com/FLiotta/PuppySignal

/r/Python
https://redd.it/1eb3lam
Searchable Input/Combobox For a Form

I'm trying to build a Django application using Django templates, HTMX, Tailwind and Alpine.js.

I've hit a bit of a roadblock trying to create a foreign key selection box that acts like an autocompleting text input/combobox. I want to use this method of input in many places throughout my app as I plan to use it for searching for products, for example, when creating an invoice.

I had a look at select2, and the related django autocomplete light, but struggled to get either to behave exactly in the way I was aiming for, ie as a text input box that shows the filtered options below, instead of as combobox that needs to be selected which then has a search box at the top,

I have modified an Alpine UI combobox component to pull the information from a json returning view which filters and displays the name of objects from one of my models, and then also stores the id in a hidden field on my form. I'm a worried that this method is not very robust and could be hard to test, potentially displaying one piece of data while storing the key of another.

Is there a best practice approach to creating something like

/r/django
https://redd.it/1ebfpr5
Django Docker tutorials for multiple services

I've been learning about Docker and how to deploy a Django app. I've done multiple tutorials on how to run Celery, Redis, Postgres, etc. However, none of them seem to show how to run all these services together.

Any suggestion for tutorials showing a full start to finish dockerized application and deployed with Celery, Redis and Postgres?

Thanks in advance.

/r/django
https://redd.it/1ebdvbr
Tracking user status in Flask

Hi everyone,

I am trying to implement user status(Online/Offline) tracking functionality in my Flask app. I have something, partially working, but is not polished and working as I need. In short, I want to be able to track the Online users, when user login his status updates to Online, respectively when the user logouts his status in the database changes to Offline and the last\_status\_update field(datetime) updates as well with the current timestamp. I have achieved that using SocketIO and it's working perfectly fine, but the user status updates to Offline only if he is using the Logout button which basically ends the session.

I would like to improve that functionality by updating his status if the user closes the tab or the browser, I guess that involves some kind of client-side script, but I can't make it work as i need. Any hints how I can implement the entire functionality? I know that the code is a bit messy, I accept critics and proposals how to modify the entire logic.

The config class and the sockets:

class Config:
SECRET_KEY = os.getenv('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI_DEV')


/r/flask
https://redd.it/1ebbu23
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1ebgo2f
A simple Python script that sorts your ~/Downloads folder by file extensions

Hey everyone!

So I’ve created a very simple Python script to de-clutter your Downloads folder.

demo

# What My Project Does

This Python script sorts the files into different folders such as Audio, Video, Documents etc. according to the file extension. For example, a .pdf file will be moved to Documents.

# Usage

1. Install it through Pip: pip install download-organizer

2. Run $ dlorg to run the script.

# Target Audience

Just a useful tool for most people.

# Comparison

Supports a wide range of extensions, easily accessible through a single command, colored logging.

# Links

Source Code (Github)

Python package: PyPi

/r/Python
https://redd.it/1ebq2b3
Introducing Lambda Forge: Simplify Your AWS Lambda Development

Hello Python and Open Source Enthusiasts!



I'm excited to introduce [Lambda Forge\](https://docs.lambda-forge.com/home/getting-started/), a Python framework designed to make AWS Lambda function creation and deployment effortless. Whether you're a seasoned developer or just starting with serverless architectures, Lambda Forge has something to offer.



---



### What My Project Does



Lambda Forge simplifies the process of creating, deploying, and managing AWS Lambda functions. It provides a robust CLI tool to generate Lambda function templates, authorizers, and service integrations with ease. The framework supports live development, allowing developers to test and debug Lambda functions locally while connected to real AWS resources. Additionally, Lambda Forge facilitates the creation and deployment of Lambda Layers, and it automatically generates documentation and architecture diagrams for your projects.



---



### Target Audience



Lambda Forge is designed for developers who are building serverless applications using AWS Lambda. Whether you're working on production-grade applications or experimenting with serverless technologies, Lambda Forge provides the tools and structure to streamline your development workflow. It's suitable for both experienced developers looking for efficiency and newcomers seeking an easy entry point into serverless development.



---



### Key Features:



**1. CLI Tool:**  

Lambda Forge includes a powerful CLI tool, `FORGE`, to help you create and manage serverless projects efficiently.



**2. Modular Functions:**  

Easily create Lambda functions

/r/Python
https://redd.it/1ebkzfd
pgmq-sqlalchemy - Postgres Message Queue Python client that using SQLAlchemy ORM

# [pgmq-sqlalchemy](https://github.com/jason810496/pgmq-sqlalchemy)

# What My Project Does

A more flexible [PGMQ Postgres extension](https://github.com/tembo-io/pgmq) Python client using **SQLAlchemy ORM**, supporting both **async** and **sync** `engines`, `sessionmakers`, or built from `dsn`.

# Comparison

* The [official PGMQ package](https://github.com/tembo-io/pgmq) only supports `psycopg3` DBAPIs.
* For most use cases, using `SQLAlchemy` ORM as the PGMQ client is more flexible, as most Python backend developers won't directly use Python Postgres DBAPIs.

# Features

* Supports **async** and **sync** `engines` and `sessionmakers`, or built from `dsn`.
* **Automatically** creates the `pgmq` (or `pg_partman`) extension on the database if it does not exist.
* Supports **all Postgres DBAPIs supported by SQLAlchemy**, e.g., `psycopg`, `psycopg2`, `asyncpg`.
* See [SQLAlchemy Postgresql Dialects](https://docs.sqlalchemy.org/en/20/dialects/postgresql.html) for all dialects.

# Target Audience

[pgmq-sqlalchemy](https://github.com/jason810496/pgmq-sqlalchemy) is a production package that can be used in scenarios that need a message queue for general fan-out systems or third-party dependencies retry mechanisms.

# Links

* [PyPI](https://pypi.org/project/pgmq-sqlalchemy/)
* [GitHub](https://github.com/jason810496/pgmq-sqlalchemy)
* [Documentation](https://pgmq-sqlalchemy.readthedocs.io/en/latest/)

/r/Python
https://redd.it/1ebvafo
WAT - Deep inspection of Python objects

https://github.com/igrek51/wat

# What My Project Does

This inspection tool is extremely useful for debugging in dynamically typed Python. It allows you to examine unknown objects at runtime. Specifically, you can investigate type, formatted value, variables, methods, parent types, signature, documentation, and even the source code.

Let me know what you think. I would really appreciate your feedback.

/r/Python
https://redd.it/1ebzeh2
Issue with python manage.py migrate Command Producing Red Lines

/r/djangolearning
https://redd.it/1ebke38
N OpenAI announces SearchGPT

https://openai.com/index/searchgpt-prototype/

> We’re testing SearchGPT, a temporary prototype of new AI search features that give you fast and timely answers with clear and relevant sources.

/r/MachineLearning
https://redd.it/1ec2gk2