Python programmers of reddit: what's the most useful tiny little efficiency you've discovered that's improved your programming hugely?
Whether it's default dicts, enumerate, a way to combine functions really efficiently, or whatever, what's the best tiny trick you've discovered that's improved your code massively?
/r/Python
https://redd.it/basnhi
Whether it's default dicts, enumerate, a way to combine functions really efficiently, or whatever, what's the best tiny trick you've discovered that's improved your code massively?
/r/Python
https://redd.it/basnhi
reddit
r/Python - Python programmers of reddit: what's the most useful tiny little efficiency you've discovered that's improved your programming…
597 votes and 452 comments so far on Reddit
Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 3
https://realpython.com/flask-connexion-rest-api-part-3/
/r/Python
https://redd.it/baufsm
https://realpython.com/flask-connexion-rest-api-part-3/
/r/Python
https://redd.it/baufsm
Realpython
Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 3 – Real Python
In this three-part tutorial series, you'll create a RESTful API from scratch to keep track of people and notes using the Flask web framework. You'll also test your API with Swagger UI API documentation. In part three, you'll use SQLAlchemy to provide the…
Is what I'm trying to do even possible?
This might sound really stupid but how can I do something like this:
i = 'profile'
return self.user.i
Where the variable "i" is the attribute.
/r/django
https://redd.it/bb246d
This might sound really stupid but how can I do something like this:
i = 'profile'
return self.user.i
Where the variable "i" is the attribute.
/r/django
https://redd.it/bb246d
reddit
r/django - Is what I'm trying to do even possible?
0 votes and 2 comments so far on Reddit
Reports (i.e. Crystal) via Python
Does anybody know of any reporting tools that have been developed in Python?
Specifically, what I'm looking for is either a) a way to generate PDFs from a crystal .RPT file or b) an "open" format that could generate something similar fairly "easily" for an end user. I guess I envision something like like a flask or django template, but could then generate a report in PDF format when ran...
We use crystal reports pretty extensively in my organization for both multipage reports (for instance, sales reports) and for reports that are generally single pages (for instance, invoices are usually single page unless there are more than ~10 line items).
I've considered writing a django app (it's what I'm familiar with) to accomplish something like this for myself, but would want to make it so others could also potentially develop their own reports... I've built PDF reports using straight python before, and while that works for me, I can't imagine asking others to write python code to customize their own reports-- and I really want to avoid reinventing the wheel if a product already exists (preferably open-source so it can be incorporated into another open-source project, but if necessary,
/r/Python
https://redd.it/bb3kqk
Does anybody know of any reporting tools that have been developed in Python?
Specifically, what I'm looking for is either a) a way to generate PDFs from a crystal .RPT file or b) an "open" format that could generate something similar fairly "easily" for an end user. I guess I envision something like like a flask or django template, but could then generate a report in PDF format when ran...
We use crystal reports pretty extensively in my organization for both multipage reports (for instance, sales reports) and for reports that are generally single pages (for instance, invoices are usually single page unless there are more than ~10 line items).
I've considered writing a django app (it's what I'm familiar with) to accomplish something like this for myself, but would want to make it so others could also potentially develop their own reports... I've built PDF reports using straight python before, and while that works for me, I can't imagine asking others to write python code to customize their own reports-- and I really want to avoid reinventing the wheel if a product already exists (preferably open-source so it can be incorporated into another open-source project, but if necessary,
/r/Python
https://redd.it/bb3kqk
reddit
r/Python - Reports (i.e. Crystal) via Python
0 votes and 0 comments so far on Reddit
How to stop caching? Its driving me nuts!
Im using the dev server that comes with Flask. Every time I update CSS or a template, I cant even hard refresh to get the new stuff to show. I have to restart the server. I used this before and it worked months ago, but for some reason its not working with the new web app I am working on.
​
@app.after\_request
def after\_request(response):
response.headers\["Cache-Control"\] = "no-cache, no-store, must-revalidate, public, max-age=0"
response.headers\["Expires"\] = '0'
response.headers\["Pragma"\] = "no-cache"
return response
/r/flask
https://redd.it/ba2zul
Im using the dev server that comes with Flask. Every time I update CSS or a template, I cant even hard refresh to get the new stuff to show. I have to restart the server. I used this before and it worked months ago, but for some reason its not working with the new web app I am working on.
​
@app.after\_request
def after\_request(response):
response.headers\["Cache-Control"\] = "no-cache, no-store, must-revalidate, public, max-age=0"
response.headers\["Expires"\] = '0'
response.headers\["Pragma"\] = "no-cache"
return response
/r/flask
https://redd.it/ba2zul
reddit
r/flask - How to stop caching? Its driving me nuts!
7 votes and 10 comments so far on Reddit
[AF] Using WTForms to pass a variable to tweepy python script
Hi,
I've been following the flask tutorial from Miguel Grinberg. currently up to stage 3 following wtforms.
I'm trying to take an input of a user name for a twitter account and then input that into a python script with tweepy and return something like the number of tweets or from said account and display that to an output page.
Everything is working so far and I take a username but how do I then call input that into a second script? and also how do I return this data to output page. I have a separate script that returns the tweepy data into a json file.
The site is up and running with uwsgi and nginx all working correctly so far which is good. Any help would be amazing as I'm pretty new to this and want to experiment but i'm having some difficultly wrapped my head around some concepts when it comes to processing the data and not running everything from a single .py file
ideally I would like something like this page
https://tweetanalyzer.net/
/r/flask
https://redd.it/ba6vb6
Hi,
I've been following the flask tutorial from Miguel Grinberg. currently up to stage 3 following wtforms.
I'm trying to take an input of a user name for a twitter account and then input that into a python script with tweepy and return something like the number of tweets or from said account and display that to an output page.
Everything is working so far and I take a username but how do I then call input that into a second script? and also how do I return this data to output page. I have a separate script that returns the tweepy data into a json file.
The site is up and running with uwsgi and nginx all working correctly so far which is good. Any help would be amazing as I'm pretty new to this and want to experiment but i'm having some difficultly wrapped my head around some concepts when it comes to processing the data and not running everything from a single .py file
ideally I would like something like this page
https://tweetanalyzer.net/
/r/flask
https://redd.it/ba6vb6
Introducing pybrowser !
Hello everybody,
**pybrowser** is an attempt to simplify browser automation designed keeping end user in mind. Here is an example of usage,
from pybrowser import Browser
with Browser(browser_name=Browser.CHROME) as b:
b.goto("https://www.google.com/")
b.input("name:=q").enter("news")
b.button("name:=btnK").click()
b.take_screenshot()
print(b.html().elements.links())
It's a simple API inspired by ruby's watir with selenium and requests under the hood.
This is the first version for public usage (v0.0.1) and hence expect it to be buggy and what not. At this point definitely don't recommend for commercial use. But do play around and have fun !
[Read more...](https://pybrowser.readthedocs.io/en/latest/)
This is also my first API. So welcome any feedback :)
/r/Python
https://redd.it/bb4bdx
Hello everybody,
**pybrowser** is an attempt to simplify browser automation designed keeping end user in mind. Here is an example of usage,
from pybrowser import Browser
with Browser(browser_name=Browser.CHROME) as b:
b.goto("https://www.google.com/")
b.input("name:=q").enter("news")
b.button("name:=btnK").click()
b.take_screenshot()
print(b.html().elements.links())
It's a simple API inspired by ruby's watir with selenium and requests under the hood.
This is the first version for public usage (v0.0.1) and hence expect it to be buggy and what not. At this point definitely don't recommend for commercial use. But do play around and have fun !
[Read more...](https://pybrowser.readthedocs.io/en/latest/)
This is also my first API. So welcome any feedback :)
/r/Python
https://redd.it/bb4bdx
reddit
r/Python - Introducing pybrowser !
77 votes and 5 comments so far on Reddit
Tutorial: 3D Programming with Python for Physics Simulations
https://www.youtube.com/watch?v=KI0tjZUkb5A
/r/Python
https://redd.it/bb5sac
https://www.youtube.com/watch?v=KI0tjZUkb5A
/r/Python
https://redd.it/bb5sac
YouTube
[2.8] Tutorial: 3D Programming with Python and Blender for Physics Simulations
In this tutorial I will teach you how to create physics simulations using Blender 2.8 and Python.
The Ultimate Addon Development Course, Make Complex Addons for Blender!
https://gum.co/fciiU
Cool Add-ons for Blender:
Human Generator:
https://bit.ly/3rBjJXy…
The Ultimate Addon Development Course, Make Complex Addons for Blender!
https://gum.co/fciiU
Cool Add-ons for Blender:
Human Generator:
https://bit.ly/3rBjJXy…
Nimoy testing framework - 0.0.1b7
After a long break I've Just released beta 7 of the [Nimoy testing framework](https://github.com/browncoat-ninjas/nimoy)!
This version introduces syntactic sugar for [staging mock responses](https://github.com/browncoat-ninjas/nimoy#pretty-mock-response-staging):
```
class MySpec(Specification):
def my_feature_method(self):
with setup:
the_mock = mock.Mock()
with when:
the_mock.some_method() << [5, 6, 7]
with then:
the_mock.some_method() == 5
the_mock.some_method() == 6
the_mock.some_method() == 7
```
/r/Python
https://redd.it/bb74dc
After a long break I've Just released beta 7 of the [Nimoy testing framework](https://github.com/browncoat-ninjas/nimoy)!
This version introduces syntactic sugar for [staging mock responses](https://github.com/browncoat-ninjas/nimoy#pretty-mock-response-staging):
```
class MySpec(Specification):
def my_feature_method(self):
with setup:
the_mock = mock.Mock()
with when:
the_mock.some_method() << [5, 6, 7]
with then:
the_mock.some_method() == 5
the_mock.some_method() == 6
the_mock.some_method() == 7
```
/r/Python
https://redd.it/bb74dc
GitHub
GitHub - browncoat-ninjas/nimoy: A testing and specification framework for Python 3
A testing and specification framework for Python 3 - GitHub - browncoat-ninjas/nimoy: A testing and specification framework for Python 3
Developing a Real-Time Taxi App with Django Channels and Angular - updated!
https://testdriven.io/courses/real-time-app-with-django-channels-and-angular/
/r/django
https://redd.it/bb7wqv
https://testdriven.io/courses/real-time-app-with-django-channels-and-angular/
/r/django
https://redd.it/bb7wqv
reddit
r/django - Developing a Real-Time Taxi App with Django Channels and Angular - updated!
0 votes and 1 comment so far on Reddit
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/bb8dv4
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/bb8dv4
reddit
r/Python - What's everyone working on this week?
0 votes and 2 comments so far on Reddit
Database design
Hi guys, so I was wondering if there were any online tool, or your favourite method how to design DB tables/Django Models and relations between them. I seem to have a really hard time when trying to visualize in my head what I need to do to. I am kinda unable to see how to models are going to work together until I test it in the admin interface, only then it makes sense, but it's just highly ineffective and I had to completely wipe out the whole DB and re-do it again many times because I broke something when creating migrations. I never really know, what to set as defaults. I can make a functional DB, but I want to do it well, normalized.
​
Maybe even some typical examples would help. Like I know that a foreign key is a column that branches out to rows in another column, but when the table it points to consists of another foreign key, my head is about to explode xD
​
For example I am building an eshop but without prices, carts, payments etc. just like a gallery and the rest is discussed with a customer. Now this is what I have so
/r/django
https://redd.it/bb9yos
Hi guys, so I was wondering if there were any online tool, or your favourite method how to design DB tables/Django Models and relations between them. I seem to have a really hard time when trying to visualize in my head what I need to do to. I am kinda unable to see how to models are going to work together until I test it in the admin interface, only then it makes sense, but it's just highly ineffective and I had to completely wipe out the whole DB and re-do it again many times because I broke something when creating migrations. I never really know, what to set as defaults. I can make a functional DB, but I want to do it well, normalized.
​
Maybe even some typical examples would help. Like I know that a foreign key is a column that branches out to rows in another column, but when the table it points to consists of another foreign key, my head is about to explode xD
​
For example I am building an eshop but without prices, carts, payments etc. just like a gallery and the rest is discussed with a customer. Now this is what I have so
/r/django
https://redd.it/bb9yos
reddit
r/django - Database design
0 votes and 0 comments so far on Reddit
MLConjug. A Python library to conjugate verbs in French, English, Spanish, Italian, Portuguese and Romanian (more soon) using Machine Learning techniques.
Hi all,
​
I am the author of the open source project [mlconjug](https://pypi.org/project/mlconjug/), a Python library to conjugate verbs in French, English, Spanish, Italian, Portuguese and Romanian (more soon) using Machine Learning techniques.
​
Any verb in one of the supported language can be conjugated, as the module contains a Machine Learning model of how the verbs behave. Even completely new or made-up verbs can be successfully conjugated in this manner. The supplied pre-trained models are composed of:
* a custom-made binary feature extractor,
* a feature selector using Linear Support Vector Classification,
* a classifier using Stochastic Gradient Descent.
MLConjug uses scikit-learn to implement the Machine Learning algorithms.Users of the library can use any compatible classifiers from scikit-learn to modify and retrain the models.
* Free software: MIT license
* Documentation: [https://mlconjug.readthedocs.io](https://mlconjug.readthedocs.io/).
### Supported Languages
* French
* English
* Spanish
* Italian
* Portuguese
* Romanian
### Features
* Easy to use API.
* Includes pre-trained models with 99% + accuracy in predicting conjugation class of unknown verbs.
* Easily train new models or add new languages.
* Easily integrate MLConjug in your own projects.
* Can be used as a command line tool.
​
Do not hesitate to try it out and let me know if you find bugs, want to propose improvements or want some specific languages added.
​
Cheers,
​
SekouD
/r/Python
https://redd.it/bb8400
Hi all,
​
I am the author of the open source project [mlconjug](https://pypi.org/project/mlconjug/), a Python library to conjugate verbs in French, English, Spanish, Italian, Portuguese and Romanian (more soon) using Machine Learning techniques.
​
Any verb in one of the supported language can be conjugated, as the module contains a Machine Learning model of how the verbs behave. Even completely new or made-up verbs can be successfully conjugated in this manner. The supplied pre-trained models are composed of:
* a custom-made binary feature extractor,
* a feature selector using Linear Support Vector Classification,
* a classifier using Stochastic Gradient Descent.
MLConjug uses scikit-learn to implement the Machine Learning algorithms.Users of the library can use any compatible classifiers from scikit-learn to modify and retrain the models.
* Free software: MIT license
* Documentation: [https://mlconjug.readthedocs.io](https://mlconjug.readthedocs.io/).
### Supported Languages
* French
* English
* Spanish
* Italian
* Portuguese
* Romanian
### Features
* Easy to use API.
* Includes pre-trained models with 99% + accuracy in predicting conjugation class of unknown verbs.
* Easily train new models or add new languages.
* Easily integrate MLConjug in your own projects.
* Can be used as a command line tool.
​
Do not hesitate to try it out and let me know if you find bugs, want to propose improvements or want some specific languages added.
​
Cheers,
​
SekouD
/r/Python
https://redd.it/bb8400
PyPI
mlconjug
A Python library to conjugate French, English, Spanish, Italian, Portuguese and Romanian verbs using Machine Learning techniques.
The problem with inheriting from dict and list in Python
https://treyhunner.com/2019/04/why-you-shouldnt-inherit-from-list-and-dict-in-python/
/r/Python
https://redd.it/bbak7w
https://treyhunner.com/2019/04/why-you-shouldnt-inherit-from-list-and-dict-in-python/
/r/Python
https://redd.it/bbak7w
Treyhunner
The problem with inheriting from dict and list in Python
I’ve created dozens of Python Morsels since I started it last year.
At this point at least 10 of these exercises involve making a custom …
At this point at least 10 of these exercises involve making a custom …
The most loved and most disliked programming languages revealed in Stack Overflow survey
https://www.techrepublic.com/article/the-most-loved-and-most-disliked-programming-languages-revealed-in-stack-overflow-survey/
/r/Python
https://redd.it/bb8xgz
https://www.techrepublic.com/article/the-most-loved-and-most-disliked-programming-languages-revealed-in-stack-overflow-survey/
/r/Python
https://redd.it/bb8xgz
TechRepublic
The most loved and most disliked programming languages revealed in Stack Overflow survey
The annual Stack Overflow survey is one of the most comprehensive snapshots of how programmers work.
Has anyone built a project based on Guardian?
Long story short, I'm working on a project in which I need to be able to assign users to a group and groups to an event. I have read through the guardian documentation and I believe this does exactly that, providing the ability to create unique events with groups over users that can modify them.
This is the first project of this kind that I've worked on, so I'm interested to see if anyone can chime in. Specifically:
1. Did you create an intermediate model to link the group to the event?
2. Should this live in three separate apps: User, Group, Event?
Thanks in advance.
/r/django
https://redd.it/bbbhcm
Long story short, I'm working on a project in which I need to be able to assign users to a group and groups to an event. I have read through the guardian documentation and I believe this does exactly that, providing the ability to create unique events with groups over users that can modify them.
This is the first project of this kind that I've worked on, so I'm interested to see if anyone can chime in. Specifically:
1. Did you create an intermediate model to link the group to the event?
2. Should this live in three separate apps: User, Group, Event?
Thanks in advance.
/r/django
https://redd.it/bbbhcm
reddit
r/django - Has anyone built a project based on Guardian?
3 votes and 1 comment so far on Reddit
GitHub - ReviewNB/treon: Easy to use test framework for Jupyter Notebooks
https://github.com/ReviewNB/treon
/r/IPython
https://redd.it/bbadxr
https://github.com/ReviewNB/treon
/r/IPython
https://redd.it/bbadxr
GitHub
GitHub - ReviewNB/treon: Easy to use test framework for Jupyter Notebooks
Easy to use test framework for Jupyter Notebooks. Contribute to ReviewNB/treon development by creating an account on GitHub.
Django with Graphene
Hey guys,
​
I'm creating my first django graphql api with graphene and wondering how can this be written in a shorter way:
​
[https://pastebin.com/T4nsEZMj](https://pastebin.com/T4nsEZMj) \- [models.py](https://models.py)
[https://pastebin.com/71Q6KC4q](https://pastebin.com/71Q6KC4q) \- schema.py
​
[https://pastebin.com/3Lu7268q](https://pastebin.com/3Lu7268q) \- graphql\_query
[https://pastebin.com/3VQSb3Wy](https://pastebin.com/3VQSb3Wy) \- graphql\_results
/r/django
https://redd.it/bbceyd
Hey guys,
​
I'm creating my first django graphql api with graphene and wondering how can this be written in a shorter way:
​
[https://pastebin.com/T4nsEZMj](https://pastebin.com/T4nsEZMj) \- [models.py](https://models.py)
[https://pastebin.com/71Q6KC4q](https://pastebin.com/71Q6KC4q) \- schema.py
​
[https://pastebin.com/3Lu7268q](https://pastebin.com/3Lu7268q) \- graphql\_query
[https://pastebin.com/3VQSb3Wy](https://pastebin.com/3VQSb3Wy) \- graphql\_results
/r/django
https://redd.it/bbceyd
Pastebin
class Category(TimeStampedModel): name = models.CharField(_("Category nam - Pastebin.com
My second article in the series of articles on Rust language aiming at Python developers
[https://medium.com/@rajasekar3eg/rust-for-python-developers-ownership-and-borrowing-cd85fc10cae4](https://medium.com/@rajasekar3eg/rust-for-python-developers-ownership-and-borrowing-cd85fc10cae4)
/r/Python
https://redd.it/bbdj5p
[https://medium.com/@rajasekar3eg/rust-for-python-developers-ownership-and-borrowing-cd85fc10cae4](https://medium.com/@rajasekar3eg/rust-for-python-developers-ownership-and-borrowing-cd85fc10cae4)
/r/Python
https://redd.it/bbdj5p
Medium
Rust for Python Developers: Ownership and Borrowing
Following the previous post, here I am going to introduce the key concepts of Rust — Ownership and Borrowing.
Congratulations Python community we are still dominanting !
Heads-up to the community for creating such a lovable and supporting ecosystem. Python is the forth most popular language, second most loved language and the most wanted and fastest growing language in the latest stack overflow survey.
https://insights.stackoverflow.com/survey/2019
/r/Python
https://redd.it/bbgi5w
Heads-up to the community for creating such a lovable and supporting ecosystem. Python is the forth most popular language, second most loved language and the most wanted and fastest growing language in the latest stack overflow survey.
https://insights.stackoverflow.com/survey/2019
/r/Python
https://redd.it/bbgi5w
Stack Overflow
Stack Overflow Developer Survey 2019
Nearly 90,000 took this comprehensive, annual survey of people who code. Demographics. Most loved, dreaded and wanted technologies. Salary and careers.