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
Thank you django for getting me through my school project

A little background, my teachers, after not teaching us any html or css or javascript or much of python or any web dev, decided that we should make a simple CRUD website as a projects. Our teacher recommended laravel, which just didn't work for my group. None of us knew php and laravel was so large it was hard to wrap our heads around it.

Eventually I fould django and flask. In the end, we decided to use django because it had enough "batteries-included" that basically everything we needed (logins, simple database, an admin
site) was already there.

And I'm so thankful that the Django docs and tutorials are amazing. I am in love with how django does it's docs. Primarily the tutorial tours most major parts of django, and the "using blank" style articles which gives super beginner friendly advice on how to use things like the user object.

The experience was so good that I actually want to do more web dev stuff after this. Though probably not as a career since I plan on being a teacher (primarily out of spite)

Also our project was ass, it looked like garbage, there was a 6 layer div nest somewhere in the html, the

/r/django
https://redd.it/18gfla3
Adding DRF to my project

I am currently using CRUD for my application using Django. I want to create an API, but unsure how to add it to my project (if that makes sense). Do I just follow the DRF documentation and add a new app to my existing project?

/r/djangolearning
https://redd.it/18gfxjs
Python 3D simulation library

Hi all,

Just wondering if there is any 3d physics simulation library that i can use, im planning to simulate the drainage plane of some structures using some particles, similar to a pool table with balls if the table was inclined in a particular direction.


I have seen pymunk but it looks like it doesnt work with 3d objects..

Thanks in advance
Alwx

/r/Python
https://redd.it/18gggvi
You watched me develop a full SaaS product as a community event. What's next?

Hey r/django,

about a month ago, I made this post. I asked whether you are interested in seeing me create a full SaaS product from idea to production deployment. You were interested! 500 of you joined the various channels.

