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 filtering on relationship

Want to check if a value is present in a relationship using sqlalchemy. Have a customer table set up as --

class Customer(Base):
Approvers = relationship("AuthUser", secondary=links.LinkCustomerUser, cascade="all, delete")

so, a query as

session.query(Customer).filter(Customer.Uuid == <somevalue>).first()

would give me a list of approvers.

Is there a way, I can check if a value AuthUser.Id is present in the list of approvers in the query itself?

In short, I want to check if given **AuthUser.Id** is present in LinkCustomerUser or not.

/r/flask
https://redd.it/kw98rs
Python changed the way I think

I started to learn python during the beginning stages of pandemic. One thing i learned during the journey with python is that mistakes are part and parcel of learning. Do you agree with me that getting bugs while running a program teaches you a lot than a tutorial video? Someday while we debugging our code and spent whole day but still can't figure out the bug and next day within 15 minutes you figure out that you have forget to put collon :)

Don't give up! But Sometimes its ok to take rest when everything is going against you and comeback later.

So guys what is your life lesson which you have learned during the journey with python. I would love to hear that.

/r/Python
https://redd.it/kwalp2
I made a decentralised, secure and anonymous networking backend...

Holy shit this project took a while
This is my pride and joy
My way of paying back the community
A decentralised, secure and anonymous networking backend.
https://github.com/Footsiefat/Tiresias_Backend
Give the demo app linked in there a shot and give me some feedback please.

/r/Python
https://redd.it/kw7qr5
VSCode users: why do you prefer it over PyCharm?

Do you prefer VSCode over PyCharm? Why?

Is it the price? Or the versatility (handling more than just Python)? Or something else?

I can't live without my PyCharm (Pro), trying to understand how other devs manage without it. :D

/r/Python
https://redd.it/kwbck9
django question answer field match

I have a question answer quiz. I have 2 models **Question** and **Answer**. I want to have 2 pages. On the first page there will be a **Question** model where the user will write the question and the answer to that question. On the second page I will display these questions and accordingly the **Answer** model where the customer enters the answer and then check if it is equal to the \*\* answer\_question \*\* of the Question. But I could not do that so call each question **Answer** and show it in html.

&#x200B;

**models.py** \-->

&#x200B;

from django.db import models

# Create your models here.
class Question(models.Model):
question=models.CharField(max_length=100)
answer_question=models.CharField(max_length=100, default=None)

def __str__(self):
return self.question


class Answer(models.Model):
questin=models.ForeignKey(Question, on_delete=models.CASCADE)
answer=models.CharField(max_length=100,blank=True)


/r/djangolearning
https://redd.it/kwfei9
Mozart: An optical music recognition system. Converts sheet music to a machine-readable version.

The aim of this project is to develop a sheet music reader. This is called Optical Music Recognition (OMR). Its objective is to convert sheet music to a machine-readable version. We take a simplified version where we convert an image of sheet music to a textual representation that can be further processed to produce midi files or audio files like wav or mp3.

GitHub: https://github.com/aashrafh/Mozart

/r/Python
https://redd.it/kwhsaa
I submitted my first bug report and it was fixed within days

I am learning to use python and pygame to mess around with fluid simulations, and came across a strange bug. Stack overflow said it was a problem with python, the python bug tracker said it was a probably pygame, and the pygame contributors identified and fixed the problem within a day.

I think it is amazing how quick this community is to fix bugs and just wanted thank everyone who makes using python so easy and fun to learn.

: I know maybe not the best language for performance, but I was just looking for a fun project

/r/Python
https://redd.it/kwgv0x
Free Getting Started With Django Course

Hey everyone.

I've just posted a 9-hour long course on getting started with Django. It's specifically for beginners. In the course, you build a basic CRM application while learning all the fundamentals of Django. You also deploy the project using the Digital Ocean App Platform.

I'd love for you to check it out and let me know what your thoughts are!

Here is a link to the course: https://youtu.be/fOukA4Qh9QA

/r/django
https://redd.it/kwjq3l
Thursday Daily Thread: Python careers!

Discussion of using Python in a professional environment, getting jobs in Python and more!

This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.

/r/Python
https://redd.it/kwtjgw
An idle race game with pygame

Here is a youtube video(could be loud) and source code.

My first game and also it was my python learning project. I learned a lot of things how should/should not to do but at the end of this, there is unlimited improvements and at some point so I must go for another projects with good management and plans. There are shortcomings in the project and I had things in mind that wanted to add, but I didn't want to spend more time only one beginner project.

Anyway, thanks for your time. Stay safe.

/r/Python
https://redd.it/kws3xs
What if?

What if 100,000 users should send a request to my flask app simultaneously? How will the app behave in such conditions? What if my sqlalchemy db table was filled with 100,000 rows, how long would db queries take?

I am new to flask (2 months), built 2 projects but have never had so many persons visit my web apps. Anyone with these experience should please share

/r/flask
https://redd.it/kwkez1
Multi-vendor Ecommerce Website Using Django | Pre-Release

In this video I'll tell you a little bit about my free upcoming Django course. The project we're going to build in this video series will be called Interiorshop. This is a multi-vendor ecommerce website where people can sign up and sell products on your webshop.

The website will be built using these technologies:
\-Django
\-Bulma CSS
\-Stripe (Payment gateway)
\-Sendgrid (for sending e-mails)

Here is a 4 min introduction to the course if you want to see a little demo:
https://www.youtube.com/watch?v=jmc0gV6\_NE0

The course will be split into three parts and I will try to publish them as soon as possible. If you want notification when I publish the parts, you need to subscribe and click the bell to get e-mail notifications :-)

/r/djangolearning
https://redd.it/kx224b
One-to-many relationship in Todo App

