pythondaily | Education

Telegram-канал pythondaily - Python Daily

1102

Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels

Subscribe to a channel

Python Daily

I built an open-source AI-driven Code Review app for GitHub repos

What My Project Does

Hi Everyone,

I recently built an open-source GitHub app in Django/python that can post a detailed line-by-line code review on any new PR. I'd love help in testing it as I seek feedback on it.

Here is the app: https://gitpack.co/

Here is the source-code: https://github.com/gitpack-ai/gitpack-ai and an example PR review: https://github.com/gitpack-ai/gitpack-ai/pull/9

It's free for open-source repos, but I can enable this for private repos for a month or so, if you DM me. Appreciate your feedback! I hope you all can find value in it.

Target Audience

Anyone who is actively developing on GitHub

/r/Python
https://redd.it/1g6m2mb

Читать полностью…

Python Daily

In-depth Django + Celery tutorial
https://www.youtube.com/watch?v=RY74ug36KUc

/r/djangolearning
https://redd.it/1g6eiwg

Читать полностью…

Python Daily

Chat System/Room

Trying to build a chat system where a user can build a chat room and invite some users to chat amongst them.

I have never built a chat system before.Also,this is a backend api project where I'm building api for the frontend.Where and how should I start.

I have built some api and common apps with django and django rest framework.I have the general idea.

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

Читать полностью…

Python Daily

Best way to upload file in Django

What's difference using Django UploadFileForm described at https://docs.djangoproject.com/en/5.1/topics/http/file-uploads/

from FileUploadView APIView?

Why should it be serialized? And how is the file is serialized?

Why doesn't it just dump the binary on disk?

It looks like they're making simple thing very hard.

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

Читать полностью…

Python Daily

I Built a Django Package for Google Analytics Integration!

Hey everyone!

I created a Django package that makes it super easy to integrate Google Analytics GA4 into your projects. Here are some features:

Supports Universal Analytics & GA4
IP anonymization and cookie settings
Server-side tracking via middleware
Debug mode for dev environments
Event tracking & custom dimensions
Excludes staff users from tracking

Check it out here: PyPI 👈 github

Contributions are welcome on GitHub! Let me know what you think! 😄

/r/djangolearning
https://redd.it/1g5nb0y

Читать полностью…

Python Daily

Friday Daily Thread: r/Python Meta and Free-Talk Fridays

# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

## How it Works:

1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

## Guidelines:

All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.

## Example Topics:

1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟

/r/Python
https://redd.it/1g654oy

Читать полностью…

Python Daily

I've recently applied to a mid-level position and would like to know if it is normal to ask for all of this as a technical task for a company

code### Technical Assessment: Full-Stack Application Development with Django, React, and AWS

As part of the interview process, candidates are required to complete a technical assessment. The task involves developing a secure full-stack application with a Django backend, React frontend, and a PostgreSQL serverless database hosted on AWS Aurora RDS. The application must adhere to HIPAA compliance and include audit logging for security and monitoring purposes. Candidates are expected to containerize the application using Docker and deploy it to AWS using their own AWS account. Below are the detailed requirements for the assessment.

# Key Requirements

# General Requirements:

Tech Stack:
Backend: Python, Django (Rest Framework)
Frontend: React (with functional components and hooks)
Database: PostgreSQL (AWS Aurora Serverless)
Containerization: Docker
Deployment: AWS (EC2 or ECS with Copilot, using RDS Aurora for the database)
Source Code Management:
The code should be hosted on a GitHub repository, with a link provided.
Use Git for version control, following best practices with regular, well-documented commits.
Deployment:
Candidates should provide a live link to the deployed app running on AWS. The application must be deployed using Docker and hosted on AWS using an Aurora Serverless PostgreSQL instance for the database.
The

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

Читать полностью…

Python Daily

Advanced python tips, libraries or best practices from experts?

I have been working as a software engineer for about 2 years and python was always my go to language while building various different application. I always tried to keep my code clean and implement best practices as much as possible.

I wonder if there are many more tips which could enhance the way I write python?

/r/Python
https://redd.it/1g5xswk

Читать полностью…

Python Daily

How to Create a Modern App with Django and Vue
https://www.thedevspace.io/community/django-vue

/r/djangolearning
https://redd.it/1g5ra7x

Читать полностью…

Python Daily

I made my computer go "Cha Ching!" every time my website makes money

**What My Project Does**

This is a really simple script, but I thought it was a pretty neat idea so I thought I'd show it off.

It alerts me of when my website makes money from affiliate links by playing a Cha Ching sound.

