Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
[N] Microsoft teams up with OpenAI to exclusively license GPT-3 language model

"""OpenAI will continue to offer GPT-3 and other powerful models via its own Azure-hosted API, launched in June. While we’ll be hard at work utilizing the capabilities of GPT-3 in our own products, services and experiences to benefit our customers, we’ll also continue to work with OpenAI to keep looking forward: leveraging and democratizing the power of their cutting-edge AI research as they continue on their mission to build safe artificial general intelligence."""

https://blogs.microsoft.com/blog/2020/09/22/microsoft-teams-up-with-openai-to-exclusively-license-gpt-3-language-model/

/r/MachineLearning
https://redd.it/ixs88q
Should I split my API and Worker?

I have a flask api that currently puts jobs on rq queues to be processed. The api and the "processing engine" is all part of the same flask code base and I launch it all together in a single docker container (with docker-compose). Let's say I have this app deployed on an EC2.

I am confused on how to scale this when there is a bottleneck on jobs and not the API. If I scale the EC2 instances directly, I'll have multiple APIs running, but the bottleneck is in the queues.

So should I instead split my API and Queues into separate docker instances? And then deploy each of those on separate servers? That way I can load balance the queue servers separately but the API can still run on a single instance.

Just want to make sure I am thinking about this correctly.

/r/flask
https://redd.it/ixyeur
New easy to use JWT token based Authentication for Flask Apps

​

​

