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

Sharing what I would consider as a win (part 2)

# What My Project Does

Basically, it uses gmail's API to:
- send messages.
- get message-ids.
- delete messages.


Part 1:
https://www.reddit.com/r/Python/comments/1eouavj/sharing\_what\_i\_would\_consider\_as\_a\_win/

In part 1, I was suggested to apply argparse and lose the prompt.


# Target Audience:
Here is the GmailManager with argparse:
https://github.com/benSharon/Gmail-Manager/tree/GmailManager-argparse

Of course, you opinions is of utmost importance and needless to say: be brutal.

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

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

Python Daily

I was bored and made this. now looking to upgrade this.

https://preview.redd.it/r6klol195sid1.png?width=1523&format=png&auto=webp&s=366b27f1cfbaf03c530ae28b07028fbd5a5ad25d

code: https://github.com/Nannigalaxy/prober

created a simple server status monitor app that shows status of specified endpoint , more urls can be added via custom yaml configuration. even columns are configurable.

need suggestion to what new features can be added or how i can make this better.

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

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

Python Daily

Transitioning from Back-end Development to Mobile Development (iOS).

I'm a Python back-end developer (Mainly Django) with two years of experience. I have done React JS projects also. Currently my company don't have new projects in python but they having plenty of iOS projects. So I looked into iOS development and it seems pretty cool. So I have requested my manager to allow me to learn one more stack that is iOS and that wish was granted but I got turned down by few colleagues that I'm digging my own grave and I feel so bad now. Was that a bad idea. Please let me know the challenges and How it's going to affect my career.

Thanks.

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

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

Python Daily

marimo notebooks now have built-in support for SQL

**What My Project Does**