It searches for an open Firefox window with the title "eBay Partner Network" which is my daily report for my Ebay affiliate links, set to auto refresh, then loads the content of the page and checks to see if any of the fields with "£" in them have changed (I assume this would work for US users just by changing the £ to a $). If it's changed, it knows I've made some money, so it plays the Cha Ching sound.

**Target Audience**

This is mainly for myself, but the code is available for anyone who wants to use it.

**Comparison**

I don't know if there's anything out there that does the same thing. It was simple enough to write that I didn't need to find an existing project.

I'm hoping my computer will be making noise non stop with this script.

Github: https://www.github.com/sgriffin53/earnings_update

/r/Python
https://redd.it/1g5f73k

Читать полностью…

Python Daily

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/1g5dt6z

Читать полностью…

Python Daily

Geo Guesser Game & Dynamic Notes

https://i.redd.it/7qfezluflyud1.gif

This is a project I've been working on, its a geo guesser game and a rich note taking tool along with a place for me to demonstrate other packages and software I develop.

Everything was built in Plotly / Dash and is hosted with Flask. Thought this would be an interesting project to show and tell because of how dynamic i've built it out to be.

Still actively in development so I would be interested to see what feedback anyone has about the UI or functionality of the few pages I've created.

Try the drawing tool:
https://dash.geomapindex.com/freeform

Play the geo guesser:
https://dash.geomapindex.com/geo\_game\_select

Documentation on Some individual components I've released:
https://pip-install-python.com/

Follow me on Github if you wan't to see how my programming journey unfolds or stay up to date on new component releases:
https://github.com/pip-install-python

Cheers,
Pip

/r/flask
https://redd.it/1g4e6d4

Читать полностью…

Python Daily

I created a local directory site in Django

Still needs lots of improvement, but I created a local directory site for insect control companies.

https://insectcontrolcompanies.com

It’s designed to be reused to create other kinds of directories.

Hosted on Hetzner along with a few other projects on CapRover.

There are a few scheduled jobs, such as pulling in new company info, creating profile descriptions using GPT4, categorisation.

I started out using Celery for this but then realised it’s overkill, so now I just have a cron job on the base machine that runs a manage.py command inside the container. Works much better! And saves a lot of RAM (important when running multiple apps on €8 VM).

/r/djangolearning
https://redd.it/1g4vei9

Читать полностью…

Python Daily

How secure is Django?

I have several years of experience building stuff with Flask - stitching authentication, rate limiting and such stuff myself. I started using Django recently. Django seems to want to make me think it does everything for me, but I'm paranoid. Which security considerations are worth taking into account when using Django? Does it actually handle anything besides authentication and SQL injections?

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

Читать полностью…

Python Daily

Suggestions for cloud databases?

I am writing a program in Python that will need to be used by a small team of people in different locations. The program will need to access a SQL or SQLite database and so the database needs to be stored and accessed remotely.

Can I please have your suggestions for this? It only needs to be for light usage with a small team of about 5 people max and likely only 2 max accessing it at the same time. I would prefer something free or if costs are involved something with trivial costs.

Thanks in advance.

/r/Python
https://redd.it/1g4up88

Читать полностью…

Python Daily

PyTraceToIX - Debugging Jinja2 template, Flask web apps without breaking the design or code changes

Project on GitHub

## What My Project Does

PyTraceToIX is an expression tracer designed for debugging Jinja2 templates, Flask web apps, lambdas, list comprehensions, method chaining, and expressions in general.

Code editors often cannot set breakpoints within these kinds of expressions, which requires significant code modifications to debug effectively.
For Jinja2 templates, the debug extension can be used, but it typically dumps the entire context, making it difficult to isolate specific issues.

PyTraceToIX solves this by allowing developers to trace and write specific data directly to sys.stdout or a stream without altering the design or making any changes to the web application.

Additionally, PyTraceToIX can capture multiple inputs and their results, displaying them all in a single line, making it easier to view aggregated data and trace the flow of values.

PyTraceToIX offers a straightforward solution to these challenges, simplifying debugging while preserving the integrity of the original codebase.
It was designed to be simple, with easily identifiable functions that can be removed once the bug is found.

PyTraceToIX has 2 major functions:
- c capture the input of an expression input. ex: c(x)
- d display the result of an expression and all the captured inputs. ex: d(c(x) + c(y))

And 2 optional functions:
- init initializes display format, output stream and

/r/Python
https://redd.it/1g6fd28

Читать полностью…

Python Daily

Feature Friday: Model Choices!

Time for another Django Feature Friday! 🚀