I loved that response and delivered with a more than 6h long live stream (recording here: https://www.twitch.tv/videos/1973448363). The feedback was great, I didn't hear a single bad word.

But what now? The discord community is fairly active, posting and solving their problems. I love to see that, it's a small dream come true.

However, I want to do something like this again. A big project, maybe multiple streams long. I've also started telling a few business stories on request.

What is something you guys are curious about and would want to see?

/r/django
https://redd.it/18gm8fl
Build a Python music player using libVLC

I wrote a C program that dynamically loads the libvlc shared libraries, exposes some functions to create a player object, load music files, and control playback. I then wrote a Cython wrapper to the C library as a Python extension. Then a jupyter notebook to load and control playback music. The music file can come from local storage, any URL, or even a bytestream in memory that we construct. There isn't a source code posted yet as this is part of a bigger project. In this video I walkthrough the steps to implement a new feature into the player and you will understand how the layers interact.

### Why did I use dlopen and not link at compile time?

So that the module can be built and installed even if VLC is not installed. When it is, the library will use VLC. Also, we might choose to implement a different backend than VLC.

### Why did I not use python-vlc package to implement the application?

The VLC player can be built using the existing python-vlc package. I wanted to showcase the utility of using Cython to call into a C library. You can take this knowledge and apply it to any other C library,

/r/Python
https://redd.it/18gnnl8
Perform Proper Financial Analysis with Python through the Finance Toolkit

A little over 4 months ago I've shared a project that I've been working on for quite some time titled the **Finance Toolkit**. The purpose of this project was to write down as many formulas as used in Finance in the most transparent and simple way to prevent the thing I see so often, the same model, Excel spreadsheet or discussion being done again.

This has led to over 150+ different ratios, technical indicators, performance metrics, risk metrics, economic indicators and more written down in a very simplistic fashion (proof) while letting any kind of data be fed directly into the Toolkit through using the MVC architecture.

See what I mean in the GIF below that demonstrates some of the data that can be obtained. Take a look at the repository here: https://github.com/JerBouma/FinanceToolkit/

https://i.redd.it/w394wqszov5c1.gif

Since this GIF I've made a lot of new improvements which are both technical and finance orientated. First and foremost, I've had multiple requests to improve the speed of data collection. I've therefore experimented with threading to speed up the data collection which you can see gets you financial statements of 345 companies within 40 seconds (and any ratio collection is then done within a couple seconds).

https://preview.redd.it/6vimwe9epv5c1.png?width=2300&format=png&auto=webp&s=bb402b1f8dd07e89c6a1c7f4306118e3021ed220

I've also worked on

/r/Python
https://redd.it/18go3iw
FastStream adds support for Redis

FastStream is a free open-source framework for building asynchronous services interacting with event streams such as **Apache Kafka**, **RabbitMQ**, **NATS** and, since the latest 0.3 release, **Redis**. FastStream simplifies writing producers and consumers for message queues, automatically handling all the parsing, networking and documentation generation. It enables you to write your service once and run it on every streaming protocol with minimal change in setup code.

Please check it out and let us know how to improve it:

https://github.com/airtai/faststream

/r/Python
https://redd.it/18gtrv0
What stack for maintainable frontend rebuild?

Hi,

We built an app between 2018 and today using DRF, Celery (Redis), Postgres, Keycloak for the backend (with a full suite of unittests) and React, Redux, TypeScript for the frontend (with no tests). The React app is also wrapped with React Native to build a mobile app for Android / iOS.

The app is mainly for CRUD operations, the state is not of critical importance (it's not a visual editor or game etc), but we may want to do more with charting libraries in future.

We don't have a significant number of people using our mobile app, they mostly use the web interface.

We don't have a substantial budget.

We've reached a stage where we'd like to rebuild the frontend and want to achieve a few things:

1. Improve the usability and accessibility (to support WCAG 2.2 and possibly Progressive Enhancement (for folks who want to disable JavaScript) of the interface.
2. Build it quickly.
3. Maintain it more easily (ideally with full stack developers rather than deep frontend specialists - this has been a significant challenge: whilst we've had a few backend contributors we've had a great many frontend contributors which has resulted in a bit of a patchwork approach to coding and it is becoming

/r/django
https://redd.it/18gq0st
Getting UserWarning error on Windows Terminal

Has anyone encountered this error before?

c:\python39\lib\site-packages\IPython\core\`completerlib.py:120`: UserWarning: using rootmodules_cache requires you to install the. rootmodules_cache = ip.db.get('rootmodules_cache', {})

I'm on Windows Poweshell terminal and installed the ipython using chocolatey.

/r/IPython
https://redd.it/18gtvxv
Upcoming open community call

Hi r/JupyterNotebooks, u/ericsnekbytes here (from the JupyterLab and Jupyter Notebook councils)

We want to see all the cool things you're doing with Jupyter, so we're holding an open call with the community for people to chat, and share their creations and work. Think of it as a "virtual JupyterCon": It's a place to announce and share fun things happening in the Jupyter community.

**Event Details:**

December 13, 2023, at 9:00AM PST (your [timezone](https://arewemeetingyet.com/Los%20Angeles/2023-12-13/9:00/Jupyter%20Community%20Call))

* Agenda (add yourself) on [HackMD](https://hackmd.io/h_S-qpfsQgS_HFewzJvI5g)
* Meet on [Zoom](https://zoom.us/my/jovyan?pwd=c0JZTHlNdS9Sek9vdzR3aTJ4SzFTQT09)

We meet on Zoom (over video) and:

* Anyone can attend (for free!) ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿš’ ๐Ÿ‘จ๐Ÿผโ€๐Ÿณ ๐Ÿ‘จ๐Ÿฝโ€๐ŸŽค ๐Ÿ‘ฉ๐Ÿปโ€๐Ÿš€ ๐Ÿ‘ฎ๐Ÿปโ€โ™‚๏ธ ๐Ÿ•ต๐Ÿพโ€โ™€๏ธ ๐Ÿ‘จ๐Ÿฟโ€๐Ÿ’ป ๐Ÿ‘ฉ๐Ÿปโ€โš•๏ธ ๐Ÿ‘ฉ๐Ÿผโ€๐ŸŒพ ๐Ÿ‘จ๐Ÿปโ€โš–๏ธ ๐Ÿ‘ฉ๐Ÿฝโ€๐Ÿ”ฌ
* ๐Ÿ–ผ Anyone can present (add yourself the agenda above)
* ๐Ÿ‘€ Anyone can just sit in on the call.
* Presenters will lead a demo and spend a few minutes answering questions
* Topics will be targeted at a broad Jupyter audience (not overly technical)

Watch previous calls from this [YouTube Playlist](https://www.youtube.com/playlist?list=PLUrHeD2K9Cmkoamm4NjLmvXC4Y6E1o8SP).

/r/JupyterNotebooks
https://redd.it/18fwqgo
I made an AI programming assistant that visualizes your code

Here's a video demo!

And try it out here: https://useadrenaline.com/

You can ask general questions or upload a GitHub repository and visualize whatever parts of it you like. I made this since a lot of AI-powered programming assistants are good at answering questions, but not good at visually explaining concepts to you. In terms of how this works, the backend ML logic (finetuning & inference) is written almost entirely in Python.My thinking here is that text alone is not a sufficient interface for navigating large codebases. System diagrams, and visuals more broadly, communicate a lot more about how dependencies, data flow, etc. all work within a repository. And while there are static analysis techniques for visualizing your code, nothing exists right now that leverages LLMs to generate such graphs. The advantage of using language models is in their ability to tailor the complexity of the graph to suit the specific question asked, just like a coworker would do while illustrating a concept on a whiteboard.

Please let me know what y'all think!
And here's the repo on github: https://github.com/shobrook/adrenaline

/r/Python
https://redd.it/18gnamp
D What is the state of Neural ODEs?

Maybe some benchmarks on classification/regression popular tasks. Would be helpful if there is a paper that summarizes the state of neural odes.

I am wondering if i should pursue this field for my Phd. Seems like the field is still growing and there is a lot of research to be done, I am sold by the tagline of "continuous deep models" neural ODEs. But it seems the scale and accuracy of the models are still not great compared to traditional deep models.

I am also looking for a list of professor working in this area.

/r/MachineLearning
https://redd.it/18gv7v1
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions ๐Ÿ

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! ๐ŸŒŸ

/r/Python
https://redd.it/18h1nd0
Any reason not to start all new projects with ASGI/async? Which ASGI server do you use?

If I understand correctly, you can glean the performance benefits of async, and the parts of Django that aren't yet async safe just fall back to sync anyway. Any drawbacks I'm not thinking of?

And of the three ASGI servers mentioned in the docs (Daphne, Hypercorn, Uvicorn), which do you all use, and why?

For context, in case it matters, the plan is to use postgres and django ninja for an API that will be consumed by my react web app and react native mobile app. It'll be an internal app for a large company that manages inventory, estimates and work agreements, crew and truck scheduling and dispatch, and basic accounting with integrations with Quickbooks.

/r/django
https://redd.it/18gz7cq
One user session getting created for all the users

Hey!

I just created an ecommerce website using flask the issue I am facing is that only one single session is getting created for all the users in the application. Example: User A logs into the application, User B using a different device opens the website, User B is able to access the website as User A without authenticating. I am using Flask Login Manager and Sessions too but cannot understand why is it happening. Here is the code for initialising the web application:

from app import app, db, models, forms
from flask import (
Flask,
jsonify,
redirect,
render_template,
flash,
request,
url_for,
session,
)
from flask_login import (
login_user,
LoginManager,
login_required,


/r/flask
https://redd.it/18h6ncj
Can I use Django to manage the backend for my telegram app?

I'm writing a telegram app, and I'd like to use a database backend that I can view and manage via a django webapp. Is it possible for me to use the django ORM for DB calls from the telegram app, or should I use a different DB library?

/r/django
https://redd.it/18hd2wp
How to host a Flask application?

I would like to host my flask app website, but I can't find a place that is cheap, do you know or know of any place that is very cheap in terms of flask hosting and domain?

/r/flask
https://redd.it/18gkmxt
Django Bootstrap modal forms missing csrf token

I'm using django bootstrap modal forms for login and signup popups but they're missing csrf tokens, i get "CSRF token from POST incorrect." error when signing up or logging in.

I have {% csrf token %} in my html templates so that's not the problem. I've seen lots of answers to this problem with views reconfigurations (adding method decorators and form to render context) but since i'm using class-based view from bootstap modal forms documentation example I can't repeat such solutions. My views look like this:

class CustomLoginView(BSModalLoginView):
authenticationform = CustomAuthenticationForm
template
name = 'login.html'
successmessage = 'Success: You were successfully logged in.'
extra
context = dict(successurl=reverselazy('home'))

class SignUpView(BSModalCreateView):
formclass = CustomUserCreationForm
template
name = 'signup.html'
successmessage = 'Success: Sign up succeeded. You can now Log in.'
success
url = reverselazy('home')


I've tried rewriting them with methods like this:

class SignUpView(BSModalCreateView):

def signup
view(request):


/r/django
https://redd.it/18hg9vc
I made a Windows Notepad Alternative with PyQt6!

ZenNotes is a minimalistic Notepad app with a sleek design inspired by Fluent Design. It offers the familiar look of the Windows Notepad while having much more powerful features like Translation, TTS, etc.

GitHub: https://github.com/rohankishore/ZenNotes

Please star ๐ŸŒŸ the repo if you like my project. Also, visit Aura Text (https://github.com/rohankishore/Aura-Text), my IDE project

UI

/r/Python
https://redd.it/18hiyes