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
[D] Did weight decay fall out of favor for regularizing NNs?

At least this is my impression based on it no being used anymore in newer papers. But how come? By contrast to other techniques it actually has a very solid theoretical foundation.

​

/r/MachineLearning
https://redd.it/arlq1d
My Django note taking tool for my engineering journal

I wanted to share my first django project should it be of any use to anyone. I use it for keeping an engineering journal at work but it can be easily used for taking notes related to a book you're reading or even a course at school.

[https://gitlab.com/shanedora/bornstellar](https://gitlab.com/shanedora/bornstellar)

Cheers\~S

/r/django
https://redd.it/arll1o
Lil cheatsheet

/r/Python
https://redd.it/arp3z9
This media is not supported in your browser
VIEW IN TELEGRAM
Python-powered IoT device shows total # of humans online (live) on Python Discord server

/r/Python
https://redd.it/aroyp9
This media is not supported in your browser
VIEW IN TELEGRAM
My ASCII generator (image2text, image2image and video2video) written in Python (Source code: https://github.com/vietnguyen91/ASCII-generator)

/r/Python
https://redd.it/arqh4i
Does it make sense to use flask-restful to write restapi instead of use the original Flask?

Hi all,

I am new in the rest world. I have a big question, why people use the `flask-restful` or `flask-restplus` to writing the rest apis? I didn't see any advantages of that!

​

In my point of view, use Flask directly,

* you can reuse the original models, this is very convenient, if you change the models in the future, you don't need to change the api models... (I mean, in the case you also use Flask to build frontend. )
* you can use the `wtforms` to validate the form inputs. wtforms has a lot of Built-in validators. You can also create your own validators...
* `flask-restful` and `flask-restplus` are third party libraries, which are very possibly not to be maintained in the future...

/r/flask
https://redd.it/arr6za
Simple, clear and fast Web Crawler framework build on python3.6+, powered by asyncio.

## Features

* Useful http client out of box
* Things(request, response and item) can though pipelines(in async or not)
* Item extractor, it\`s easy to define and extract(by xpath, jpath or regex) one item we want from html, json or strings.
* Custom "ensure\_future" and "as\_completed" api provide a easy work flow

## Install

pip install ant\_nest

## Usage

Create one demo project by cli:

`>>> ant_nest -c examples`

Then we have a project:

`drwxr-xr-x 5 bruce staff 160 Jun 30 18:24 ants`

`-rw-r--r-- 1 bruce staff 208 Jun 26 22:59 settings.py`

Presume we want to get hot repos from github, let\`s create "examples/ants/example2.py":

from ant_nest import *
from yarl import URL


class GithubAnt(Ant):
"""Crawl trending repositories from github"""
item_pipelines = [
ItemFieldReplacePipeline(
('meta_content', 'star', 'fork'),
excess_chars=('\r', '\n',

/r/Python
https://redd.it/aru9lm
~8 years ago (I was ~14) I started this beautiful riddle and tonight i finally finished it!

/r/Python
https://redd.it/arv2qj
Got this book at pycaribbean yesterday!

/r/Python
https://redd.it/arvtmf
I need to learn Flask in 5 days for Hackathon. How do I go about this? All help is appreciated!

I have been incorporated into a hackathon team due to the untimely unavailability of a member. I have to learn flask in 5 days and implement our project in it. How can I effectively do this?

Edit: I have no prior web dev experience

/r/flask
https://redd.it/arvoyy
[AF] Best practices for multi-page forms?

Hi all,

As the complexity of my application grows, I'm noticing that I need to create forms that span multiple pages.

A simple use case I'm experiencing is when I have a form that requires a foreign key to another object (we'll call it Foo). However, my database has over 10,000 Foo records. What I would like to do is have a new screen which allows a user to search for a Foo record and return this information back to the original form screen without losing previously entered form data.

How do you all handle similar scenarios?

/r/flask
https://redd.it/ary049
[AF] Have no idea how to deal with this error: 'KeyError: <flask.cli.ScriptInfo object at [...]>'

Python 3.7.1
Flask==1.0.2

I've been using Miguel Grinberg's wonderful 'FLASK WEB DEVELOPMENT' as a reference guide when building a Social Media clone project.

I built some of it not completely following the flow of the book, so had some things he talks about later in the book set up already, but got to the point where it was time to re-structure my project as it had become quite large.

In the book, he talks about using an 'application factory' with a config.py file, and then calling from that when creating the app instance so you can use different configuration set-ups. Here is the config.py file, copied straight from the book:


import os
basedir = os.path.abspath(os.path.dirname(__file__))

class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'mysecretkey'
MAIL_SERVER = os.environ.get('MAIL_SERVER', 'smtp.googlemail.com')
MAIL_PORT = os.environ.get('MAIL_PORT', '587')
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS', 'true').lower() in \
['true', 'on', '1']
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')


/r/flask
https://redd.it/arzfgt
Jump Out of the Jupyter Notebook with nbconvert

Easily Convert Notebooks to Python Scripts and Sharable Files. I wrote a little guide to using nbconvert from the command line. Feedback welcome!

[https://towardsdatascience.com/jump-out-of-the-jupyter-notebook-with-nbconvert-7d4748960702](https://towardsdatascience.com/jump-out-of-the-jupyter-notebook-with-nbconvert-7d4748960702)

/r/IPython
https://redd.it/as0mal
Celery beat without separate dyno on Heroku

Currently have Django + RabbitMQ + Celery hosted on heroku for my production servers. My procfile is as follows:


web: gunicorn uw_api_project.wsgi --log-file -
worker1: celery -A uw_api_project worker -Q uw -l info --without-gossip --without-mingle --without-heartbeat
beat: celery -A uw_api_project worker -B

Is it not possible to run celery beat in the same dyno as worker1 on production? I've read in several places that `-B` or `--beat` flags are available only for development, however, I've tried running `--beat` as well as `-B` on the same worker as suggested in this [article](https://drdaeman.github.io/heroku-djcelery-example/) to no avail. Do I really need to pay for a another dyno on Heroku to manage celery beat?


/r/django
https://redd.it/as142s