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
SQLAlchemy just the core - but improved - for no-ORM folks

Project: https://github.com/sayanarijit/sqla-fancy-core

What my project does:

There are plenty of ORMs to choose from in Python world, but not many sql query makers for folks who prefer to stay close to the original SQL syntax, without sacrificing security and code readability. The closest, most mature and most flexible query maker you can find is SQLAlchemy core.

But the syntax of defining tables and making queries has a lot of scope for improvement. For example, the table.c.column syntax is too dynamic, unreadable, and probably has performance impact too. It also doesn’t play along with static type checkers and linting tools.

So here I present one attempt at getting the best out of SQLAlchemy core by changing the way we define tables.

The table factory class it exposes, helps define tables in a way that eliminates the above drawbacks. Moreover, you can subclass it to add your preferred global defaults for columns (e.g. not null as default). Or specify custom column types with consistent naming (e.g. created_at).

Target audience:

Production. For folks who prefer query maker over ORM.

Comparison with other projects:

Piccolo: Tight integration with drivers. Very opinionated. Not as flexible or mature as sqlalchemy core.

Pypika: Doesn’t prevent sql injection by default. Hence can be considered insecure.

Raw queries as strings

/r/Python
https://redd.it/1la4yvk
Pypp: A Python to C++ transpiler WIP. Gauging interest and open to advice.

I am trying to gauge interest in this project, and I am also open to any advice people want to give. Here is the project github: https://github.com/curtispuetz/pypp

# Pypp (a Python to C++ transpiler)

This project is a work-in-progress. Below you will find sections: The goal, The idea (What My Project Does), How is this possible?, The inspiration (Target Audience), Why not cython, pypy, or Nuitka? (Comparison), and What works today?

## The goal

The primary goal of this project is to make the end-product of your Python projects execute faster.

## What My Project Does

The idea is to transpile your Python project into a C++ cmake project, which can be built and executed much faster, as C/C++ is the fastest high-level language of today.

You will be able to run your code either with the Python interpreter, or by transpiling it to C++ and then building it with cmake. The steps will be something like this:

1. install pypp

2. setup your project with cmd: `pypp init`

3. install any dependencies you want with cmd: `pypp install [name\]` (e.g. pypp install numpy)

4. run your code with the python interpreter with cmd: `python my_file.py`

5. transpile your code to C++ with cmd: `pypp transpile`

6. build the C++ code with

/r/Python
https://redd.it/1laf5ss
How do you guys secure your django websites?

recently i was working on a freelance project
i wrote a small function for deleting objects but each time i notice that there's something wrong and it was the lack if security and its driving me crazy that each time i have to implement a new security function


so my question is:

How do you guys implement the security features?

do you create all of the security features at once? or wait the production and user feedback?

https://preview.redd.it/lepcn95y5n6f1.png?width=1360&format=png&auto=webp&s=f59125378d9d256b372ad14c3a9c5dc04791b0de



/r/django
https://redd.it/1la9cc8
[Project] I built an open-source tool to turn handwriting into a font using PyTorch and OpenCV.

I'm excited to share HandFonted, a project I built that uses a Python-powered backend to convert a photo of handwriting into an installable .ttf font file.

**Live Demo:** [https://handfonted.xyz](https://www.google.com/url?sa=E&q=https%3A%2F%2Fhandfonted.xyz)
**GitHub Repo:** [https://github.com/reshamgaire/HandFonted](https://github.com/reshamgaire/HandFonted)

**What My Project Does**

HandFonted is a web application that allows a user to upload a single image of their handwritten alphabet. The backend processes this image, isolates each character, identifies it using a machine learning model, and then generates a fully functional font file (.ttf) that the user can download and install on their computer.

**Target Audience**

This is primarily a portfolio project to demonstrate a full-stack application combining computer vision, ML, and web development. It's meant for:

* **Developers and students** to explore how these different technologies can be integrated.
* **Hobbyists and creatives** who want a fun, free tool to create a personal font without the complexity of professional software.

**How it Differs from Alternatives**

While there are commercial services like Calligraphr, HandFonted differs in a few key ways:

* **No Template Required:** You can write on any plain piece of paper, whereas many alternatives require you to print and fill out a specific template.
* **Fully Free & Open-Source:** There are no premium features or sign-ups. The entire codebase is available on GitHub for anyone to inspect, use, or learn from.
* **AI-Powered Recognition:** It

/r/Python
https://redd.it/1laipn1
Django Channels

Hi so i need to implement notifications in my application and I have a few questions about Django channel layer(COuld really use some help here):



1. Does every consumer instance get its own channel layer name ? ( lets say i have 2 websocket URLs mapped to 2 consumers , and every client establishes a connection to both these consumers via the url router )



2. Is the channel layer name uniquely generated only for that specific connection ? and therefore might be different if the same consumer spins up another instance of itself for a connection ?



3. How do i store and access these channel layer names for each user when i need to add them to a group or something . Do i just store them in a database for the duration of the connection and get rid of them after ?

/r/django
https://redd.it/1lak6tk
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

/r/Python
https://redd.it/1lauzll
How do I implement rate limiting?

How do I implement rate limiting? Would I have to use redis?

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