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
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&format=png&auto=webp&s=7c1e2ba1b99a14b268206e0b3339dad2ae5198c6
/r/Python
https://redd.it/1fqxwx6
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
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 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
Permissions in Django: must_check
https://kodare.net/2024/09/27/must_check.html
/r/django
https://redd.it/1fqkzaf
I created a free web app that turns your boring sentences into satirical masterpieces!
/r/flask
https://redd.it/1fqdajk
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
What's the best approach to an ecosystem of multiple projects with same user table?
Hello guys, I would really appreciate if you help me with this.
I currently have a project that uses it's own database and models. Thing is, company wants a full ecosystem of projects sharing users between them and I want to know the best approach to this scenario as is the first time I'm doing something like this.
I've already tried 2 things:
1. Adding another database to DATABASES on my project's settings
When I tried this, I found a known problem with referential integrity, as the users on both system would be doing operations on their correspondent project database.
2. Replication
I tried directly thinkering on the database and I almost got it working but I think I was overcomplating myself a bit too much. What I did was a 2-way publication and subscription on PostgreSQL. The problem was that the users weren't the only data that I had to share between projects: groups and permissions (as well as the intermediate tables) were also needed to be shared and right here was when I gave up.
The reason I thought this was way too complicated is that we use PostgreSQL on a Docker container and since I was configuring this directly on the
/r/django
https://redd.it/1fqf1sj
"Can I Get a Verified Certificate After Completing the CS50 Python Course, or Do I Need to Start Over?"
/r/IPython
https://redd.it/1fqbu0y
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/1fqar0b
D What Neural Network Architecture is best for Time Series Analysis with a few thousand data points?
I know what you're thinking, use classical methods like ARIMA. Yes you are correct, but I have already done that for my company. I am currently a co-op and I got a full time offer. During this transition to it, I don't have much to do for two weeks. I have access to PySpark and Databricks which I won't in the new position so I wanna take this time as a learning experience and it'll help my resume in the end. I am not expecting the performance to be better than my ARIMA models
The data has daily granularity from 2021. I have features but not a ton of features. There are three architectures which I've been considering. I know about RNN's, LSTMs and Temporal CNN's. In terms (mostly) learning combined with performance, which of these do you think are most suited for my task? In general for rich data, what architecture do you see usually performing the best?
/r/MachineLearning
https://redd.it/1fpxja7
Opik: Open source LLM evaluation framework
Repo Link: https://github.com/comet-ml/opik
What My Project Does
Opik is an open source LLM eval framework. With this first release, we've focused on a few key features:
Out-of-the-box implementations of LLM-based metrics, like Hallucination and Moderation.
Step-by-step tracking, such that you can test and debug individual components, even for multi-agent architectures.
Exposing an API for "model unit tests" (built on Pytest), to allow you to run evals as part of your CI/CD pipelines
Providing an easy UI for scoring, annotating, and versioning your logged LLM data, for further evaluation or training.
Target Audience
Opik is for anyone building LLM applications. It is production-ready.
Comparison
Opik provides a similar API to tools like DeepEval. Unlike DeepEval, however, Opik is 100% open source—meaning that the Opik backend and UI are included in the source code, and can be run locally on your own machine.
/r/Python
https://redd.it/1fq33rw
Script to download just the audio from Reddit Videos
I am trying to write a script to download just the Audios from Reddit videos whereas I am not able to find the Fallback URL for that.
I am able to download the videos though and couldn't figure out the Audio URL.
Example of video: https://v.redd.it/kgwd3pqtfzqd1/DASH\_720.mp4?source=fallback
How to get the linked audio URL
/r/Python
https://redd.it/1fppcu4
Non-drifting Scheduler
I've been working on this little snippet and I just wanted to share it. Its a scheduler for running a function at a fixed interval, and it uses an integral-controller to correct drift.
Here is a naive approach:
import time
def run(thing, interval):
while True:
t1 = time.time()
thing()
elapsed = time.time() - t1
time.sleep(interval - elapsed)
This works well enough, but if you are running something at a fast interval, you will notice that it runs *very slightly* less often than it should.
Here is the integral-controller version:
import time
class NoDriftLoop:
def __init__(self, process, process_args, target_interval):
self.process = process
self.process_args = process_args
self.target_interval = target_interval
self.error_integral = 0
/r/Python
https://redd.it/1fplo2y
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
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
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
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
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
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
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
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
Looking for Feedback to Level Up My Project (Django and Next.js)
Hey everyone.
I’m excited to share a responsive web app I’ve been working on, built with Django on the backend and Next.js on the frontend! As a self-taught developer, I’ve learned a lot through tutorials and resources. The task managment app helps users manage projects and tasks, letting them create, assign, and track tasks in one place.
It’s in the early stages, but I’m planning to add more features and deploy it to the cloud. I’d love your feedback or any support as I aim to improve and follow best practices.
If you have a moment, I’d appreciate your thoughts on:
* Key features or improvements for the next stage
* Suggestions to enhance the user experience
* Best practices for deployment and production
I’m also open to any other suggestions or feedback you think could help!
Thanks a ton for taking the time to check this out! Your feedback would mean the world to me. 🙏💡
My Task Management App
https://github.com/mimi030/task_management_system_django_next_v1.git
/r/django
https://redd.it/1fqbgal
D Fellow ML Practitioners, who do you go to when you are stuck on an ML problem?
Btw, not posting in the "Simple Questions Thread" because I believe even someone with formal ML knowledge may benefit from this.
I'm curious to know how you get new ideas and validate them if you are stuck on something you haven't worked on before. I'm in a similar boat, and while my team at work has experts in other fields, there's no senior MLE as such.
It doesn't have to be a person, I'm keen to know any sources you refer to as well.
/r/MachineLearning
https://redd.it/1fqb1t1
Not sure whether or not I need to take action on "WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead."
I've been getting that with an app I have running on Google App Engine on an hourly cron job. Looked into it online and found conflicting information. Do I need to change anything, or is this just a boilerplate warning I can ignore?
(In case it makes a difference: it's an app that interacts with the Google Sheets API and Gmail API to modify spreadsheets and send emails based on the spreadsheets. Runs hourly, probably sends from 0 to 3 emails each time.)
/r/flask
https://redd.it/1fpgxo3
Need help to generate a pdf from a webpage
Hello everyone,
I need some help generating a pdf from a template.
Initially I tried using weasyprint but couldn't make it work. I finally manage to generate and download a pdf using pdfkit after hours of trying to install it.
Couple of additional details, I am using a Flask App hosted in Heroku, I'm not a professional developer so mainly looking for recommendations and found that this was the easier combo to get started.
I am using tailwind css for all my html file, including the template, and this is where the issues begin. Initially tried the pdfkit's from_template function (I think that's the name of it), but found out that this ignore tailwind and I should revert to regular css styling. I tried that, but I cannot make the page look the same.
One recommendation I've had was to instead open a tab to my template, and make it print the page directly, making the browser implement the tailwind beforehand, sound good right? Well no, i've tried doing that with pdfkit.from_url, but it's still ignoring the tailwind css. Note that when I access the regular template manually from the route, it's rendering fine, but when pass the route URL to the pdfkit
/r/flask
https://redd.it/1fpw297
I realized I didn't know how a web framework worked, so I wrote one! Spiderweb 1.2.1 now live!
I've been writing Django and Flask websites for the better part of a decade, but I realized recently that I don't actually know how this stuff _works_. So rather than crack open a package I was already familiar with, I jumped in with both feet and wrote my own!
[PyPI: Spiderweb 1.2.1](https://pypi.org/project/spiderweb-framework/)
[Documentation!](https://itsthejoker.github.io/spiderweb/#/)
# What My Project Does
**Spiderweb** is a web framework just large enough to hold a spider. It's an special blend of concepts that I like from Flask, FastAPI, and Django, and is available for use now!
Here's a non-exhaustive lists of things Spiderweb can do:
- Function-based views
- Optional Flask-style URL routing
- Optional Django-style URL routing
- URLs with variables in them
- Full middleware implementation
- Limit routes by HTTP verbs
- Custom error routes
- Built-in dev server
- Gunicorn support
- HTML templates with Jinja2
- Static files support
- Cookies (reading and setting)
- Optional append_slash (with automatic redirects!)
- CSRF middleware
- CORS middleware
- Optional POST data validation middleware with Pydantic
- Session middleware with built-in session store
- Database support (using Peewee, but you can use whatever you want as long as there's a Peewee driver for it)
Example code from [the quickstart](https://itsthejoker.github.io/spiderweb/#/quickstart):
from spiderweb import SpiderwebRouter
from spiderweb.response import HttpResponse
/r/Python
https://redd.it/1fpxris
Need Help Finding Resources for Single Page Website with Django REST API and Vanilla JavaScript
Hi everyone,
I’m working on a single-page website with Django REST API for the backend and HTML, CSS, and vanilla JavaScript for the front end. The features I want to implement are:
* User management (register, login, logout, profile section)
* Adding friends functionality
* Real-time chatting between users
The problem I’m running into is that most of the resources I find use Django templates instead of Django REST API for these features. Does anyone have suggestions, helpful resources, or advice for building these features using a REST API and vanilla JavaScript? Any help would be greatly appreciated!
Thanks!
/r/django
https://redd.it/1fpszjy
django-components update - Templating is now on par with Vue or React
Hey, I'm Juro, I'm one of the maintainers of django-components. In releases v0.90-0.94 we've added features that make using components in templates much more flexible.
(This info is already a bit dated (released a month ago; latest is v0.101), as I'm busy adding support for JS / CSS variables, TypeScript & Sass, and HTML fragment. Exciting stuff! But I realized haven't shared this update yet!)
Anyway, the components can be written in the Django template similar to JSX / Vue.
The following is a component blog_post
, that accepts a title
, id
, and additional kwargs applied from blog_post_props
:
{% blogpost
title="{{ person.firstname }} {{ person.lastname }}"
id="{% randomint 10 20 %}"
...blogpostprops
/ %}
The above is a combination of multiple features:
1. Self-closing tags:
Instead of
{% component "mycomponent" %}
{% endcomponent %}
You can now simply write
{% component "mycomponent" / %}
2. Multi-line tags:
django_components now automatically configures Django to allow multi-line tags. So instead of cramming everything on a single line:
{% component "blogpost" title="abcdef..." author="John Wick" datepublished="2024-08-28" %}
{%
/r/django
https://redd.it/1fp5v6k