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
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/1exb4w8
Axios give network error when I try to request to flask in reactnative

This is my app config in flask:

from flask import Flask
from flaskcors import CORS
from flask
sqlalchemy import SQLAlchemy
from dotenv import loaddotenv
from flask
session import Session
from flaskbcrypt import Bcrypt
import os
import redis

load
dotenv()

class ApplicationConfig():
SECRETKEY = os.environ["SECRETKEY"]

SQLALCHEMYDATABASEURI = "sqlite:///database.db"
SQLALCHEMYTRACKMODIFICATIONS = False
SQLALCHEMYECHO = True

SESSION
TYPE = "redis"
SESSIONPERMANENT = False
SESSION
USESIGNER = True
SESSION
REDIS = redis.fromurl("redis://127.0.0.1:6379")


app = Flask(name)
app.config.from
object(ApplicationConfig)
bcrypt = Bcrypt(app)


/r/flask
https://redd.it/1exh3pl
uv: Unified Python packaging

https://astral.sh/blog/uv-unified-python-packaging

This is a new release of uv that moves it beyond just a pip alternative. There's cross platform lock files, tool management, Python installation, script execution and more.

/r/Python
https://redd.it/1ex6n9k
[R] HiRED: Attention-Guided Token Dropping for Efficient Inference of High-Resolution Vision-Language Models in Resource-Constrained Environments
https://arxiv.org/pdf/2408.10945

/r/MachineLearning
https://redd.it/1exhg0f
Ugly CSV Generator: Stress-Test Your Data Pipelines with Real-World Ugliness! 🐍💣

Hello, r/Python! 👋

