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

Sunday Daily Thread: What's everyone working on this week?

# Weekly Thread: What's Everyone Working On This Week? 🛠️

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

## How it Works:

1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.

## Guidelines:

Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

## Example Shares:

1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟

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

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

Python Daily

D Flagged a potential dual submission case to program chairs but they don't care.

Regarding https://www.reddit.com/r/MachineLearning/comments/1f7axjm/d\_potential\_dual\_submissions\_2\_similar\_iclr\_24/

A while ago I came across these two papers, and I noticed they are highly similar. I sent an email to ICLR 2024 program chairs asking them about this, including:

Katerina Fragkiadaki (CMU)

Mohammad Emtiyaz Khan (RIKEN AIP, Tokyo)

Swarat Chaudhuri (UT Austin)

Yizhou Sun (UCLA).

https://preview.redd.it/4ia3rvgr3mrd1.png?width=1390&format=png&auto=webp&s=a6697aa0b319f3b5b2821073dc6b2e48eea99357

But none of them replied at all. It's clear that they don't care anything about integrity and honesty. No respect for rules.

Science is just a game of money.

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

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

Python Daily

Learning a language other than Python?

I’ve been working mostly with Python for backend development (Django) for that past three years. I love Python and every now and then I learn something new about it that makes it even better to be working in Python. However, I get the feeling every now and then that because Python abstracts a lot of stuff, I might improve my overall understanding of computers and programming if I learn a language that would require dealing with more complex issues (garbage collection, static typing, etc)

Is that the case or am I just overthinking things?

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

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

Python Daily

Lightweight Celery alternative

I just want to give this package some recognition. I have started using it as a background worker and I love it.

It's maintained by the people at Dabapps and is well worth a look if you're looking to create asynchronous tasks in your Django app.


Check out django-db-queue

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

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

Python Daily

Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

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

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

Python Daily

D R What is the next frontier to AI?

I work as an undergraduate research assistant. I'm curious about what do you think is the new frontier for AI?

For example, we're full of LLM models, which are so good for language and vision tasks. But they are very poor when it comes to planning, control, real-world interaction, out-of-distribution thinking, etc.

What are those topics that remains at the shadow within research niches, but have the capacity to become the new cutting-edge paradigm? Biased opinions are very encourage.

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

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

Python Daily

How do I test this custom template tag I created for my project?

Here's a custom template tag I created for my project:

@register.simple_tag(takes_context=True)
def custom_csrf_token(context):
context_csrf_token = context.get("custom_csrf_token")
if context_csrf_token is not None:
csrf_token_input = mark_safe(f'<input type="hidden" name="csrfmiddlewaretoken" value="{context_csrf_token}">')
else:
request = context["request"]
csrf_token_input = mark_safe(f'<input type="hidden" name="csrfmiddlewaretoken" value="{get_token(request)}">')
return csrf_token_input

For it, I want to write two tests. One who triggers the `if` , the other who triggers the `else` I have troubles with the `else` one. In it, I need to render a fake template with my tag in it and pass a request in the context when I render it. Here's what it looks like for now:

class TestsCustomCsrfToken(SimpleTestCase):
def setUp(self):
self.factory = RequestFactory()



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

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

Python Daily

The Riccardo (Fourier) transform

Tonight I decided to have some fun my way after sleepless nights spent putting an app into production on time. And nothing, I'm so stunned that I don't even remember why a few hours ago I started trying to make my own Fourier transform without any in-depth mathematical knowledge on the matter, but since the result is apparently remarkable, at least with series of simple numbers, I share it.

In practice it works like this, in a way similar to the various FFTs: you take a frequency, you try various phases, you see which of these sinusoids if subtracted have the lowest peaks and then you do the same procedure with the amplitude. Subtract the obtained sinusoid from the given series of numbers and start again by doubling the frequency (if you set 2, as by default, to the doubling index). The characteristic is that you can start from the frequency you want and deepen the frequencies as many times as you want, regardless of the size of the given array. An obvious limitation is that the way the code is done (look at the find_best_amplitude function), right now, it doesn't work for frequencies that have an amplitude greater than 2.

I

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

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

Python Daily

pass statement?

