pythondaily | Образование

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

Подписаться на канал

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

Annoying shade of tex field | tkinter

Here's a picture of it: https://i.imgur.com/9xSmZxn.png


I haven't seen anyone discuss this before so I am starting it.

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

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

Python Daily

Kanban-Tui, Moving Cards around in the Terminal

* **What My Project Does**

Kanban-Tui is a CLI application to manage tasks and (hopefully) makes you more productive.
It is quite customizable and my motivation was to have a better experience using the fantastic [textual](https://textual.textualize.io) package than with my
previous project [kanban-python](https://github.com/Zaloog/kanban-python) which just utilizes `rich`. It was also the first project, where I used `uv` and I wanted to get more comfortable with databases (sqlite).
With v0.2.0 I also included a `Demo Mode` to create a temporary database and config to play around and test things out.

You can find it on PyPi: [Link](https://pypi.org/project/kanban-tui/)

Source Code on github: [Link](https://github.com/Zaloog/kanban-tui)


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

For everyone who likes to work in the terminal and does not want to miss a more graphical Interface. It is ready to use, but I plan to add multiple boards feature after vacation. That might lead to a db schema change, so keep that in mind, when playing around.

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

Its similar to kanban-python, but has not yet all the features.
Also with the TUI I was able to utilize vim-like motions to move cards around, which comes closer to the feeling of actually moving

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

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

Python Daily

Pre-commit hooks that autogenerate iPython notebook diffs

What My Project Does

Nowadays, I use iPython notebooks a lot in my software development nowadays. It's a nice way to debug things without having to fire up pdb; I'll often use it when I'm trying to debug and explore a new API.

Unfortunately, notebooks are really hard to diff in Git. I use magit and git diffs pretty extensively when I change code, and I rely heavily them to make sure I haven't introduced typos or bugs. iPython notebooks are just JSON blobs, though, so git gives me a horrible, incoherent mess. I basically commit them blindly without checking the code at all nowadays, which isn't ideal.

So to resolve this I generate a readable version of the notebook, and check the diff for that. Specifically, I wrote a script that extracts only the Python code from the iPython notebook (which is essentially a JSON file). Then, whenever I commit a change to the iPython notebook, it:

1. Automatically generates the Python-only version alongside the original notebook.
2. Commits both files to the repository.

To make sure it runs when I need it, I created a git pre-commit hook. Git's default pre-commit hooks are a little difficult to use, so I built a hook for

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

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

Python Daily

Pyro5 and other similar packages

Does anyone use Pyro5 to work with Python objects over a network? What are the pros and cons of using the package? Are there other Python packages that offer this functionality?

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

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

Python Daily

Keep posting your wins

Hello guys keep telling us your wins. That keeps many of us motivated bigtime, and remember there is no small or big wins...a win is a win.

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

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

Python Daily

Python 3.12 vs Python 3.13 – performance testing

This article describes the performance testing results of Python 3.13 compared to Python 3.12. A total of 100 various benchmark tests were conducted on computers with the AMD Ryzen 7000 series and the 13th-generation of Intel Core processors for desktops, laptops or mini PCs.

https://en.lewoniewski.info/2024/python-3-12-vs-python-3-13-performance-testing/

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

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

Python Daily

Finally I make money from my django project

It was quite long journey.. it took about a year and a half to build and no sales for 4months.. I was quite depressed..

I figured out what to fix and my site started to make sales and now I make $100~$200 in revenue everyday. It is not that big amount but I can do this for living and I know how to scale up

I feel really thanks to django foundation..
If I chose nodejs or something else I wouldnt build a service for living in that short period of time..



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

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

Python Daily

Speeding up PyTest by removing big libraries

I've been working on a small project that uses "big" libraries, and it was extremely annoying to have `pytest` to take 15–20 seconds to run 6 test cases that were not even doing anything.

Armed with the excellent [PyInstrument](https://www.reddit.com/r/Python/comments/1g1az6i/pyinstrument_v50_flamegraphs_for_python/) I went ahead to search for what was the reason.

Turns out that biggish libraries are taking a lot of time to load, maybe because of the `importlib` method used by my `pytest`, or whatever.

But I don't really need these libraries in the tests … so how about I remove them?

# tests/conftest.py
import sys
from unittest.mock import MagicMock

def pytest_sessionstart():
sys.modules['networkx'] = MagicMock()
sys.modules['transformers'] = MagicMock()

And yes, this worked wonders! Reduced the tests run from 15 to much lower than 1 second from `pytest` start to results finish.

I would have loved to remove `sqlalchemy` as well, but unfortunately `sqlmodel` is coupled with it so much it is inseparable from the models based on `SQLModel`.

Would love to hear your reaction to this kind of heresy.

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

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

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

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

Python Daily

Tips for Command Line Project

Hello! I'm making a short project to have a little experience creating a command line tool, as well as getting a project onto PyPI. Mainly, I'm doing this because I think it's cool, and it would be awesome if a friend could pip3 install my project and just have a CLI tool off the install, similar to how the `qrcode` Python library comes with the `qr` CLI tool when installed. If you have any tips **AT ALL** for anything you see, like project organization, overall Python usage, or too many commits (is that possible), please tell me, I'm a sponge for info!

I'm still making the GUI portion, but the actual command line part should be done!

Off a google search, I understand there is already a PyPI project [Jonathan Löfgren\](https://github.com/jonathanlofgren/running/blob/master/.gitignore) made some time ago for converting paces into different distance paces. The purpose of my project here is to get a little experience creating a CLI tool I could use along with the overall process of getting something onto PyPI that works. If what I'm doing is majorly wrong, however, please tell me, I don't know!

PyPI Page: https://pypi.org/project/paces-calc/

GitHub Source Code link: https://github.com/Vladimir-Herdman/Pace-Calculator

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

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

Python Daily

D Self-Promotion Thread

Please post your personal projects, startups, product placements, collaboration needs, blogs etc.

Please mention the payment and pricing requirements for products and services.

Please do not post link shorteners, link aggregator websites , or auto-subscribe links.

--

Any abuse of trust will lead to bans.

Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

--

Meta: This is an experiment. If the community doesnt like this, we will cancel it. This is to encourage those in the community to promote their work by not spamming the main threads.

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

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

Python Daily

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

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

Python Daily

Requiring approval for certain actions

Hello,

I am trying to figure out if there is a way for me to implement some form of authorization for an action to occur for example if someone wants to do a task on the web app which would change a lot of data I want that action to have to be approved by someone else first, is there a known way in which this could be implemented in flask?

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

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

Python Daily

Hi! 😊 I'm a self-taught backend developer

I've learned Django, REST API, Docker just finished learning it today and it was easy and fun , and many other skills.
Here’s a list of what I've learned so far:
django
Django rest
Docker
javaScript
MySQL
Git/GitHub
Django channels
html and css
I've also completed several projects, including:
ecommerce website
Real-time chat app
To-do list app
CRUD application
Portfolio website

I’m not sure what to learn next to land a job i have nobdy to guide my what to do next im right know in a rabbit hole . Any advice would be awesome! 🙏


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

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

Python Daily

Qtcord - A lightweight, native Discord client for Windows and Linux

Ever noticed that the normal Discord client is bloated and takes too long to load for quick conversations? Well, here's the solution. Qtcord is a very lightweight Discord client written by the open source community and me.

Shoutout to randomusername-a for optimizing the backend and improving the UI of this project!

# How Qtcord works.

Qtcord uses Python Requests to send and retrieve data from the Discord API.

I reverse engineered some of the requests with the browser devtools network tab. The rest were implemented from documentation/tutorials that various people wrote online, including the actual Discord API docs!

For the GUI, I chose PySide6 because it is very easy to use, especially with Qt Designer. This saved me time hardcoding the UI.

# Target Audience

Qtcord is designed for people who don't need the extra features and ads from Discord.

# Why is Qtcord different?

Qtcord is different because it is native. For example, the normal Discord client takes around 500 MiB of RAM. Qtcord only takes 138 MiB of RAM.

# Downloads and Source

You can get builds of Qtcord here.

Please give my source code repository for Qtcord a star if it's interesting! 🌟

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

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

Python Daily

Having issues deploying my flask app on vercel. Please Help!!!

This is the error I'm getting on vercel

in my vercel.json I have

{
    "version": 2,
    "builds":
      {
        "src": "main.py",
        "use": "@vercel/python"
      }
    ,
    "routes":
      {
        "src": "/(.*)",
        "dest": "main.py"
      }
   
  }
 


This is my file structure



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

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

Python Daily

Full Stack Web Developer Hiring

Hi everyone, we have added a new job on our platform. If you are looking for a Full Stack Web Developer position please check the link below



Role - Full Stack Web Developer in Ashburn, Virginia, United States (Remote, Full-Time)



Job Link - devloprr.com/jobs#308

https://preview.redd.it/5cazdz94znud1.png?width=992&amp;format=png&amp;auto=webp&amp;s=73ddc2e4e30caedd6d4c71e8f3df88f8db808447



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

Читать полностью…
Подписаться на канал