Django 5.0 introduced more options for declaring field choices. Now you can use Mapping, a callable, and strings for single-character choices, in addition to the traditional tuples and enumeration.

Previously, Field choices were limited to list of 2-tuples, or an Enumeration types subclass. Now, you can use:

* Strings (for single-character choices) without .choices
* Mapping instead of list of 2-tuples (with hierarchies)
* A callable instead of iterable

Here's an example showcasing these new options:

from django.db import models

Medal = models.TextChoices("Medal", "GOLD SILVER BRONZE")

SPORT_CHOICES = { # Using a mapping instead of a list of 2-tuples.
"Martial Arts": {"judo": "Judo", "karate": "Karate"},
"Racket": {"badminton": "Badminton", "tennis": "Tennis"},
"unknown": "Unknown",
}


def get_scores():
return [(i, str(i)) for i in range(10)]


class Winner(models.Model):


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

Читать полностью…

Python Daily

Django + Celery Tutorial

Hey, all!

I've made a text + video version of Celery tutorial.

Video: https://www.youtube.com/watch?v=RY74ug36KUc

Text: https://appliku.com/celery

This tutorial aims at beginners who struggle with understand what Celery is and how to use it and never set it up before.

I tried to do my best explaining use the concept of it, use cases + step by step instructions on setting Celery app.

The last bit is a real world example of a generating reports using Celery tasks.

Let me know what you think and I hope it helps at least few people to start using this powerful library!

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

Читать полностью…

Python Daily

Should I extend Django's roles and permissions, or should I create my own roles and permissions layer?

Hello everybody, I want to develop a project management web app as a learning experience, and I have thought about the functionality of the roles and permissions for the users of the web app. Should I extend the Django system and not get too complicated, or should I keep the project roles separate? And about the users? I have also thought about adding specific things like: "You can mark a task as completed", "You can see all the team's tasks" etc. Thank you in advance for taking the time to read and leave your recommendations.

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

Читать полностью…

Python Daily

Meta Python 3.13 is not compatible with asyncpg (fastest async library to access PostgreSQL)

Just a heads up. I was going to upgrade my projects today, but asyncpg won't install. I tried both docker (all slims and general one) and local (mac, though) – no difference.


UPD:

This is a known issue by asyncpg developer. I hope they roll out an update soon.

/r/Python
https://redd.it/1g5qo5p

Читать полностью…

Python Daily

I created an app to animate stock performance

https://reddit.com/link/1g616sq/video/peq1orw0qdvd1/player

A few weeks ago, I saw a post that shows a screen recording of their Robinhood account. The pnl movement animation felt more engaging than a static chart, and it really stood out for me.

So I built a tool to animate stock performance chart: animatestock.com

This simple app basically animates data in a line chart. It also gives you flexibility in customizing the chart to your liking. You can also use it for things like net worth, savings, or even # of your social media followers, etc.

Let me know if you find it useful in anyway. Appreciate it!



/r/flask
https://redd.it/1g616sq

Читать полностью…

Python Daily

On a scale of 1 to 10, how would you recommed Django to a beginner?

As someone is trying to learn python for the first time, would you guys recommend to learn python and django for the first time or learn any other like javascript or nodeJs. So far I'm comfortable with the javascript basics but I'm trying to learn python and django. Any advice from the experienced developers here for a beginner is really helpful. And also what do you think about django for the upcoming years of development.

Is there any roadmap to get a proper knowledge so you don't miss the most important things to learn?

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

Читать полностью…

Python Daily

Project I was tired of reading through thousands of lines of documentation

Alongside Python, Im learning C. So as a way of testing how much I have learned, I decided to dabble in some socket programming in C. Found beej's guide, and got to work.

Problem? I hate reading too much educational stuff. I realized that after every 10 or so minutes I'd lose focus of what I was reading

Solution? Build a program into which I can stuff the ENTIRE documentation, then ask it questions, and it'll give me answers from the documentation I stuffed it with.

Behold, FTHEDOCS!

What my project does: It basically gives you a question-answer like interface to search the documentation, so you dont have to spend hours looking for those 2 lines.

Target audience: Anyone looking for a nicer way to read the docs. Or anyone who has a bunch of text and would like to search through it.

Comparisons: Not that I know of. Though I guess the Ctrl+F shortcut is kind of similiar

REPO: **https://github.com/muaaz-ur-habibi/fthedocs**


Do note: This was a fun project I built as a way to learn RAG, and to suite my specific needs. As a result, it might not be suited for you, though I tried my best to make it as customizable as possible.


Thanks

/r/Python
https://redd.it/1g5nyng

Читать полностью…

Python Daily