[marimo](https://github.com/marimo-team/marimo) - an open-source reactive notebook for Python - now has built-in support for SQL. You can query dataframes, CSVs, tables and more, and get results back as Python dataframes.

**Target Audience**

This is for notebook users who like to mix-and-match Python and SQL. Using SQL to query dataframes can be much cleaner and more intuitive than the Pandas API in many cases.

**Comparison**

The alternative to using built-in SQL is to either continue to use Pandas, or write SQL strings in vanilla Python code.

Comparing SQL vs Pandas - let's say we want to find the average salary of employees in each department who were hired after 2020, but only for departments with more than 5 such employees.

SELECT department, AVG(salary) as avg_salary
FROM employees
WHERE YEAR(hire_date) > 2020
GROUP BY department
HAVING COUNT(*) > 5
ORDER BY avg_salary DESC

vs

result = (df[df['hire_date'].dt.year > 2020]
.groupby('department')
.filter(lambda x: len(x) > 5)


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

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

Python Daily

Are there any Open source Companies that use Django

Hey guys , I am a fresher and have been working in open source for about 6 months , 3 of which are under google summer of code , I want to know are there any open sourced companies that use django and have good funding so, I have some chances of getting hired

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

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

Python Daily

Can somebody explain to me how the {% url %} function work in django html

Im trying to use the url function in django html, (trying to make a search button), bearly found any info on the function to begin with all i heard was enter a {% url "url name"%}, tried that and tried a view name just to make sure.

Met with no reserve match error, and tbh i dont realy understand the function realy, so i dont realy know how can i debug it

Can somebody help me?

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

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

Python Daily

PyData Amsterdam Conference on September 18-20

We're gearing up for an incredible conference from September 18-20 in Amsterdam, packed with insightful talks, hands-on tutorials, and exceptional networking opportunities. Don’t miss your chance to be part of this premier Data & AI gathering! Check out the full program and join us: https://amsterdam.pydata.org/program/

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

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

Python Daily

Introducing DishAdvisor: Discover the Best Dishes based on user reviews (Open Source Project)

⚠️ Disclaimer: This project is a prototype.

## What My Project Does

An open-source project designed to help people discover the most popular and highly-rated dishes based on real reviews posted on Google Maps.

## Target Audience

DishAdvisor is ideal for food lovers and frequent diners who want to discover the best dishes at various restaurants.

## Comparison

Unlike platforms like Yelp or TripAdvisor that focus on overall restaurant reviews, it highlights what to order at a restaurant rather than just where to eat.

## 👥 How You Can Help:

- Feedback: I'd love to hear your thoughts on the concept, design, and implementation.
- Collaboration: If you're a developer (Python, backend/frontend, etc.) or have experience in the food/restaurant industry, your expertise would be greatly appreciated!
- Ideas: Any suggestions on features or improvements that could make DishAdvisor even more useful?

Explore the project on GitHub

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

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

Python Daily

R Trying to classify Blueberries as "Crunchy", "Juicy" or "Soft" using Acoustic Signal Processing and Machine Learning


I'm working on on this research to classify blueberries based on their texture—specifically, whether they are soft, juicy, or crunchy—using the sounds they produce when crushed.
I have about 1100 audio samples, and I've generated spectrograms for each sample. Unfortunately, I don't have labeled data, so I can't directly apply supervised machine learning techniques. Instead, I'm looking for effective ways to differentiate between these three categories based on the spectrograms. I've attached examples of spectrograms for what I believe might be soft, juicy, and crunchy blueberries. However, since the data isn't labeled, I'm unsure if these assumptions are correct.

Crunchy Berries: When crushed, they produce separate, distinct peaks in the audio signal. These peaks are spaced out over time, indicating that the berry is breaking apart in a crisp, segmented manner.

crunchyberry

Juicy Berries: When crushed, they generate continuous peaks in the audio signal. These peaks are more closely packed together and sustained, indicating a burst of juice and flesh, with less resistance, creating a smoother sound.

juicyberry

Soft Berries: These produce very few and small peaks. The sound is faint and less defined, indicating that the berry crushes easily with little resistance, creating minimal disruption in the audio signal.

softberry


What I Tried:

I attempted to classify the

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

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

Python Daily

How to solve multi-dev issue for database that should be populated

I’m working on a project with some people and we’ve been adding images and some text to the database (Postgres) through the django admin, they get added to the database but when someone commits to the GitHub repository and someone else pulls and runs he doesn’t see any of the things added to the database. It looks like django doesn’t leave instructions of what to populate to the database in the code itself so how do multi-dev teams get around this issue

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

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

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

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

Python Daily

Really Bad support for older versions. Need some Advice

I'm a mern developer basically(not much knowledge of django), but have to work on a django backend for very few changed .But damn, this project was made in 2019 i guess. I can see its using django 2.2 but im really stuck at starting this project, basically installing dependencies. If have gotten tons of errors since last 12 hours im trying to run this project. Sometimes issues with visual build tools, sometimes pip, sometimes apache, I fix 1 thing, and breaks another. It was so difficult to even get a older python version(literally found in stack overflow comment). Now i'm stuck on errors on errors basically compatibility error.

So I need some advice, what should I be doing? Should I keep trying and trying till get this project running or I might not be possible. Should I try on vmware ubuntu to create a totally different environment. Or I need to ask my client to let me upgrade the version of django, which might cause me more issues from development to deployment. Really confused right now.

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

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

Python Daily

Is Cython OOP much faster than Python?

Im working on a project that unfortunately heavily relies on speed. It simulates different conditions and does a lot of calculations with a lot of loops. All of our codebase is in Python and despite my personal opinion on the matter, the team has decided against dropping Python and moving to a more performance orientated language. As such, I am looking for a way to speed up the code as much as possible. I have experience in writing such apps with "numba", unfortunately "numba" is quite limited and not suited for the type of project we are doing as that would require breaking most of the SOLID principles and doing hacky workarounds.
I read online that Cython supports Inheritance, classes and most data structures one expects to have access to in Python. Am I correct to expect a very good gain of execution speed if I were to rewrite an app heavily reliant on OOP (inheritance, polymorphism) and multiple long for loops with calculations in pure Cython? (A version of the app works marvelously with "numba" but the limitations make it hard to support in the long run as we are using "numba" for more than it was designed to -

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

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

Python Daily

My Experience of Learning Django
https://konj.me/k/67

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

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

Python Daily

An extensive open source collection of RAG implementations with many different strategies

Hi all,

Sharing a repo I was working on for a while.

It’s open-source and includes many different strategies for RAG (currently 17), including tutorials, and visualizations.

This is great learning and reference material.
Open issues, suggest more strategies, and use as needed.

Enjoy!

https://github.com/NirDiamant/RAG_Techniques

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

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

Python Daily

When migrating from runserver to Gunicorn, receive error ModuleNotFoundError: No module named 'myproject'

Problem description:

When migrating from runserver to Gunicorn and running command “gunicorn -c gunicorn.conf.py myproject.wsgi.application”, receive error ModuleNotFoundError: No module named ‘myproject’

Note: I renamed text in this post to "myproject" for the sake of this post.

I have been working on this for many hours and I cannot find the solution.

I reviewed the link https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/gunicorn/ but I am not understanding the error when running the command.

I configured a config file for Gunicorn and put it in the same directory as manage.py.

Environment information:

Django 5.1.0
Gunicorn 23.0.0
Nginx Reverse Proxy
RHEL 8 Virtual Machine

>whereis python

>python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python3.11

>

whereis gunicorn

>gunicorn: /home/jparker/.local/bin/gunicorn

>echo $PATH

>/home/user/.local/bin:/home/user/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

>

>
├── myproject

>│   ├── asgi.py

>│   ├── gunicorn.conf.py

>│   ├── __init__.py

>│   ├── __init__.pyc

>│   ├── __pycache__

>│   │   ├── gunicorn.conf.cpython-311.pyc

>│   │   ├── __init__.cpython-311.pyc

>│   │   ├── __init__.cpython-312.pyc

>│   │   ├── settings.cpython-311.pyc

>│   │   ├── settings.cpython-312.pyc

>│   │   ├── urls.cpython-311.pyc

>│   │   ├── urls.cpython-312.pyc

>│   │   ├── wsgi.cpython-311.pyc

>│   │   └── wsgi.cpython-312.pyc

>│   ├── settings.py

>│   ├── ssl_test.py

>│   ├── urls.py

>│   ├── wsgi.py

>│   └── wsgi.pyc
├── manage.py







wsgi.py

>import os

>

>from django.core.wsgi import get_wsgi_application

>os.environ.setdefault(‘DJANGO_SETTINGS_MODULE’, ‘myproject.settings’)

>application = get_wsgi_application()

settings.py

>

import os

>os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')

>import environs

>

>from pathlib import Path

>

>from environs import Env

>

>env = Env()

>

>env.read_env()

>

>BASE_DIR = Path(__file__).resolve().parent.parent

>

>SECRET_KEY = env.str("SECRET_KEY")

>

>DEBUG = env.bool("DEBUG", default=False)

>

>ALLOWED_HOSTS = ['192.168.46.69', 'localhost', '127.0.0.1'\]

>

>INSTALLED_APPS = [

>

>'dashboard',

>'authentication',

>

>'rest_framework',

>'django_filters',

>'corsheaders',

>'django.contrib.admin',

>'django.contrib.auth',

>'django.contrib.contenttypes',

>'django.contrib.sessions',

>'django.contrib.messages',

>'django.contrib.staticfiles',

>\]

>

>CORS_ORIGIN_ALLOW_ALL = True

>

>MIDDLEWARE = [

>'django.middleware.security.SecurityMiddleware',

>'django.contrib.sessions.middleware.SessionMiddleware',

>'corsheaders.middleware.CorsMiddleware',

>'django.middleware.common.CommonMiddleware',

>'django.middleware.csrf.CsrfViewMiddleware',

>'django.contrib.auth.middleware.AuthenticationMiddleware',

>'django.contrib.messages.middleware.MessageMiddleware',

>'django.middleware.clickjacking.XFrameOptionsMiddleware',

>\]

>

>ROOT_URLCONF = 'myproject.urls'

>

>WSGI_APPLICATION = 'myproject.wsgi.application'

>

>LANGUAGE_CODE = 'en-us'

>

>TIME_ZONE = 'UTC'

>

>USE_I18N = True

>

>USE_TZ = True

>

>DEFAULT_AUTO_FIELD

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

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

Python Daily

Architecture diagram for my weekend project: Open SEC Data

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

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

Python Daily

WNBA API Made with flaks

WNBA projections for August 14 2024

Kick off the 2nd half of the WNBA season after the Olympics with the WNBA API! It delivers detailed projections and stats for every basketball player. Check out a sample of the JSON data below: August 14, 2024.


Player:"Sabrina Ionescu"
Team:"NYL"
Pos:"G"
Min:36
PTS:21.5
REB:6
AST:6.3
STL:1.2
BLK:0.4
3PM:2.3
FG%:39.5
FT%:92.8
TO:3.1
OREB:0.8
DREB:5.2
3PA:7.2
3P%:32.6
FGM:9.7
FGA:24.5
FTM:4.4
FTA:4.8
FP:41.2
FanDuelFP:41.2
DraftKings
FP:41

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

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

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

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

Python Daily

Django: create sub-commands within a management command
https://adamj.eu/tech/2024/08/14/django-management-command-sub-commands/

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

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

Python Daily

P New open-source release: SOTA multimodal embedding models for fashion

Hi All!

I am really excited to announce Marqo-FashionCLIP & Marqo-FashionSigLIP - two new state-of-the-art multimodal models for search and recommendations in the fashion domain. The models have surpassed current SOTA models FashionCLIP2.0, and OpenFashionCLIP on 7 fashion evaluation datasets including DeepFashion and Fashion200K, by up to 57%.

Marqo-FashionCLIP & Marqo-FashionSigLIP are 150M parameter embedding models that:

Outperform [FashionCLIP2.0](https://github.com/patrickjohncyh/fashion-clip), and [OpenFashionCLIP](https://github.com/aimagelab/open-fashion-clip) on all benchmarks (up to +57%).
Are 10% faster for inference than FashionCLIP2.0, and OpenFashionCLIP.
Use [Generalized Constrastive Learning (GCL)](https://github.com/marqo-ai/GCL) with SigLIP to optimize over seven fashion specific aspects including descriptions, titles, colors, details, categories, keywords and materials.
Were benchmarked across 7 publicly available datasets and 3 tasks.

https://preview.redd.it/8kkyn2e61mid1.png?width=1459&format=png&auto=webp&s=e8bfa42faca752538b92e06e3dba3a7780007981

We are releasing Marqo-FashionCLIP and Marqo-FashionSigLIP under the Apache 2.0 license here.

# Benchmark Results

Here are the results across the 7 datasets. All values represent the relative improvement for precision/recall over the FashionCLIP2.0 baseline. You can find more details and the code to reproduce here https://github.com/marqo-ai/marqo-FashionCLIP.

Averaged recall\/precision @1 results across 7 datasets \(compared to FashionCLIP2.0 baseline\)


Let me know any feedback or if there are other models you are interested in seeing being developed!

GitHub: https://github.com/marqo-ai/marqo-FashionCLIP
Blog: https://www.marqo.ai/blog/search-model-for-fashion



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

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

Python Daily

Could I make an Instagram type app in Android by only using python as backend?

I know Instagram was mostly made in Python but some parts in Android are made in Java.

Could I use only Python as backend in an Instagram type app in Android?

If not, why?

Thanks!

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

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

Python Daily

Basically “puppet warp”

I’m new to coding and I’m really just needing to know if its possible to plot points on an image, mainly a character, and move certain parts like an arm or leg without messing up the image itself. If you know what “puppet warp” is on “photoshop” that’s essentially what I’m trying to do.

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

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

Python Daily

Flask-Recursion Error: maximum recursion depth exceeded while calling a Python object

https://redd.it/1ersqdl
@pythondaily

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

Python Daily

I have a whiteboard interview, what should I expect?

I have a whiteboard interview for a Junior Python developer role, and it’s the last stage of the interview process.

The previous stage was a take-home task, which they were happy with my solution.

What should I expect for this whiteboard stage? I need advice, pointers and suggestions. Any resources to look at is also fine.

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

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

Python Daily

My project plan

My client needs to log the source for some afiliate links he is promoting. Due to costs he is not interested in creating a django instance in aws. What I'm suggesting is to use aws lambdas to write into a csv in s3, as it seems to me more cost efficient. I'm struggling with the idea of the csv in s3 as it seems wrong but is there a reason why I shouldn't do it, besides scalability?

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

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

Python Daily

I tried to host a flask application today

I was assigned a task to create a microservice and a language of my choice. I picked python and decided to try flask. I did the app and started looking about how to host it.

I read many articles, saw many videos. Each is different from other. One ends up giving good result and another leading to nothing. It is too overwhelming.

Can you please share a standard way to deploy a flask app? Thanks in advance

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

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

Python Daily

I've just used Python for the first time and I'm hooked

I've always wanted to get to know Python but been so lazy to learn it and didn't know the merits of being good at it.
I had a crashed hard disk and did a data restore. I managed to recover most of my data but it was all messed up and was never in organized formats.
For example, each song was restored into a folder by artist name. This meant creating over 2000 folders of artists.

I wanted my music to be organized by genre, or by album name and maybe by artist if the songs lacked the first tags in the meta data.

I just put my dilemma into chat gpt and asked for a python script to get into my hard disk, get all the music out of the folders it is in and sort it into folders by genre, or album or artist name.

A script was generated which I run and viola, my music was all sorted.

They always say the best way to learn is by practicing, I think this has motivated me to start learning from the basics, bearing in mind what I've seen the language capable of doing.

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

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

Python Daily

Best Django deployment tutorial?

i am done with django course of corey and he have deploy videos in it also

i am thinking of finding some latest tutorials instead of those as those services might have changed and all type of stuff


so which one should i take?

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

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

Python Daily

Help with deployment django.

I have created the frontend with react.js and backend with djangorestframework and mySql db for an airbnb like app. I have no idea how scalability works.

What do i have to do now to deploy it to digital ocean.
I found a tutorial online where the guy uploaded the files to digitalocean and used LEMP stack to deploy, but if i do this with my app, how well will it scale? How many users will it be able to support at a time considering it is just simple MySQL, react and DRF.


Also if i need to do more things to make sure the app actually works well for around 50k users at a time, what things do i need to learn, please also mention the tutorials.

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

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