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
Change the Jupyter Notebook font to Comic Sans

I know this might not be the place to ask this question, but I am a TA and I want to annoy my students. I found this guy [jupyter themes](https://github.com/dunovank/jupyter-themes) who changes the theme for the notebook, but to my chagrin, the themes available do not have comic sans. Would like to hear from you guys soon. Thank you!

/r/Python
https://redd.it/8a8jb8
Stream real-time data into Excel with Python!

Hi again /r/Python!

We're [Gridarrow](https://www.gridarrow.com/), a small startup from Amsterdam. [A few months ago](https://www.reddit.com/r/Python/comments/6u9psy/stream_realtime_data_into_excel_with_python/) we've announced our product here - a platform for streaming real-time data into Excel using Python scripts.

We're happy to let you know that we're open for Beta signups now! You can join us using a form on [our website](https://www.gridarrow.com/).

[Here's how the platform works](https://www.gridarrow.com/docs/getting-started/). Also go ahead a check out [our blog](https://www.gridarrow.com/blog/) where we showcase a couple of cool things you can do with Gridarrow.

For example:

- [Streaming real-time stock prices into Excel](https://www.gridarrow.com/blog/streaming-realtime-stock-prices-into-excel/)
- [Live news sentiment analysis using pysentiment](https://www.gridarrow.com/blog/financial-news-sentiment-analysis-using-xignite-and-pysentiment/)
- [Real-time Twitter map in your spreadsheet](https://www.gridarrow.com/blog/creating-a-realtime-twitter-map/)

We're really curious to hear your feedback!

Cheers!
The Gridarrow Team

/r/Python
https://redd.it/8a97gs
Its out!

/r/flask
https://redd.it/8abz4y
How can I make urls.py recognized as python file again? This way I can't use autocomplete and syntax helps

/r/django
https://redd.it/8acsvo
Free review copies of "Cracking Codes with Python" are available. (Physical print copies, not ebook!)

Cracking Codes with Python teaches complete beginners how to program in the Python programming language. The book features the source code to several ciphers and hacking programs for these ciphers.

If you'd like to receive a free print copy of Cracking Codes with Python, please email the author at al@inventwithpython.com. You'll receive a free ebook to read, and upon posting a review to Amazon, you will receive a complementary print review copy of the book.

Please post an honest review. You will receive a print book no matter what your rating is. The only requirements are that the review be a minimum of 100 words, you must live within the United States (due to shipping costs), and that you email me first before writing the review.

Because the book is under a Creative Commons license you can also, as always, read the HTML book online for free at https://inventwithpython.com/cracking/

/r/Python
https://redd.it/8acbs9
How do I use/ access a foreign key in views in Django?

I am making a programing etymology site in Django. It will have the etymology/history of programing terms. or

For example the term LET (in ECMA6):
> Let is a mathematical statement that was adopted by early programming languages like Scheme and Basic.

I am not clear on how to write views.

For instance, I want to return the term let and the text of the let terms. Let is in the Term table and text is in the Etymology table.

**EXAMPLE**

Here is what I would like to see returned for term_name=Let.

LET:

Let is a mathematical statement that was adopted by early programming languages like Scheme and Basic. Variables are considered low level entities not suitable for higher levels of abstraction, thus the desire of many language designers to introduce similar but more powerful concepts like in Clojure, F#, Scala, where let might mean a value, or a variable that can be assigned....



**MODELS**

Here are my models.

class Term(models.Model):
term_name=models.CharField(max_length=150)
term_type=models.CharField(max_length=150) #type of command
term_pub_date=models.DateTimeField('Term Pub Date')

def __str__(self):
return self.term_name

class Etymology(models.Model):
term = models.ForeignKey(Term, on_delete=models.CASCADE)
etymology_text=models.TextField()
classification=models.CharField(max_length=150) #prog or tool reference
etymology_votes = models.IntegerField(default=0)
# rating=
# user=
etymology_pub_date=models.DateTimeField('Ety date published')

def __str__(self):
return self.etymology_text[:50] + "..."


class Comment(models.Model):
etymology = models.ForeignKey(Etymology, on_delete=models.CASCADE)
comment_text= models.TextField()
comment_votes = models.IntegerField(default=0)
#rating=
#user=
comment_pub_date=models.DateTimeField('com pub date')

def __str__(self):
return self.comment_text[:50] + "..."

How do I write a view which accesses two tables at once. How would I write the view to return what I want to see from my models?

FYI:
Using Django 2.02 and Python 3.6. Also, I not highly experienced so simple


Citation:

JavaScript?, W. (2018). Why was the name 'let' chosen for block-scoped variable declarations in JavaScript?.

/r/django
https://redd.it/8ad8pe
[AF] Factoryboy and Foreign Keys

I'm using factoryboy to build factories (for testing) but I'm not sure what to do with the foreign keys. I have a scenario similar to this (using flask-sqlalchemy):

class User(db.Model):
id = db.Column(db.Integer, primary_key = True)
posts = db.relationship('Post', backref = 'author')

class Post(db.Model):
id = db.Column(db.Integer, primary_key = True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

Right now, I have implemented this:

class BaseFactory(SQLAlchemyModelFactory):
class Meta:
abstract = True
sqlalchemy_session = db.session

class UserFactory(BaseFactory):
id = Sequence (lambda n: n)
posts = SubFactory(PostFactory)
class Meta:
model = User

class PostFactory(BaseFactory):
id = Sequence (lambda n: n)
user_id = ????
class Meta:
model = Post

What goes into my `user_id` field?

/r/flask
https://redd.it/8a7db8
Are there any reasons to use Flask-Bcrypt over passlib with bcrypt?

I am used to using passlib with bcrypt to hash passwords. It seems like the Flask-Bcrypt extension is very popular to use with Flask, but are there any specific reasons I should use that over passlib? At a quick glance, they seem to do the same thing, but also low level encryption isn't really my strong area. Thanks for any advice.

/r/flask
https://redd.it/89xbdl
Suggestions regarding what to learn in Python for GUI Programming?

I am a beginner in python and want to learn GUI Programming, but am a little confused as to which library to choose, therefore I want suggestions regarding which library to choose to learn which is popular and has varied amount of functions to work on.

/r/Python
https://redd.it/8agrdx
Dynamical id's for WTForms

I'm rendering a template with a list of lists (df_list) as variable.

On that page I'm making a table where one of the cells is an input field that needs to have the same id as the string displayed in one of the other cells. I can accomplish this like so:

<form method="POST" action="/something">
{{ form.csrf_token }}
<table>
{% for line in df_list %}
<tr>
<td>{{ line[0] }}</td>
<td>{{ line[1] }}</td>
<td>{{ line[2] }}</td>
<td>{{ line[3] }}</td>
<td>{{ line[4] }}</td>
<td>{{ line[5] }}</td>
<td>{{ line[6] }}</td>
<td>
<input id="{{ line[0] }}" class="pick_date"></input>
</td>
</tr>
{% endfor %}
</table>
</form>

This works but I can't find a way to do something similar using WTForms.

Replacing the <input ...> line with something like this is obviously no good:

{{ form.name(id="{{ line[0] }}") }}

What would be a good way to dynamically assign id's to WTForms in this case?

**Edit: typos and clarification**


/r/flask
https://redd.it/89ybot
What are some amazing blogs related to Python?

I have followed Miguel Grinberg's blog ( https://blog.miguelgrinberg.com/ ) and Sentdex blog ( https://pythonprogramming.net/ ). I was looking for blogs that focus on a particular module entirely like Web development or Image Processing or GUI or anything related to Python.

/r/Python
https://redd.it/8aigrf
Recruiting statisticians/data analysts participants for a research study on career success

I am a graduate student conducting a research study about the skill and knowledge sets of statisticians/data analysts and their perceived career success. Participation involves filling out a questionnaire, which is expected to take approximately 10-15 minutes to complete. Participants must be 18 years old or older. If you are interested in participating, [click here]( https://usmep.co1.qualtrics.com/SE/?SID=SV_cw0L49DrDO04RsF&Q_JFE=0) to take the survey. If you have any questions or concerns, I can be reached at Harold.noble@eagles.usm.edu. Thank you very much for your consideration

/r/pystats
https://redd.it/8ahzj1