[Ugly CSV Generator](https://github.com/LucaCappelletti94/ugly_csv_generator) has a rather self-evident goal: to introduce some controlled chaos into your data pipelines for stress testing purposes.

I started this project as a simple set of scripts as, during my PhD, I had to deal often with documents that claimed to be CSVs from the most varied sources, and I needed to make sure my data pipelines were ready for (almost) anything. I have recently spent a bit of time making sure the package is up to par, and I believe it is now time to share it.

Alongside this uglifier, I have also created a prettifier that tries to automatically make up for this messiness - I need to finish polishing it and I will share it in a few weeks.

# What my project does

[Ugly CSV Generator](https://github.com/LucaCappelletti94/ugly_csv_generator) is a Python package that *intentionally* uglifies CSV files stopping short from mangling the actual data. It mimics real-world "oopsies" from poorly formatted files—things that are both common and unbelievable when humans are involved in manual data entry. This tool can introduce all kinds of structured chaos into your CSVs, including:

* 🧀 G**ruyère your CSV**: Simulate CSVs riddled with empty rows and columns - this can happen when

/r/Python
https://redd.it/1exkxm8
Flask vs Node.js vs Spring for backend of web scraping app?

Hello everyone

What would be the best framework for the backend of a web scraping app?

I’m leaning towards Flask because I’ve done some Instagram scraping with it in the past and kind of dislike Spring Boot.

Django seems too heavyweight for this purpose.

Or could Node.js be better/easier in some instances? Even though Python is the go-to for web scraping?

For frontend I’m thinking Vue.js.

Which one would you choose? Thank you!

/r/flask
https://redd.it/1exv6a4
Rye and uv: August is Harvest Season for Python Packaging

https://lucumr.pocoo.org/2024/8/21/harvest-season/

Author of Rye shares thoughts on latest uv release.

> If you are using Rye today, consider this blog post as a reminder that you should probably starting having a closer look at uv and give feedback to the Astral folks.

/r/Python
https://redd.it/1exnyiy
Just Submitted My First Shopify App Built with Django

https://preview.redd.it/if7wawmou2kd1.png?width=2880&format=png&auto=webp&s=3ddd2d2d3253d46ce8523da236673b4886826333

Hey everyone,

I’m really proud to share that I’ve just submitted my first Shopify app for review, and it’s all built with Django.

This project has been both challenging and rewarding. I started with limited knowledge about integrating Django with Shopify, but after diving deep into the Shopify API, I’ve learned a ton. One of the biggest hurdles was handling webhooks and ensuring everything worked smoothly across different Shopify stores. Debugging and testing were also challenging since Shopify’s environment can be tricky when you’re new to it.

Another challenge was making sure the app could handle real-world scenarios, like syncing large numbers of products efficiently and managing data across multiple stores. I had to think about performance, scalability, and also making the user experience as seamless as possible.

Through this experience, I’ve gained a lot of confidence in building web applications, especially in how to structure Django projects for SaaS platforms like Shopify. There were moments when things didn’t work as expected, but those turned into valuable learning opportunities.

Now that the app is submitted, I’m waiting for the review, hoping it gets approved soon. If anyone is looking to build a Shopify app or has questions about using Django with Shopify, I’m happy to

/r/django
https://redd.it/1ey062g
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/1ey52d1
Sharing my FREE Python for Data Science Course so that you can get started with Data Science

I recently ran a 1 month [Python for Data Science BootCamp](https://drive.google.com/drive/folders/1qCQxaeyt4ODAy4KXfRJ_nDestCpmPwFw?usp=drive_link) for people interested in starting a career in Data Science. It was tailored very specifically for Data Science, meaning, we covered topics like:

* Pandas Libraray
* Data Handling (CSV/Excel files)
* Exploring Datasets
* Data Cleaning and Preprocessing
* Data Manipulation

All while also learning the basics and fundamentals of Python.

Our BootCamp was designed to be easy to understand for even people with no background in coding.

We had over 200 signups and the BootCamp was well received.

Now I'm moving towards starting a Data Science Comprehensive BootCamp next month. However for all those who could not take part in the Python BootCamp, I wanted to give away access to free recordings from our BootCamp. No signups, no emails required, no nothing! All for free, so that you can get a taste of what its like to get started in Data Science.

You can get the access to the recordings [here](https://drive.google.com/drive/folders/1qCQxaeyt4ODAy4KXfRJ_nDestCpmPwFw?usp=drive_link).

Let me know if you have any questions regardings the BootCamps, or any career related questions etc.

We also gave out a free resource to those interested in Data Science before, so if you want that, just drop a comment below.

/r/Python
https://redd.it/1exwp9r
I wrote a python wrapper for SDL3.

**What My Project Does**

[PySDL3](https://github.com/Aermoss/PySDL3) allows developers to use [SDL3](https://github.com/libsdl-org/SDL) (which is a c++ library) in python.

**Target Audience**

[PySDL3](https://github.com/Aermoss/PySDL3) was developed to help developers who aim to develop games in python.

**Comparison**

[PySDL3](https://github.com/Aermoss/PySDL3) library is very similar to the PySDL2 library but it offers a modern SDL3 implementation instead.

**Example**
```python
import sdl3, ctypes, os, \
sys, colorsys, time

def main(argv):
print(f"loaded {sum(len(v) for k, v in sdl3.functions.items())} functions.")
result = sdl3.SDL_Init(sdl3.SDL_INIT_VIDEO | sdl3.SDL_INIT_EVENTS | sdl3.SDL_INIT_TIMER | sdl3.SDL_INIT_AUDIO)

if result:
print(f"failed to initialize library: {sdl3.SDL_GetError().decode().lower()}.")
return 1

window = sdl3.SDL_CreateWindow("Aermoss".encode(), 1200, 600, sdl3.SDL_WINDOW_RESIZABLE)

renderDrivers = [sdl3.SDL_GetRenderDriver(i).decode() for i in range(sdl3.SDL_GetNumRenderDrivers())]
print(f"available render drivers: {", ".join(renderDrivers)}")

renderer = sdl3.SDL_CreateRenderer(window, ("vulkan" if "vulkan" in renderDrivers else "software").encode())

if not renderer:
print(f"failed to create renderer: {sdl3.SDL_GetError().decode().lower()}.")
return 1

audioDrivers = [sdl3.SDL_GetAudioDriver(i).decode() for i in range(sdl3.SDL_GetNumAudioDrivers())]
print(f"available audio drivers: {", ".join(audioDrivers)}")


/r/Python
https://redd.it/1ey7fxk
How I hacked together GPT4 and government data

# What My Project Does?

I built an AI system that uses only official USA government sources with GPT4 to help us navigate the bureaucracy.

The result is pretty cool, you can play around at https://app.clerkly.co/ .

# Target Audience

The target audience is everyone who has problems with dealing with USA government bureaucracy.

# Comparison

Google: I use only official government sources for answering your queries
ChatGPT: I use a combination of agents and only government sources to provide answers with high-quality quotable sources .

# How Did I Achieve This?

1. Locating Data

First, it's important to gather all the essential government data you need. This can involve a lot of time browsing various federal and local government websites. Your goal is to find the domains that hold the relevant information. Be patient and thorough during this phase because the quality of your data depends on it.

2. Scraping Data

To collect data from these sites, I used Apify (https://apify.com/). This platform allows you to set up web crawlers which can automatically extract data from web pages. However, setting up these crawlers can be tricky:

You'll have to make sure to exclude irrelevant pages like random address books or archives.
No single format works for all websites, so you'll need

/r/Python
https://redd.it/1exp952
Flask Mongo CRUD Package

I created a Flask package that generates CRUD endpoints automatically from defined mongodb models. This approach was conceived to streamline the laborious and repetitive process of developing CRUD logic for every entity in the application. You can find the package here: flask-mongo-crud · PyPI

Your feedback and suggestions are welcome :)

/r/flask
https://redd.it/1ey1isa
Sauron Vision Project

* **What My Project Does**

Hi guys,

I was building a bot to play DayZ (it's not going well :\^)

So I thought I'd leave the first part of the code here. It's simple but efficient. My program takes a screenshot from a window name (Ex: Chrome.exe) gets the size of the window in real-time, saves the capture and uses CV2 to match to a templates' folder. Finally returns matches in a log and bounding boxes in the processed folder, obviously you could save that info however you want ;)

I've put two versions of the code, one in full for reading and the other with utils so you can extend. For example, before gray scaling, you could get exact colours at specific pixels for state representation. Or add contours processing, OCR, etc

[https://github.com/hadriloge/Sauron](https://github.com/hadriloge/Sauron)

* **Target Audience** (e.g., Is it meant for production, just a toy project, etc.

I guess people who like to automate things, probably looking at dynamic environments like games or video feeds, or just live usage.

* **Comparison** (A brief comparison explaining how it differs from existing alternatives.)

I know that Pyautogui has some features to automate directly based on images, but the idea here was to use PyWin32 and Psutil so that

/r/Python
https://redd.it/1eygt5i
Enhancing a CRM Project for Small Business Owners: Seeking Innovative Features and Ideas

I have an idea to build a Django-based CRM project for small business owners, where they can add clients and save their information. but this is simple thing, I'm looking for additional features and enhancements to make the project more robust and valuable. If you have any innovative ideas or suggestions, I’d love to hear them!

/r/django
https://redd.it/1eylla3
Need help with Import csv to database, Export to csv, and updating a table

I have a simply Flask app connected with postgres of a company data. I have everything linked and have search features as well as a couple table views. I want to add a section to import new csv into the database, export the database as a csv as well as a button to update a certain table (consists of inserts, select, truncate, and re insert). Would anyone be able to help me with this please.

/r/flask
https://redd.it/1eynpy2
D What industry has the worst data?

Curious to hear - what industry do you think has the worst quality data for ML, consistently?

I'm not talking individual jobs that have no realistic and foreseeable ML applications like carpentry. I'm talking your larger industries, banking, pharma, telcos, tech (maybe a bit broad), agriculture, mining, etc, etc.

Who's the deepest in the sh**ter?

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