[Flask JWT Router](https://preview.redd.it/kljqppppiro51.png?width=4113&format=png&auto=webp&s=bb193e7ff953351f4267807cae44f530aa8c2ed1)

Please try out a new token based Authentication library for flask. Great for apps that provide data for Single Page apps (React, Angular, Vue.js etc.)

[https://github.com/joegasewicz/flask-jwt-router](https://github.com/joegasewicz/flask-jwt-router)

It directly hooks up to Flask-SqlAlchemy, so your logged in user is accessible on Flask's global context object (Please see the docs)

/r/flask
https://redd.it/ixw51n
This media is not supported in your browser
VIEW IN TELEGRAM
I had tried to visualise the sorting of a data structure for the programmers who are new in data structure

/r/Python
https://redd.it/iy48av
Use Google's Personal data about you - a simple project with Python

​

[A little sample on what you can build](https://preview.redd.it/hpbg033r8uo51.png?width=414&format=png&auto=webp&s=4c7da328e960127c1ddd74208b125ace2a0d12b7)

A simple project that downloads your personal data from Google. Read more about it [here](https://python-everything.com/post/136/Google-is-tracking-you%2C-and-you-can-pitch-in-to-analyse-the-data%21.html)

/r/Python
https://redd.it/iy4oop
What is the difference between these 3: index(request, args, kwargs), index( args, kwargs), index(request)?

I have seen all these 3: `def index(request), def index(request, args, kwargs), def index( args, kwargs)`in tutorials. what is the difference and which function should I use ? Any help will be greatly appreciated. Thank you.

/r/django
https://redd.it/iy6bgz
Why Django as seperate backend and Vue as seperate frontend, when we can have Vue inaide of Django templates ?



/r/django
https://redd.it/iy1uh6
Solution for allowing API access from external apps?

Hello!


I have a django webapp and wanted to hear some suggestions for api access for external applications. I would like to allow users to be able to make protected API calls into my platform with best security practices.

What I had in mind was giving a token for external platforms and setting up an API urls route for all the calls that they may need. But that is about the most I can think of. Any one with a system with great suggestions?

/r/django
https://redd.it/iyco94
[D] Snapchat Anime Filter

If you don't know what I'm talking about, take a look [here](https://comicbook.com/anime/news/snapchat-anime-filter-viral-manga-2020/#10).

As soon as I saw how stable the generation of the filter was, I started experimenting with it and trying to figure out how they did it.

My current belief is as follows. They manually hooked up the features from their face detection/recognition algo into an anime face GAN. So you can think of as those sliders that control age/hair colour/skin colour on the face generation website but hooked up to features from facial recognition.

SC definitely has singled out which algo features correspond to which facial features because they use hair colour/length in other filters.

This approach leads to the more generic anime faces seen in the filter, but is way more stable than something like https://selfie2anime.com/ that does image-to-image conversion.

Aside from that, the filter just does a simple posterisation and overlays the face in the right spot.

Thoughts?

/r/MachineLearning
https://redd.it/iy8njt
Implementing social authentication for Django web application??

Hello everyone, I can't for the life of me figure this out.

I am creating a web application that will use private Yahoo! API's.

From this, I would like to have a log in button for Yahoo!, that will authenticate the user using Yahoo! OAuth2. Once authenticated, I want to retrieve the access_token so that I can make API requests for the given user...

I have exhausted many pages of google tutorials, I can't figure this out...

This website here does exactly what I want to do: https://yfantasysandbox.herokuapp.com/

Where the user simply logs in through Yahoo! and I can store their token to make future API requests...

Can anyone point me in the right direction regarding this???

/r/django
https://redd.it/iyhmaz
Need help to find ways to generate reports

I'm building an app using Django. In this app, I would like to generate pdf reports using weasyprint package.

In my app, I have views to get data from my models and process this data (I do this by calling functions that I wrote in a separate module) then pass it to the templates to display it.

In these templates, I have a button to download the pdf report, when clicking this button it will redo (re-call functions from the module) which some functions take time (in case of year report) to return the result.

I would like to know if there are other ways to generate the report without recalling these functions?

And how about sending the result data from templates using AJAX to the view that generates the pdf report? This is a right way? There are other ways?

Below views that I use to display the day and last year stats (the first and second one) and to generate pdf (the third).

def day_period_stats(request, period):
day = timezone.now() if period == 'today' else timezone.now().date() - timedelta(1)
result = get_tasks_info_of_day(day)
return render(request,

/r/django
https://redd.it/iyhls5
Thursday megathread: Python careers!

Discussion of using Python in a professional environment, getting jobs in Python and more!

**This thread is not for recruitment, please see** r/PythonJobs **or the thread in the sidebar for that.**

/r/Python
https://redd.it/iymd26
2-years in the making! Codename Mallow is a 4 player local/online versus multiplayer that I've been coding entirely in Python/Pygame. Tackled rope physics, particle engines, and other fun things. The demo launched today!! The source code is available, too. Enjoy :)

Codename Mallow is an adrenaline-charged versus multiplayer game with armless melee battles, one-hit-kill weaponry, and wildly unpredictable stages. Duel for Ninja Supremacy with up to 4 friends in local or online play. Demo & Source Code available NOW!

https://reddit.com/link/iy9cx3/video/4jktd5jy7wo51/player

Demo / Code: [https://ancalabro.itch.io/codename-mallow](https://ancalabro.itch.io/codename-mallow/)

Website: [https://www.codenamemallow.com](https://www.codenamemallow.com/)

To anyone perusing the source code, be warned: I am self-taught and a giant hack. I have lots of bad habits, and my code is probably laid out pretty poorly. So I wouldn’t look at the code in this project as something to emulate. But if you think any of the in game effects are cool/interesting, access to the code should at least let you go in and figure out how I went about creating them. Hopefully someone finds this useful!

/r/Python
https://redd.it/iy9cx3
User Groups/Profiles in JupyterHub on Kubernetes

Is it possible to establish user groups or profile templates in JupyterHub? For instance, a normal user would get 2Gi of memory but a data science user would get 4Gi of memory and have a different image.

If not, is it possible to dynamically allocate resources? For example, a user needs more memory, can I add more memory to his pod?

/r/IPython
https://redd.it/iyflmd
My solutions for Cracking the Coding Interview questions

I spent my free time this lockdown summer going through many of the questions in the Cracking the Coding Interview book, the "go-to" resource for interview preparation.

Github: https://github.com/ben-xD/leet

The solutions they give are generally very well explained and the approaches can be ported over to Python, even though the code they give in the print version is Java (which is quite verbose).

The official Python solutions online seems to be a bit lacking, so I've compiled my own after starting to do weekly session with a friend.

Definitely recommend the book, I hope the repo can help anyone going though the questions. Happy to correct any issues/screw-ups :D

/r/Python
https://redd.it/iyltgo
Updating old projects vs creating new ones

I have made a project that helps me create an excel spreadsheet for work. We changed an aspect of it so I wrote a new program to reflect that. then we added another type of spreadsheet so I recreated it again to incorporate all three types into one. It is a sloppy mess and it needs to be rewritten with class structure instead of the slew of functions that manages the whole thing. in about 4 months I am moving to a different client so what I have created may not even be applicable for the new client.

This got me thinking if I rewrote the program now to be more pythonic it would be easier to change later. I can try to make it smarter and allow a user to adjust the parameters to format it themselves.

Or I could focus on new projects that are more varied. because I am still relatively new to programming (about a year), does it make more sense for me to try and diversify the types of programs and libraries I work with or get more in depth with the ones I know now and learn how to more efficiently rewrite the code I

/r/Python
https://redd.it/iylxnq
Looking for a Technical Co-Founder

Hi everyone, we are searching for a technical founder/CTO who is interested in collaborating on an idea-stage interdisciplinary R&D cloud laboratory for the life sciences. Think Benchling but for all disciplines of life sciences instead of just strictly molecular/biochem, with more workflow-friendly features. If you have experience in a combination of life sciences, coding (be able to build an MVP SaaS solution) and data, then please hit me up and we can talk more!

/r/IPython
https://redd.it/iyg1lc