Hi, this is my first flask project. In my todo program, I'm trying to create a one-to-many relationship, such that, each user has many tasks. The issue I am facing is that every user is accessing every task in the table and I'm not sure how to fix that.

**The tables:**

class Users(db.Model):
id = db.Column(db.Integer, primary_key=True, nullable=False)
username = db.Column(db.String(20), unique=True, nullable=False)
password = db.Column(db.String(50), nullable=False)
tasks = db.relationship('Todo', backref='owner')

class Todo(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100), nullable=False)
owner_id = db.Column(db.Integer, db.ForeignKey('users.id'))

**Todo routes:**

@app.route("/tasks", methods=["GET"])
@login_required
def tasks():
"""User tasks"""
# show all todos
todo_list = Todo.query.all()


/r/flask
https://redd.it/kx2kpb
best-of-web-python: A ranked list of awesome Python libraries for web development

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

We've curated a list of the best Python libraries for web development with lots of awesome projects related to Flask!

The list is fully automated via GitHub Actions, so it will never get outdated. Every week it collects metadata from GitHub and package managers, calculates quality scores to rank projects inside categories, and identifies trending projects.

🔗 GitHub: https://github.com/ml-tooling/best-of-web-python

🎉 We also released a few other best-of lists on Reddit today:

[best-of-ml-python](https://www.reddit.com/r/MachineLearning/comments/kx8e13/p_bestofmlpython_a_ranked_list_of_awesome_machine/): Python libraries for machine learning.
best-of-python-dev: Python developer tools and libraries.
[best-of-python](https://github.com/ml-tooling/best-of-python): General overview of Python libraries & tools.
best-of-jupyter: Jupyter Notebook, Hub, and Lab projects.

📫 For updates on trending projects, new additions and detailed comparisons, follow us on Twitter or subscribe to our weekly newsletter.

/r/flask
https://redd.it/kx8mlu
P best-of-ml-python: A ranked list of awesome machine learning Python libraries

https://i.redd.it/6v5vvl7psbb61.gif

We've curated a list of the best machine learning Python libraries!

The list is fully automated via GitHub Actions, so it will never get outdated. Every week it collects metadata from GitHub and package managers, calculates quality scores to rank projects inside categories, and identifies trending projects.

🔗 GitHub: https://github.com/ml-tooling/best-of-ml-python

🎉 We also released a few other best-of lists on Reddit today:

[best-of-web-python](https://www.reddit.com/r/flask/comments/kx8mlu/bestofwebpython_a_ranked_list_of_awesome_python/): Python libraries for web development.
best-of-python-dev: Python developer tools and libraries.
[best-of-python](https://www.reddit.com/r/Python/comments/kx94kc/bestofpython_a_ranked_list_of_awesome_python/): General overview of Python libraries & tools.
best-of-jupyter: Jupyter Notebook, Hub, and Lab projects.

📫 For updates on trending projects, new additions and detailed comparisons, follow us on Twitter or subscribe to our newsletter.

/r/MachineLearning
https://redd.it/kx8e13
best-of-python: A ranked list of awesome Python libraries and tools

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

We've curated a list of the best Python libraries and tools!

The list is fully automated via GitHub Actions, so it will never get outdated. Every week it collects metadata from GitHub and package managers, calculates quality scores to rank projects inside categories, and identifies trending projects.

🔗 GitHub: https://github.com/ml-tooling/best-of-python

🎉 We also released a few other best-of lists on Reddit today:

[best-of-python-dev](https://github.com/ml-tooling/best-of-python-dev): Python developer tools and libraries.
best-of-ml-python: Python libraries for machine learning.
[best-of-web-python](https://www.reddit.com/r/flask/comments/kx8mlu/bestofwebpython_a_ranked_list_of_awesome_python/): Python libraries for web development.
best-of-jupyter: Jupyter Notebook, Hub, and Lab projects.

📫 For updates on trending projects, new additions and detailed comparisons, follow us on Twitter or subscribe to our weekly newsletter.

/r/Python
https://redd.it/kx94kc
[N] The White House Launches the National Artificial Intelligence Initiative Office

*What do you think of the logo?*

*From the [press release](https://www.whitehouse.gov/briefings-statements/white-house-launches-national-artificial-intelligence-initiative-office/):*

https://www.whitehouse.gov/briefings-statements/white-house-launches-national-artificial-intelligence-initiative-office/

&#x200B;

The National AI Initiative Office is established in accordance with the recently passed National Artificial Intelligence Initiative Act of 2020. Demonstrating strong bipartisan support for the Administration’s longstanding effort, the Act also codified into law and expanded many existing AI policies and initiatives at the White House and throughout the Federal Government:

* The [American AI Initiative](https://www.whitehouse.gov/wp-content/uploads/2020/02/American-AI-Initiative-One-Year-Annual-Report.pdf), which was established via [Executive Order 13859](https://www.whitehouse.gov/presidential-actions/executive-order-maintaining-american-leadership-artificial-intelligence/), identified five key lines of effort that are now codified into law. These efforts include increasing AI research investment, unleashing Federal AI computing and data resources, setting AI technical standards, building America’s AI workforce, and engaging with our international allies.
* The [Select Committee on Artificial Intelligence](https://www.whitehouse.gov/wp-content/uploads/2021/01/Charter-Select-Committee-on-AI-Jan-2021-posted.pdf), launched by the White House in 2018 to coordinate Federal AI efforts, is being expanded and made permanent, and will serve as the senior interagency body referenced in the Act that is responsible for overseeing the National AI Initiative.
* The [National AI Research Institutes](https://www.whitehouse.gov/articles/trump-administration-investing-1-billion-research-institutes-advance-industries-future/) announced by the White House and the National Science Foundation in 2020 were codified into law. These collaborative research and education

/r/MachineLearning
https://redd.it/kww5nf