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
Updating Plotly Version in Python

I am having trouble trying to update to the latest Plotly version of 2.5.1. I have tried using the methods below in terminal for my Mac, but whenever I check Jupyter, my version is still 2.3.0.

pip install plotly==2.5.1


pip install plotly --upgrade

/r/IPython
https://redd.it/8cgqfq
How do I join a model after using `.objects.values()`?

I'm making a custom Django `manage.py` command. Here is the part of it relevant to my question.

Model = apps.get_model(app_label="my_app", model_name="MyModel")
x = Model.objects.values(*options["fields"].split('|')):


I want to join `Model` with another model, `SomeOtherModel`. `Model` has a foreign key field named `fk` that connects to the primary key for `SomeOtherModel`. How do I modify my code above to join `Model` with `SomeOtherModel`? Or should I join before running `objects.values()`?

/r/django
https://redd.it/8chxuj
Python for Good

I wanted to let everyone know about Python for Good, a Python event that is happening in the Portland, Oregon area. Put simply, we get a bunch of pythonistas (along with anyone else interested in doing good) and we gather for a long weekend (Thurs - Sun) of using our awesome skills to build apps for social and civic good organizations. Our theme for this year is children and families and some of the places we'll be helping this year include a homeless shelter, numerous organizations that help children, and many more amazing and worthwhile organizations.

The event is all inclusive, meaning that we stay in university dorms, all the food is provided and we have pretty great internet too. Our days are filled with hacking and our evenings are full of excellent camaraderie -- playing boardgames, video games, karaoke, werewolf, cards and lots of excellent socializing!

We are excited to announce that we're going to be once again holding the event at Reed College from July 26th to the 29th.

You can find more information about this years' event here: http://pythonforgood.org/attend Here is a list of the most frequently asked questions here: http://pythonforgood.io/faq

I'd be delighted to answer any questions.

Happiness,

Sean (and the Python for Good team)

/r/Python
https://redd.it/8ciq36
Solid examples using *args and **kwargs

I have seen these in various snippets of code. I am looking for some really good use case examples.

/r/Python
https://redd.it/8ci7qw
Flask-Restful API Help? POST method is not allowed

Hi,

I created a Flask-Restful API but when creating a post method like so

class Create(Resource):
def post(self):
etc etc

api.add_resource(Create,api/Create)

It errors out saying the method is not allowed.. but it works when I have something like this

@app.route("/signup/<username>,<password>", methods = ['GET', 'POST'])
def signup(username, password):

Can anybody assist? How do I allow the POST method using the first method?


/r/flask
https://redd.it/8chql1
New stable release of PySolFC — an open-source collection of over 1,000 card Solitaire/Mahjong games

[PySolFC](http://pysolfc.sourceforge.net/) is a free and open-source collection of over 1,000 card Solitaire and Mahjong games with many features and solver/analysis tools. It is almost [20 years old](http://solitaire.vegard2.net/pysol.html), and the current development efforts are concentrated on [the GitHub repository](https://github.com/shlomif/PySolFC).

The PySolFC developers are happy to announce a new stable release, 2.2.0, of PySolFC (the last one was in distant 2009!). Among the new features are:

* Compatibility with both Python 3.x and Python 2.7.
* Support for the Kivy user-interface toolkit, for Android devices and other systems.
* A Microsoft Windows binary installer.
* Support for dealing all [Freecell Pro deals](http://fc-solve.shlomifish.org/faq.html#what_are_ms_deals) by specifying "ms100000", or similar, as the seed.
* Support for the [Black Hole and All in a Row solver](http://www.shlomifish.org/open-source/projects/black-hole-solitaire-solver/) was added.
* Test suite and [CI](https://en.wikipedia.org/wiki/Continuous_integration) have been added to the repository.
* The code now passes [flake8](https://pypi.python.org/pypi/flake8) validation.

You can find [download links](https://sourceforge.net/projects/pysolfc/files/PySolFC/) for current Windows, source code, and Android versions.
Packages for Linux/BSD/etc. distributions and operating systems should be made
available soon from the downstream packagers.

Future plans:

* Vector-based fully scalable cards and graphics
* Large-scale cardsets for HD displays
* An online, WWW-based version

If you want to help, we need:

* Programmers
* Graphic designers who would help with improving the app’s look
* People to help with documentation and translations
* People who would spread the word
* Testers / QA people
* Monetary donations - see [this page](http://www.shlomifish.org/meta/how-to-help/)

We will gladly answer any questions!

Remember that apart from this thread you can also contact us using the [FOSS Card Games group](https://groups.google.com/forum/#!forum/foss-card-games), and using the ##pysol chat room on [Freenode](http://freenode.net/) (note the double octothorpe/hash-sign/pound-sign).

A final note is that while we are using GitHub for version control, and accept
pull requests and issue reports, we are still hosting the main site and the
downloads on SourceForge.net. See [the explanation](https://www.reddit.com/r/Python/comments/8237i3/help_is_needed_in_preparing_a_windows_binary/dv84xxu/)
for details.


/r/Python
https://redd.it/8cnoou
How can I dynamically change the file extension in a relative link from IPYNB to HTML when downloading a notebook as HTML?

I currently have a line inside a notebook (File1.ipynb):

[File 2](File2.ipynb)

When downloading both the files as HTML, this link is hard-coded, and hence when I click on the link in the generated *File1.html*, it can't find the file, because it refers to ipynb and not to html.

I could try:

* using sed to replace all occurrences of ipynb with html
* hard-coding html inside the notebook, which will prevent me from using the links when I'm editing the notebook.
But, is there an alternative?

Is there, perhaps, a way to specify two links inside the notebook such that if the browser fails to find the first one, it'll try the second? I tried searching for such a method. I couldn't find it.

/r/IPython
https://redd.it/8ct3ia
jQuery/AJAX get Request format?

I've got a post request working pretty well

$.post('/discount', {
time_left: distance / 60000,
ban_id: id
})

So say for example, with my get request, all I want to do is actually grab some data from Python Flask, namely in my /discount route I have a variable named d_code which is my discount code. All I simply want to do is grab this variable and in the function of the GET request, I want to change the innerHTML of a paragraph just to show the discount code.

Fairly simple, but I don't really understand how to do the get request correctly.


Bonus: Do you think a flask app with gunicorn can handle 10k-100k users a day? Hosted on Heroku.


/r/flask
https://redd.it/8crflf
[R] Multimodal Unsupervised Image-to-Image Translation

/r/MachineLearning
https://redd.it/8cram8