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
slow backend

Hello folks,
I am a beginner programmer, I am trying to build a web application for my university project.
I have made a pipeline which is related to pharmacology studies.
I want to take user inputs from my website and use it in my pipeline to generate output.
To take user inputs i have made a form which takes in a list of diseases and a file and some other information.
My problem is that I am not able to use my pipeline code in flask app.
Actually my pipeline code takes few minutes of time to generate output which is saved in a file and will be given to user.
I have tried calling a function in flask app to integrate my pipeline code. But it is not working. The pipeline is generating output when used outside of the flask app but not when I integrate it in my app.
Any suggestions for this kind of problems?

Thankyou

/r/flask
https://redd.it/132ior4
Github CI/CD + Django

I want deploy my project, whenever there is pull request created for main branch. This should deploy my code to some subdomain. So that I can share with my team members. Onces complete testing and changes, upon successful merge of this PR in need to clear the setup code from my server except the environment. Looking for resources so that I can do so!
Note: I know Jenkins and other CI/CD tools still just looking for DIY type resources.

/r/django
https://redd.it/132lox8
P GPT + Machine Learning program, to generate product descriptions from photo - free to access

​

https://reddit.com/link/132nr0x/video/qrnfjhoyeswa1/player

Right now mainly focused on clothes, but other modules still works good.

Public tests if you are interested you can test it for free:

https://scribe.devopsbay.com

/r/MachineLearning
https://redd.it/132nr0x
Best way to send data to notebook from external program - socket?

Is it possible to send data to a Jupyter notebook from an external program and have it appear e.g. as variables accessible within the notebook that change live when the external program updates them?
At the moment I have to export data as a file and use code in the notebook to load it e.g. as CSV. The ideal would be if this can be done for both Python and Julia notebooks as I have some scripts with each language.

My idea is to perhaps open a socket within the notebook server that my external app can connect to, so I can send commands to update vars e.g. "x=1,2,3,... " , "y=3,6,8,4,...". I would like then variables x and y to automatically change in the notebook, and dependent calculations to be redone and plots automatically updated as a result.

/r/JupyterNotebooks
https://redd.it/132s7fz
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/132duia
I tried to make automated YouTube videos using python

Hi everyone, We at Codingbridge tried to use AI to deliver Tech News Everyday, Here is how we did it

1) Use python and selenium to scrape tech related news

2) Preprocess textual data and add additional script

3) Create your own avatar using DeepFake .

4) Use text to speech model to convert textual data to wav format

5) Use MoviePy to cut the video in parts

6) Use Transformer Model to lip sync Video and Audio

7) Use MoviePy to add transitions and merge them in a single video file

8) Use Text to Image for Thumbnail

Here is the result please give your feedback
https://youtu.be/-sxZ2am4nRY

/r/Python
https://redd.it/132ichv
Introducing surveydown - an open source, markdown-based survey framework (that doesn’t exist yet)

Hi folks, I am developing a markdown-based survey platform, and before I go further in the dev work I wanted to carefully think about frameworks and goals, so I laid out my thoughts of the goals and features for this package in this blog post:

https://www.jhelvy.com/posts/2023-04-06-markdown-surveys/

I have a working prototype using Shiny (I am more experienced in R than Python), and I've put it up here: https://github.com/jhelvy/surveydown

But the more I tinker, the more I'm starting to thing that Python may be the better language for this given the many well-developed Python web frameworks out there. Here are some important desired features:

1. Ability to run code: This is perhaps the most important feature. A critical reason I want to build this is so that a user could use code to define aspects of their survey, e.g. randomizing information shown in questions, etc. I haven't seen a survey framework that allows users to run code inside the survey.
2. Markdown-based user interface: A user should be able to quickly define their survey using mostly plain markdown. Then they should be able to run a single command to compile those files into a live web-based survey.
3. Built-in database: Once the survey is compiled, it should

/r/Python
https://redd.it/1332tsx
You can't use pip on Ubuntu 23.04 anymore