i am new to python and i am still trying to wrap my head around the control statements esp the pass statement ? i asked chatgpt and google and they all say the pass statement act as placeholder and does nothing but when i run this code (the second one) it actually does something unlike the first one so whats wrong ? thannks in advance

https://preview.redd.it/ldjlp5zi0frd1.png?width=746&amp;format=png&amp;auto=webp&amp;s=7c1e2ba1b99a14b268206e0b3339dad2ae5198c6



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

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

Python Daily

huge brain rot

hey so Ive been fascinated with getting into coding. I personally know little to no code,

I can make a simple bot but thats about it. Is there any websites/ apps that I could use that are compatible with Mac systems

/r/pystats
https://redd.it/1fq87fo

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

Python Daily

R Llama-3.2-3B-Instruct-uncensored

This is an uncensored version of the original Llama-3.2-3B-Instruct, created using mlabonne's script, which builds on FailSpy's notebook and the original work from Andy Arditi et al.. The method is discussed in details in this blog and this paper.

You can found the uncensored model here and play with it at this 🤗 space.

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

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

Python Daily

Python in Excel, does it make sense to you?

The title of the post seems self-explanatory, but I struggle to see how the integration between Excel and Python is genuinely useful. Personally, I use either Excel or Python depending on the task. If it's about creating a table or performing simple checks on small datasets, I go with Excel. On the other hand, if I need to work with large datasets, create more complex automations, or require specific libraries, Python is a much better choice. In my view, each tool serves its own specific purpose.

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

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

Python Daily

Permissions in Django: must_check
https://kodare.net/2024/09/27/must_check.html

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

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

Python Daily

I created a free web app that turns your boring sentences into satirical masterpieces!

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

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

Python Daily

P How do I train a Speech To Text Model

Hello, I am wanting to train a text to speech model with around 5-6 minutes of voice, specifically these. I was going to use models such as https://github.com/jasonppy/VoiceCraft?tab=readme-ov-file or https://github.com/Camb-ai/MARS5-TTS?tab=readme-ov-file but it only takes 5 to 10 second samples. I don't know which model to start training from. Any pointers would be greatly appreciated. Thank you

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

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

Python Daily

First Work Project

I’m starting my first work project and settled on using Django.

I’ve done some front end projects before but nothing that went into production. Just some portfolio stuff with flask and JS.

I spend most of my days doing data engineering work or data science stuff. The organization is moving off of some old COBOL based stuff and into some staging databases, still on prem. Well, there’s a huge technical gap. The resident tech talent is mostly from 20 years ago and is focused solely on SQL and DOS like functionality. I’m the personality who’s trying to drive them to something more modern.

The enterprise that owns our org has power platform licenses but none of the cloud environments to back it which make them accessible or interoperable with Python. Yet, they’ve hired a few people who are mass producing power apps which I know will not be scalable or sustainable in the long run.

I’ve had our IT department start setting me up a proper dev environment using some containers which will be used to host the application.

The first proof of concept is going to be replicating a single user interface which simply allows them to update / insert a row to

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

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

Python Daily

How do I help the world using django?

So, I'm a 24M. I was introduced to django this year on May during my industrial attachment. My supervisor was very kind and helped me through any challenges I faced with django. As a result I learnt very quickly. Something also happened, the way this guy helped me sparked something in me. I feel like using my skills to help people. Problem is, i dont know how to do it. Are there platforms I can use my django skills to help people who are in need? Or is there any way i can just help people using this skill? Thanks.

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

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

Python Daily

Second Django app in project not working

I'm working on a Django project with two apps, and I'm running into issues with the second app, called Management. The first app, Base, works perfectly, but after setting up Management using the same steps, it’s not functioning as expected. I’m not sure what I might be missing.

Here’s what I’ve done:

Created Management using python manage.py startapp

Added Management to the INSTALLED_APPS in settings.py

Defined models, views, and URLs for Management

Applied migrations for Management (python manage.py makemigrations and python manage.py migrate)

Linked Management's URLs to the main urls.py using include()

Checked for typos and configuration issues
Despite following the same steps I used for the Base app, the Management app isn’t working. Am I overlooking something when setting up multiple apps in Django? Any help would be greatly appreciated!

This is the repo incase you want to take a look

https://github.com/kingmawuko/GigChain.git



EDIT:

The issue was resolved by placing the Base app's URL pattern at the bottom of the urlpatterns in the main urls.py. This ensured that more specific routes, such as for the Management app, were matched before the fallback routes in Base.





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

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

Python Daily

Help help

For the past years, I've been developing using react and nodejs. But now I've decided to learn django. So, for database, I'm looking for a free cloud database. Also, for node, we can save image in cloudinary and retrieve, similarly, what can be used in django? Or has anyone used cloudinary for django too? Any suggestion would be highly highly appreciated.

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

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

Python Daily

A simple example of a Dockerized Flask application using Ngrok to expose the local server to the internet, with a proxy integration to help mitigate potential Ngrok connection issues.
https://github.com/mdeacey/docker-flask-ngrok-proxy

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

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

Python Daily

Proper access control

Hello everyone! I'm making a management system for an online school and I need to do a rather convoluted authorization,

where I need to check the relationship between two users before giving access to a particular resource

I have written the rules as follows (CUD - Create, Update, Delete):

Student:

* Can view their own and their teacher's media
* Can only edit his/her profile
* Can view his/her profile and his/her teachers' profile
* Can only perform CUDs on their own media files.

Teacher:

* Can view his/her own media and media of attached students
* Can only edit his/her profile
* Can view his/her profile and the profile of attached students
* Can perform CUD with his/her own media and the media of attached students

Admin:

* Can attach students to teachers
* Can view all users' media
* Can edit the profile of all users
* Can view the profile of all users
* Can perform CUD with all users' media

I can't figure out how I can do it right without creating a huge amount of groups and permissions. Can you help me?

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

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

Python Daily

I have a complicated task that I need insight on

I'm creating a project, we'll call this project 'My Phone'. My Phone has many apps on it.

* Weather
* Notes
* Calculator

I want to be able to maintain **each app in it's own repository**, as opposed to putting them all in the 'My Phone' repository, but **I still want them to be linked**.

**FURTHERMORE,** I want to deploy each app individually.

For visualization purposes, I want to be able to go to:

>[weather.myphone.com](http://weather.myphone.com)

instead of

>[myphone.com/weather](http://myphone.com/weather)

I don't know if this makes sense or if it's even possible. please help

I've been led to understand this may be the worst idea in the history of programming SO ToT, please let me know what you think is a better idea?

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

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

Python Daily

First Python Project: Minecraft Cloud Synchronization

# Hi everyone!

I’m new to Python and development in general. My background is mainly in front-end technologies like JavaScript, React, and Node, and I've only recently started exploring backend development with tools like Firestore/Firebase. This project is a first step into Python for me, so I’d love to get feedback!

# What My Project Does

My friends and I recently got back into playing Minecraft, setting up a modded server for a fun experience. However, one of the challenges we faced was finding a way to host the server without dedicating one person's computer to it 24/7. We needed a way to make sure the server was always available for anyone to play, without waiting on one person to start it.

So, I built a cloud synchronization system for Minecraft servers. It syncs the server files to a cloud storage service using Python scripts, Google Cloud, and batch files. This way, any player can access and start the server on their own machine, making it much easier for everyone to play whenever they like.

# Target Audience

This project is geared towards:

Casual Minecraft players who want to host a modded server without paying for dedicated hosting services.
Tech-savvy gamers interested in a free and

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

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

Python Daily

LangDict : Build complex LLM Applications with Python Dictionary

I'm sharing a new LLM Application framework based on what I've learned from developing LLM Application over the past few months.

* When developing an LLM Application, the Prompt + LLM + Output parser of Langchain is sufficient for.
* Prompt is similar to a feature specification and has enough information about the module.
* Agent can be built by connecting multiple modules, and the PyTorch Module has already demonstrated its intuitive usage.

# What My Project Does

**LangDict** : Build complex LLM Applications with Python Dictionary

\*Repo : [https://github.com/langdict/langdict](https://github.com/langdict/langdict)

**Key Features**

* LLM Applicaiton framework for simple, intuitive, specification-based development
* Simple interface (Stream / Batch)
* Modularity: Extensibility, Modifiability, Reusability
* Easy to change trace options (Console, Langfuse)
* Easy to change hyper-paramters (Prompt, Paramter)

---

from typing import Any, Dict, List

from langdict import Module, LangDictModule


_query_rewrite_spec = {
"messages": [
("system", "You are a helpful AI bot.\nRewrite Human's question to search query.\n## Output Format: json, {{ \"query\": str}}"),
("placeholder", "{conversation}"),


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

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

Python Daily

Optimize your initial page loads by cleaning up unused css styles!

Hey Django Devs!

I’m excited to share a little project I’ve been working on called **Django CSS Downsizer**. It’s a Python script that helps optimize the load times of your Django projects by removing unused CSS styles. I originally built it to slim down the CSS files of my Bootstrap-based theme, and I was able to reduce my main CSS file from a hefty 350KB down to just 20KB!

The script works by using PurgeCSS to analyze your HTML files and remove any unnecessary styles, followed by compressing the result using GZIP for even faster load times. If you’re looking for a way to optimize your CSS and speed up your site, give it a try!

I’d love to hear any feedback or suggestions you have, and I’m always open to improvements. Feel free to check out the code and let me know what you think!

Thanks in advance for your thoughts and input. 😊

Project Name: Django CSS Downsizer
GitHub Link: https://github.com/DartLazer/djangocssoptimizer

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

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

Python Daily

What are some of Pydantic's most annoying aspects / limitations?

Hi all,

As per title, I'd be curious to hear what people's negative experiences with Pydantic are.

Personally, I have found debugging issues related to nested Pydantic models to be quite gnarly to grapple with. Especially true with the v1 -> v2 migration, although the migration guide has been really helpful in this.

Overall I find it an extremely useful library, both in my day job (we use it mostly to validate user requests to our REST API and to perform CRUD operations) and personal projects. Curious to hear your thoughts.

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

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

Python Daily

pyPIDTune: A Python PID Tuning Library with Logger, Simulator, and Process Emulator 🎉

pyPIDTune is an intuitive PID tuning suite with a graphical user interface (GUI) aimed at optimizing the PID tuning process.

# What The Project Does

pyPIDTune is a comprehensive toolset for PID control system tuning. It offers an intuitive, step-by-step framework to record, tune, simulate, and test PID controllers—all in one package. This makes it ideal for engineers who want an efficient and effective way to tune PID controllers while benefiting from integrated simulation tools.

pyPIDTune addresses common PID tuning challenges by providing a unified set of tools that allow you to:

Record a Process Reaction Curve (PRC) with the PID Logger.
Tune PID parameters based on the recorded data using the PID Tuner.
Simulate the response using the PID Simulator to verify performance before real-world implementation.
Test the tuning with a Process Emulator, simulating how the system would behave under real-world conditions.

# Comparison

|Feature|pyPIDTune|Manual Tuning|
|:-|:-|:-|
|Automatic PRC Logging|Yes ✅|No ❌|
|Step-by-Step Tuning|Yes ✅|No ❌|
|Built-in Simulation|Yes ✅|No ❌|
|Process Emulation|Yes ✅|No ❌|
|Time Efficient|Yes ✅|No ❌|

Manual tuning, while commonly used, lacks the systematic approach and real-time feedback that pyPIDTune provides. By automating the logging and tuning process, pyPIDTune ensures that you can quickly iterate on PID parameters, reducing trial and error.

# Target Audience

pyPIDTune is designed for anyone working

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

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

Python Daily

Mentioning databases that i have worked with django in my resume?

I have worked with SQL,MongoDB,My SQL,PostgreSQL

i am going to apply for back end dev position,should i mention these databases in my skill dection in my resume


As i heard they ask questions about every skill mentioned there,i have worked in them but obv i am not an expert as its my first jon

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

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

Python Daily

Django hosting

Hi all, I'd like to develop my personal portfolio website and blog with Django (DRF) and React. I'd like to host both the front and backend on the same server so I'm looking at utilising docker and k8s and serve the backend as a service which is consumed by the front-end. Is my only option a cloud based provider like AWS, Azure or GCP? Can I use docker and k8s on other hosting platforms? Which ones do you use, would you recommend them and if so why?

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

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

Python Daily

Different timezone in CI/CD tests

On my local tests I compare a date that I read from a json with the same date, defined with pandas.Timestamp. The problem is that my local tests works but the remote fails with a difference of 3h. I am sure it is has to do with the timezone, so I’d want to ask you what is the best practice or solution to this?

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

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