Where to begin with Python?
Hi everyone! I'm a CS student and so far all I have learned is C++ in most of my courses. During this upcoming summer I'd like to sit down and learn as much Python as I can, or that's my goal anyway. Do any of you recommend any Book, YouTube channel, Course, Website, or any good resource that you'd think is great for someone that knows some programming yet haven't touched Python. I know I can "Google" a lot of theses things, but maybe someone in here has a good tip, insight, advice, for me.
/r/Python
https://redd.it/87po0z
Hi everyone! I'm a CS student and so far all I have learned is C++ in most of my courses. During this upcoming summer I'd like to sit down and learn as much Python as I can, or that's my goal anyway. Do any of you recommend any Book, YouTube channel, Course, Website, or any good resource that you'd think is great for someone that knows some programming yet haven't touched Python. I know I can "Google" a lot of theses things, but maybe someone in here has a good tip, insight, advice, for me.
/r/Python
https://redd.it/87po0z
reddit
Where to begin with Python? • r/Python
Hi everyone! I'm a CS student and so far all I have learned is C++ in most of my courses. During this upcoming summer I'd like to sit down and...
My attempt at histogram_equalization (Digital Image Processing)
Does this seem correct? Is there anything I can do to improve speeds?
def histogram_equalization(image):
try:
assert len(image.shape) == 2
except ValueError as e: #what exception
image = imread(image)
assert len(image.shape) == 2
source, indicies, counts =np.unique(image, return_inverse= True, return_counts = True)
s_cdf = np.cumsum(counts).astype(np.float64)
s_cdf /= s_cdf[-1]
new_values = np.around(s_cdf * source).astype('uint8')
new_image = new_values[indicies].reshape(image.shape)
return new_image
/r/Python
https://redd.it/87o21t
Does this seem correct? Is there anything I can do to improve speeds?
def histogram_equalization(image):
try:
assert len(image.shape) == 2
except ValueError as e: #what exception
image = imread(image)
assert len(image.shape) == 2
source, indicies, counts =np.unique(image, return_inverse= True, return_counts = True)
s_cdf = np.cumsum(counts).astype(np.float64)
s_cdf /= s_cdf[-1]
new_values = np.around(s_cdf * source).astype('uint8')
new_image = new_values[indicies].reshape(image.shape)
return new_image
/r/Python
https://redd.it/87o21t
reddit
My attempt at histogram_equalization (Digital Image... • r/Python
Does this seem correct? Is there anything I can do to improve speeds? def histogram_equalization(image): try: assert...
28,165 thousand django running servers are exposed on the internet, many are showing secret API keys, database passwords, amazon AWS keys.
https://twitter.com/6IX7ine/status/978598496658960384
/r/django
https://redd.it/87qcf4
https://twitter.com/6IX7ine/status/978598496658960384
/r/django
https://redd.it/87qcf4
Twitter
Fábio Castro 🦄
28,165 thousand django running servers are exposed on the internet, many are showing secret API keys, database passwords, amazon AWS keys. A small line http GET http://54.251.149.60:8081/ --body | grep 'DATABASE_URL\|Mysql\|AWS' #Shodan #django #hacking #cybersecurity…
Why table shows no data using a custom table template in django-tables2 ?
https://stackoverflow.com/questions/49524134/why-table-shows-no-data-using-a-custom-table-template-in-django-tables2
/r/djangolearning
https://redd.it/87niqk
https://stackoverflow.com/questions/49524134/why-table-shows-no-data-using-a-custom-table-template-in-django-tables2
/r/djangolearning
https://redd.it/87niqk
Stackoverflow
Why table shows no data using a custom table template in django-tables2?
I am using django-tables to create a table from my model to display it on a page.
I have created the folowing tables.py file:
class OpenBetsTable(tables.Table):
class Meta:
model = B...
I have created the folowing tables.py file:
class OpenBetsTable(tables.Table):
class Meta:
model = B...
Building RESTful APIs and using Websockets (3 hour video course)
Hey everyone,
I don't post here too often but I'm the author behind the [Build a SAAS App with Flask course](https://buildasaasappwithflask.com/).
I just wanted to let you know that I recently added a big free update to that course which covers building a RESTful API and even hooking up websockets too. If you're wondering what tech stack is used, it includes Flask, Docker, Postgres, Flask-Classful, Flask-JWT-Extended, Marshmallow and Pusher.
**It's a free update for anyone who bought the main course at https://buildasaasappwithflask.com/**.
If your scroll down to about the middle of the page there's a 5 minute demo video showing what we'll build. Think of this as a companion to the main course.
Thanks so much for the support over the years, and this is only 1 of a few large free updates that I will be adding to the course over time.
If you have any questions, please don't hesitate to ask.
/r/flask
https://redd.it/87sacz
Hey everyone,
I don't post here too often but I'm the author behind the [Build a SAAS App with Flask course](https://buildasaasappwithflask.com/).
I just wanted to let you know that I recently added a big free update to that course which covers building a RESTful API and even hooking up websockets too. If you're wondering what tech stack is used, it includes Flask, Docker, Postgres, Flask-Classful, Flask-JWT-Extended, Marshmallow and Pusher.
**It's a free update for anyone who bought the main course at https://buildasaasappwithflask.com/**.
If your scroll down to about the middle of the page there's a 5 minute demo video showing what we'll build. Think of this as a companion to the main course.
Thanks so much for the support over the years, and this is only 1 of a few large free updates that I will be adding to the course over time.
If you have any questions, please don't hesitate to ask.
/r/flask
https://redd.it/87sacz
Nick Janetakis
Learn to Build Web Applications with Flask and Docker
A video course where you'll Learn how to build a real world web application with Flask, Celery, Redis, PostgreSQL and Stripe.
Jupyter keeps breaking.
I am brand new to python and I am trying to use the jupyter notebook as I work through an Edx course on Python. The notebooks work, maybe four or five times before they no longer work. I've tried refreshing the book, but I'll be half-way through coding assignment and consistently, the notebooks will just stop working.
Any thoughts on why? It would be a tremendous time saver if I could do the coursework without having to start a new notebook every five minutes.
Thanks!
/r/IPython
https://redd.it/87t1h4
I am brand new to python and I am trying to use the jupyter notebook as I work through an Edx course on Python. The notebooks work, maybe four or five times before they no longer work. I've tried refreshing the book, but I'll be half-way through coding assignment and consistently, the notebooks will just stop working.
Any thoughts on why? It would be a tremendous time saver if I could do the coursework without having to start a new notebook every five minutes.
Thanks!
/r/IPython
https://redd.it/87t1h4
reddit
Jupyter keeps breaking. • r/IPython
I am brand new to python and I am trying to use the jupyter notebook as I work through an Edx course on Python. The notebooks work, maybe four or...
PyCharm 2018.1 Out Now: Partial commits, Python 3.7
https://jetbrains.com/pycharm/whatsnew
/r/Python
https://redd.it/87skgp
https://jetbrains.com/pycharm/whatsnew
/r/Python
https://redd.it/87skgp
JetBrains
What’s New in PyCharm 2025.2
Introducing AI Toolkit, as well as an important update to PyCharm Community, improvements to Jupyter notebooks, and more.
Using pytubes to read lots of data into numpy
https://medium.com/@stestagg/analysing-1-4-billion-rows-with-python-6cec86ca9d73
/r/Python
https://redd.it/87tyzb
https://medium.com/@stestagg/analysing-1-4-billion-rows-with-python-6cec86ca9d73
/r/Python
https://redd.it/87tyzb
Medium
Analysing 1.4 billion rows with python
Using pytubes, numpy and matplotlib
Soccer and Machine Learning: 2 hot topics for 2018
https://www.uruit.com/blog/2018/02/16/soccer-and-machine-learning-tutorial/
/r/pystats
https://redd.it/87tb9c
https://www.uruit.com/blog/2018/02/16/soccer-and-machine-learning-tutorial/
/r/pystats
https://redd.it/87tb9c
Blog - Nearshore Software & Staffing | UruIT
Machine Learning Tutorial: applying ML to Fifa 2018
The 2018 FIFA Football World Cup and Machine Learning are buzzwords that everybody talks about. So, what better way to start off this 2018 than by writing a post that combines these two hot topics in a machine learning tutorial!
Django best practices questions
So i have been building apps since 2012, and now im starting on a larger project with Python, and django + DRF.
I have used various langauges, but never done anything serious with python before. So im uncertain of some choises and hope i dont make the wrong ones in the start of the project.
Would love to get some advice from you guys!
1) Should i have a models ”app” and keep all models there, or should each app have their own models?
2) When working with DRF is it best to use ApiView, function views or more generic class based views. Note i probably will have to have custom logic in what data is returned, this app will be a crm like app, with lots of real time stuff.
3) How much should i separate my code into apps? Is there a good rule of thumb to remember when i should create a new app?
4) I found this https://github.com/gothinkster/django-realworld-example-app is it s good example how things should be setup?
Thank you for reading!
/r/django
https://redd.it/87p2m6
So i have been building apps since 2012, and now im starting on a larger project with Python, and django + DRF.
I have used various langauges, but never done anything serious with python before. So im uncertain of some choises and hope i dont make the wrong ones in the start of the project.
Would love to get some advice from you guys!
1) Should i have a models ”app” and keep all models there, or should each app have their own models?
2) When working with DRF is it best to use ApiView, function views or more generic class based views. Note i probably will have to have custom logic in what data is returned, this app will be a crm like app, with lots of real time stuff.
3) How much should i separate my code into apps? Is there a good rule of thumb to remember when i should create a new app?
4) I found this https://github.com/gothinkster/django-realworld-example-app is it s good example how things should be setup?
Thank you for reading!
/r/django
https://redd.it/87p2m6
GitHub
GitHub - gothinkster/django-realworld-example-app
Contribute to gothinkster/django-realworld-example-app development by creating an account on GitHub.
Flask-Security with Flask-Admin, how to use two different login forms?
I am building a flask boilerplate site and I am using flask admin so I can create users (its an "internal" site with no registrations).
So I have a login form where the admin can login and create user, but I also want to have a regular login where users can log into the site.
They're pretty much the same login just a different form and look? Is that possible or should I have them route to the same form and then have non admin redirect to the home page and the admin can redirect to the admin backend?
Right now I am using a context processor to hook into flask-admin:
# define a context processor for merging flask-admin's template context into the
# flask-security views.
@security.context_processor
def security_context_processor():
return dict(
admin_base_template=admin.base_template,
admin_view=admin.index_view,
h=admin_helpers,
get_url=url_for
)
So that the url_for('security.login') will direct you to /mysite/admin/login?
Is there a way to break it so that, url_for('security.admin.login') directs to /mysite/admin/login
and url_for('security.login') directs to /mysite/login?
Something along those lines.
/r/flask
https://redd.it/87v277
I am building a flask boilerplate site and I am using flask admin so I can create users (its an "internal" site with no registrations).
So I have a login form where the admin can login and create user, but I also want to have a regular login where users can log into the site.
They're pretty much the same login just a different form and look? Is that possible or should I have them route to the same form and then have non admin redirect to the home page and the admin can redirect to the admin backend?
Right now I am using a context processor to hook into flask-admin:
# define a context processor for merging flask-admin's template context into the
# flask-security views.
@security.context_processor
def security_context_processor():
return dict(
admin_base_template=admin.base_template,
admin_view=admin.index_view,
h=admin_helpers,
get_url=url_for
)
So that the url_for('security.login') will direct you to /mysite/admin/login?
Is there a way to break it so that, url_for('security.admin.login') directs to /mysite/admin/login
and url_for('security.login') directs to /mysite/login?
Something along those lines.
/r/flask
https://redd.it/87v277
reddit
Flask-Security with Flask-Admin, how to use two... • r/flask
I am building a flask boilerplate site and I am using flask admin so I can create users (its an "internal" site with no registrations). So I have...
Using Flask with GraphQL
Hey guys,
I'm trying to create a small application using GraphQL and Flask. I'm currently running into issues getting it all working together. I might be doing something very silly as I'm quite new to GraphQL but I keep getting the following error:
{
"errors": [
{
"message": "mutate() got an unexpected keyword argument 'name'",
"locations": [
{
"line": 2,
"column": 3
}
]
}
],
"data": {
"createUser": null
}
}
The code that I have in my schema.py is:
import graphene
from graphene import relay
from graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType
from models import User as UserModel
from sqlalchemy import and_
from app import db
class Users(SQLAlchemyObjectType):
class Meta:
model = UserModel
interfaces = (relay.Node, )
# Used to Create New User
class createUser(graphene.Mutation):
class Arguments:
name = graphene.String()
age = graphene.Int()
user = graphene.Field(Users)
@classmethod
def mutate(cls, _, args, context, info):
user = UserModel(name=args.get('name'), age=args.get('age'))
db.session.add(user)
db.session.commit()
ok = True
return createUser(user=user)
class Query(graphene.ObjectType):
node = relay.Node.Field()
user = SQLAlchemyConnectionField(Users)
class MyMutations(graphene.ObjectType):
create_user = createUser.Field()
schema = graphene.Schema(query=Query, mutation=MyMutations, types=[Users])
I was trying to follow: https://github.com/Getmrahul/Flask-Graphene-SQLAlchemy but I was trying to use flask-sqlalchemy also. Any help would be greatly appreciated as I'm rather stumped. Thank you!
/r/flask
https://redd.it/87t9m5
Hey guys,
I'm trying to create a small application using GraphQL and Flask. I'm currently running into issues getting it all working together. I might be doing something very silly as I'm quite new to GraphQL but I keep getting the following error:
{
"errors": [
{
"message": "mutate() got an unexpected keyword argument 'name'",
"locations": [
{
"line": 2,
"column": 3
}
]
}
],
"data": {
"createUser": null
}
}
The code that I have in my schema.py is:
import graphene
from graphene import relay
from graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType
from models import User as UserModel
from sqlalchemy import and_
from app import db
class Users(SQLAlchemyObjectType):
class Meta:
model = UserModel
interfaces = (relay.Node, )
# Used to Create New User
class createUser(graphene.Mutation):
class Arguments:
name = graphene.String()
age = graphene.Int()
user = graphene.Field(Users)
@classmethod
def mutate(cls, _, args, context, info):
user = UserModel(name=args.get('name'), age=args.get('age'))
db.session.add(user)
db.session.commit()
ok = True
return createUser(user=user)
class Query(graphene.ObjectType):
node = relay.Node.Field()
user = SQLAlchemyConnectionField(Users)
class MyMutations(graphene.ObjectType):
create_user = createUser.Field()
schema = graphene.Schema(query=Query, mutation=MyMutations, types=[Users])
I was trying to follow: https://github.com/Getmrahul/Flask-Graphene-SQLAlchemy but I was trying to use flask-sqlalchemy also. Any help would be greatly appreciated as I'm rather stumped. Thank you!
/r/flask
https://redd.it/87t9m5
GitHub
Getmrahul/Flask-Graphene-SQLAlchemy
A demo project for Flask + GraphQL (With Graphene & SQLAlchemy) - Getmrahul/Flask-Graphene-SQLAlchemy
Trouble understanding syntax with filtering Django models
I see this:
file_obj = Results.objects.using('tool').filter(id=fooid)
I know it is filtering a collection of Results by fooid. I'm not sure yet what 'tool' is referring to. What does the using keyword do here?
/r/djangolearning
https://redd.it/87uvg2
I see this:
file_obj = Results.objects.using('tool').filter(id=fooid)
I know it is filtering a collection of Results by fooid. I'm not sure yet what 'tool' is referring to. What does the using keyword do here?
/r/djangolearning
https://redd.it/87uvg2
reddit
Trouble understanding syntax with filtering... • r/djangolearning
I see this: file_obj = Results.objects.using('tool').filter(id=fooid) I know it is filtering a collection of Results by fooid. I'm not sure yet...
After building my first ever real-world website a couple of months back today I launched another website to share my experiences with other programming enthusiasts.
https://usefulpython.com/blog/overview-how-to-build-this-website/
/r/django
https://redd.it/87w9p7
https://usefulpython.com/blog/overview-how-to-build-this-website/
/r/django
https://redd.it/87w9p7
Usefulpython
Overview and Prerequisites - How to Build This Website - Part 1 | Useful Python - Wielding Python for Fun and Productivity
Hello folks! This is the first part of a series of articles in which I willexplain how to build a website — from absolute ground zero to the finalend game o...
import-pypi - one dependency to rule them all.
https://github.com/miedzinski/import-pypi
/r/Python
https://redd.it/87zz4d
https://github.com/miedzinski/import-pypi
/r/Python
https://redd.it/87zz4d
GitHub
miedzinski/import-pypi
One dependency to rule them all. Contribute to miedzinski/import-pypi development by creating an account on GitHub.
Static files dont work on pythonanywhere, even though i set them up correctly and use collectstatic
Hello... so, its been so annoying please help..
I created new django site on pythonanywhere.com but admin site loads without style.
I put these settings in settings.py file:
STATIC_URL = '/static/'
STATIC_ROOT ='static'
I used python manage.py collectstatic command and it created new admin folder (with css, js etc.) int my static folder.
BUT ADMIN SITE IS STILL WITHOUT STYLES. WHAT IS THIS
please help
p.s. im using virutalenv created with virtualwrapper
p.s.s. its working if i put /static/ folder into Static Files on pythonanywhere.com web panel. But tutorials said thats its a bad way to do this. HELP
/r/djangolearning
https://redd.it/87zfl4
Hello... so, its been so annoying please help..
I created new django site on pythonanywhere.com but admin site loads without style.
I put these settings in settings.py file:
STATIC_URL = '/static/'
STATIC_ROOT ='static'
I used python manage.py collectstatic command and it created new admin folder (with css, js etc.) int my static folder.
BUT ADMIN SITE IS STILL WITHOUT STYLES. WHAT IS THIS
please help
p.s. im using virutalenv created with virtualwrapper
p.s.s. its working if i put /static/ folder into Static Files on pythonanywhere.com web panel. But tutorials said thats its a bad way to do this. HELP
/r/djangolearning
https://redd.it/87zfl4
reddit
Static files dont work on pythonanywhere, even... • r/djangolearning
Hello... so, its been so annoying please help.. I created new django site on pythonanywhere.com but admin site loads without style. I put these...
Submit flask application to PyPi
I would like to submit my flask application to PyPi, so that other users will be able to use the application themselves. I know how to write a setup.py file. But I'd like to know how the user would start the server. Should I create an entry point or is there a better solution for that?
/r/flask
https://redd.it/8810jg
I would like to submit my flask application to PyPi, so that other users will be able to use the application themselves. I know how to write a setup.py file. But I'd like to know how the user would start the server. Should I create an entry point or is there a better solution for that?
/r/flask
https://redd.it/8810jg
reddit
Submit flask application to PyPi • r/flask
I would like to submit my flask application to PyPi, so that other users will be able to use the application themselves. I know how to write a...
Can I use Jupyterhub with ipyleaflet
I have Hadoop / Spark infrastructure on an isolated (from www) cluster. The edge node should run a Jupyterhub server where users can start notebooks from. Is it easily possible for the user (within his frontend / browser) to use ipyleaflet or other map tools or do I have to grant the server access to the www?
/r/IPython
https://redd.it/87zifl
I have Hadoop / Spark infrastructure on an isolated (from www) cluster. The edge node should run a Jupyterhub server where users can start notebooks from. Is it easily possible for the user (within his frontend / browser) to use ipyleaflet or other map tools or do I have to grant the server access to the www?
/r/IPython
https://redd.it/87zifl
reddit
Can I use Jupyterhub with ipyleaflet • r/IPython
I have Hadoop / Spark infrastructure on an isolated (from www) cluster. The edge node should run a Jupyterhub server where users can start...
[P] Leela Chess Zero: The fork of Leela Zero for chess, an open-source distributed effort to reproduce Deepmind's AlphaZero.
I think most of the people here followed Deepmind's AlphaGo, then AlphaGoZero and finally AlphaZero's achievements. However Google did not release the weights for all thoses networks, so a community has formed trying to reproduce and maybe improve the AlphaZero engine.
To do this, a distributed effort to play self-play games has started, and the training is done on a single powerful computer (It can update the weights in about 5 hours currently).
You can see the self-play ELO curve (not representative of real ELO) on the [website](http://lczero.org/).
If you want to help the project by sharing your GPU/CPU, think about following the instructions on the "Getting Started" section of the website.
As of now, it would take about 400 days to reach the 44.000.000 games played by Deepmind, but that could change thanks to you!
Some useful links to learn more and talk about the project:
* Try playing her yourself! (all calculations done server-side): http://play.lczero.org/
* Website: http://lczero.org
* Getting started: https://github.com/glinscott/leela-chess/wiki/Getting-Started
* GitHub: https://github.com/glinscott/leela-chess/
* Discord: https://discord.gg/pKujYxD
* Forum: https://groups.google.com/forum/#!forum/lczero
Also for some fancy stats here is her learning to castle:
https://i.imgur.com/J8t7bf4.png
Her learning not to move the king early (not including castling):
https://i.imgur.com/aWqOsNg.png
Some piece movements from one of the latests gen: https://i.imgur.com/C5SAZs6.png
Other stats (such as openings) can be found here: https://github.com/glinscott/leela-chess/issues/166
/r/MachineLearning
https://redd.it/88035j
I think most of the people here followed Deepmind's AlphaGo, then AlphaGoZero and finally AlphaZero's achievements. However Google did not release the weights for all thoses networks, so a community has formed trying to reproduce and maybe improve the AlphaZero engine.
To do this, a distributed effort to play self-play games has started, and the training is done on a single powerful computer (It can update the weights in about 5 hours currently).
You can see the self-play ELO curve (not representative of real ELO) on the [website](http://lczero.org/).
If you want to help the project by sharing your GPU/CPU, think about following the instructions on the "Getting Started" section of the website.
As of now, it would take about 400 days to reach the 44.000.000 games played by Deepmind, but that could change thanks to you!
Some useful links to learn more and talk about the project:
* Try playing her yourself! (all calculations done server-side): http://play.lczero.org/
* Website: http://lczero.org
* Getting started: https://github.com/glinscott/leela-chess/wiki/Getting-Started
* GitHub: https://github.com/glinscott/leela-chess/
* Discord: https://discord.gg/pKujYxD
* Forum: https://groups.google.com/forum/#!forum/lczero
Also for some fancy stats here is her learning to castle:
https://i.imgur.com/J8t7bf4.png
Her learning not to move the king early (not including castling):
https://i.imgur.com/aWqOsNg.png
Some piece movements from one of the latests gen: https://i.imgur.com/C5SAZs6.png
Other stats (such as openings) can be found here: https://github.com/glinscott/leela-chess/issues/166
/r/MachineLearning
https://redd.it/88035j
play.lczero.org
Play against LC0 !
LCPlay - Play against LCZero from your browser
A great course for not only beginners but for people who'd like to do a quick Django refresher. Even I'm working with Django for a while already, I learned one or two new hints that will help me to improve my code in the future.
http://www.certifiedonlinecourses.website/the-ultimate-beginners-guide-to-django-python-web-dev-website
/r/django
https://redd.it/88515h
http://www.certifiedonlinecourses.website/the-ultimate-beginners-guide-to-django-python-web-dev-website
/r/django
https://redd.it/88515h
Udemy
The Ultimate Beginner's Guide to Django 1.11 | Udemy
Learn how to make and publish websites with Django and Python. We'll make three complete apps and publish one online.