so long story short you won't be able to run pip install x anymore. The reason why the command doesn’t work in Ubuntu 23.04 is because of an intentional shift in policy to avoid conflicts between the Python package manager(pip) and Ubuntu’s underlying APT. You can now only use pip by creating a virtual environment with venv. My question is, is this a good thing or a bad thing? is it a good move from Ubuntu's team or not? being able to use pip only from a virtual environment. idk what do you guys think about the whole thing?

/r/Python
https://redd.it/1338oge
Case insensitive username with djangos built user creation?

I noticed when I create a dummy user with capitals and then I got to log in with all lower. it says user doesnt exist.

How can I default username to lower case? I am using Widget_Tweaks to style the form.

Here is my forms.py

from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms

class RegisterForm(UserCreationForm):
email = forms.EmailField(label='', widget=forms.TextInput(attrs={'class:':'form-control', 'placerholder':'Email Address'}))
firstname = forms.CharField(label='', widget=forms.TextInput(attrs={'class:':'form-control', 'placerholder':' First Name'}))
last
name = forms.CharField(label='', widget=forms.TextInput(attrs={'class:':'form-control', 'placerholder':'Last Name'}))

class Meta:
model = User
fields = ('username', 'firstname', 'lastname', 'email', 'password1', 'password2')

def init(self, args, kwargs):
super(RegisterForm, self).__init__(
args, kwargs)



/r/djangolearning
https://redd.it/1339yi2
Sunday Daily Thread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/133amkc
Use database or Pandas for a data that won't be manipulated

So I got some data which I need to fetch for operation in my Django process. It's currently stored in a Google sheet, and since there's multiple sheets Pandas can clean the data by passing the sheet link everytime it is asked for.

I can use a database, but would involve multiple steps to convert it into CSV and then download it and then import it to models

So which option is the more efficient way here?

/r/django
https://redd.it/133bmml
Trying to deploy Flask app to render.com

Hi there! Flask newbie here.

I am trying to deploy a simple Flask app (just a hello world route for now) to render.com. I know that I'll need PyAudio for this project. So I already included it in the dependencies. Now when I deploy to render.com I get the following error message:

src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory

If I understand it correctly portaudio is a C library that is needed by PyAudio. Which means I have to rely on portaudio being installed on the system I want to deploy to? Or alternatively use Docker (very limited knowledge)?

Any pointers into the right direction would be much appreciated!

EDIT:

Another thing that really confuses me is that, when I a generate a requirements.txt it adds Flask==2.3.1 as a dependency, which is current version. But the in the render.com logs I get

ERROR: Could not find a version that satisfies the requirement Flask==2.3.1 (from -r requirements.txt (line 9)) (from versions: 0.1, 0.2, 0.3, 0.3.1, 0.4, 0.5, 0.5.1, 0.5.2, 0.6, 0.6.1, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.9, 0.10, 0.10.1, 0.11, 0.11.1, 0.12, 0.12.1, 0.12.2, 0.12.3, 0.12.4, 0.12.5, 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1,

/r/flask
https://redd.it/132q7s1
Flask API - CSRF and JWT implementation with frontend

Hello,

I am creating an SPA using Flask for the API endpoints. I want to secure the app using CSRF tokens and JWT tokens to prevent all types of XSS and CSRF attacks.
The front end is Vue. I am using axios to perform the requests.
I am a bit lost on how to do this implementation. When should the CSRF token be sent and how will it be stored on the frontend? What about the JWT and how to implement it with the csrf ? Too many questions and I can't seem to find anything complete online.
Does anyone have any implementation examples or knows how to do it correctly? I would appreciate any help on this matter.

Thank you.

/r/flask
https://redd.it/131nljo
I have a username_or_email_form is there any way to query flask-sqlalchemy query for username or email at the same query?

I could query both separately but it would make my life easier if I could query 2 possible columns and return 1 query.

​

/r/flask
https://redd.it/1326agw
Media is too big
VIEW IN TELEGRAM
[R] Video of experiments from DeepMind's recent “Learning Agile Soccer Skills for a Bipedal Robot with Deep Reinforcement Learning” (OP3 Soccer) project

https://redd.it/132w40c
@pythondaily