D What do you think will be the next big thing in the field? Is LLM hype going to fade?

I am happy with the success of LLMs, but I am not much of a NLP fan. What do you think will be the next big thing that will achieve commercial success or wide range of applicability (useful both in startups and large companies)?

E.g., are RL or GNNs going to start being used in practice more widely (I know GNNs are used in large companies, but still I am not aware that they are widely used)?

I consider computer vision a well established field considering practical applications, but is there maybe something new happening there?



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

Читать полностью…

Python Daily

Having a bit of an issue with Swagger UI using flasgger

Hi all. I am versed in flask but this is my first time trying to generate Swagger API docs.

The issue: Swagger (uiversion 2) is displaying mostly normally but when it comes to APIs that include a route parameter, I am not given any input field to enter a value for that parameter.

e.g.
`/api/user` will just return the hard-coded dictionary I feed the route function
`/api/user/{userid}` returns 200 but doesn't replace userid in the return statement of my route function.

In essence, where is my parameter field for replacing `{userid}` in my route with an actual value?

Note: I have tried uiversion 3 and those results are even worse

Edit: added a simplified yaml file; changed route param from int to string

https://preview.redd.it/v4cyse1wl8vd1.png?width=2140&format=png&auto=webp&s=efec0bf574c786287d46a62750e5d35b280bafed

project_root/config.py

#!/opt/homebrew/bin python3.12

import os

# api config base class
class ApiConfigBase():
SECRETKEY = os.environ.get('SECRETKEY')
FLASKRUNPORT = os.environ.get('FLASKRUNPORT')
FLASKENV = os.environ.get('FLASKENV')
FLASKDEBUG = os.environ.get('FLASKDEBUG')
SWAGGER

/r/flask
https://redd.it/1g5h2kt

Читать полностью…

Python Daily

Criticize my project

Hi, i'm new to both python and Django, i started making this simple weather app to learn the basics of the framework. Please point out ways to improve and criticize things that i've done or got wrong. My project



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

Читать полностью…

Python Daily

Announcing weekly DSF office hours
https://www.djangoproject.com/weblog/2024/oct/16/announcing-weekly-dsf-office-hours/

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

Читать полностью…

Python Daily

Losing context path on /login with Flask-OIDC

I am running my app inside a Docker container with gunicorn.

In production, I run behind NGINX with a context path set.

For example, locally I would hit:

http://localhost:8085/fetch/path/to/file.txt


In production i would use:
https://my.domain.com/someapp/fetch/path/to/file.txt

One of the methods in my app is decorated like so:

@app.route(f'/fetch/<path:filepath>', methods='GET')
@oidc.requirelogin
def fetch
file(filepath):
try:


When I try this in production, the user is redirected to https://my.domain.com/login, where it should be
https://my.domain.com/someapp/login

It looks as though the path is being lost?

Is there some way to specify the oauth login URL?


My Nginx config looks like this:

proxysetheader X-Forwarded-For $httpxforwardedfor;
proxy
setheader X-Forwarded-Proto $scheme;
proxy
ignoreclientabort on;
proxynocache 1;
proxycachebypass 1;

/r/flask
https://redd.it/1g4z9vw

Читать полностью…

Python Daily

Parsera - website data extraction with minimal code

Python library for scraping websites that I am building for the last few months. The idea is to make data extraction as simple as:

from parsera import Parsera
url = "https://news.ycombinator.com/"
elements = {
"Title": "News title",
"Points": "Number of points",
}
scraper = Parsera()
result = scraper.run(url=url, elements=elements)

Check it out on GitHub and share your feedback: https://github.com/raznem/parsera

What My Project Does

It extracts data from websites without dealing with DOM structure and writing web scrapers.

Target Audience

Developers who are dealing with web-scraping in their data pipeline.

Comparison

Compared alternatives it’s easier to use, uses less tokens and works faster.

/r/Python
https://redd.it/1g4ubg4

Читать полностью…

Python Daily

Censor words in audio using python

Hi! I'm 18 and recently started building Python projects to upgrade my portfolio. I have this little idea about censorship slurs (or any word) without editing the audio manually word by word. I'm really glad with the result, but I fell in love with the project so I will keep improving it.

# What My Project Does

Censorship-py is a Python library that allows you to censor specific words in an audio file based on a given list of words, replacing the given words with a Beep sound.

# Target Audience

Content creators, video editors, media

# Comparison

I didn't find many projects very similar to mine, but I leave this one here PyAudioCensor.

Let me know some ideas or what you think about my project!

/r/Python
https://redd.it/1g4ud6e

Читать полностью…
Subscribe to a channel