<p>Sponsored by Techmeme Ride Home podcast: <a href="http://pythonbytes.fm/ride"><strong>pythonbytes.fm/ride</strong></a></p> <p>Special guests</p> <ul> <li><a href="https://twitter.com/carltongibson">Carlton Gibson</a></li> <li><a href="https://twitter.com/wsv3000">William Vincent</a></li> </ul> <p><strong>Brian #1:</strong> <a href="https://github.com/nbQA-dev/nbQA"><strong>nbQA : Quality Assurance for Jupyter Notebooks</strong></a></p> <ul> <li>Sent in by listener and Patreon supporter (woohoo!!!) Marco Gorelli.</li> <li>We’ve now talked about running black on Jupyter notebooks in the past (at least 2) shows?</li> <li>Marco’s recommendation is nbQA</li> <li>nbQA lets you run all this on notebooks: <ul> <li>black</li> <li>isort</li> <li>mypy</li> <li>flake8</li> <li>pylint</li> <li>pyupgrade to upgrade syntax </li> <li>doctest to check examples </li> </ul></li> <li>Run as a pre-commit hook</li> <li>Configure in pyproject.toml</li> <li>Also (from Marco) better than standalone black due to: <ul> <li>can run on a directory, not just one file at a time</li> <li>keeps diffs minimal and easier to read then black</li> <li>preserves trailing semicolons, as they are used to suppress output in notebooks</li> <li>supports most standard magic commands</li> </ul></li> <li>And the nbQA project is tested with …. drum roll …. pytest (of course)</li> </ul> <p><strong>Michael #2:</strong> <a href="https://surveys.jetbrains.com/s3/c6-python-developers-survey-2020"><strong>The PSF yearly survey is out, go take it now!</strong></a></p> <ul> <li>This is the fourth iteration of the official Python Developers Survey.</li> <li>The results of this survey serve as a major source of knowledge about the current state of the Python community</li> <li>Takes about 10 minutes</li> <li>They will randomly choose <strong>100 winners</strong> (from those who complete the survey in its entirety), who will each receive an amazing <strong>Python Surprise Gift Pack</strong>.</li> <li>Analysis is really well done, see the <a href="https://www.jetbrains.com/lp/python-developers-survey-2019/">2019 results</a>.</li> </ul> <p>Will #3: <strong>From Prototype to Production in Django</strong></p> <ul> <li>Django defaults to local/prototype settings initially when run <code>startproject</code> command. </li> <li><code>settings.py</code> file contains global configs for a project. What needs to change for production? <ul> <li><code>DEBUG</code> set to <code>False</code></li> <li><code>SECRET_KEY</code> actually secret and not in source control</li> <li><code>ALLOWED_HOSTS</code></li> <li>Database probably not SQLite </li> <li>Configure static/media files</li> <li>Change admin path away from <code>/admin</code></li> <li>User registration, typically use <a href="https://github.com/pennersr/django-allauth">django-allauth</a></li> </ul></li> <li>Environment variables preferred method to have local/production settings. <a href="https://github.com/sloria/environs">environs</a> is Will’s favorite 3rd party package but multiple others.</li> <li>Use <a href="https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/">Django deployment checklist</a> aka <code>python check</code> <code>--``deploy</code>, add HTTPS all over basically</li> <li><a href="https://djcheckup.com/pony/">DJ Checkup website</a></li> <li>What else? Testing, logging, performance, security, etc etc etc</li> <li><a href="https://learndjango.com/books/">Django for Professionals</a> book covers all of this and more including Docker</li> </ul> <p>Carlton #4: <strong>Deployment: Getting your app online</strong></p> <ul> <li>Deployment (and how hard it it) seem to come up almost every week on Django Chat. </li> <li>I think a lot about <em>The Deployment Gap</em> that exists: a new user finishes the Django tutorial, or the DRF tutorial or Will’s <a href="https://djangoforbeginners.com/">Django for Beginners book</a>, and they’re still <strong>a long way</strong> from being able to deploy. </li> <li>PaaS look like a good option. (Heroku/App Service/DO’s new one, and so on) but they’re a bit of a cul-de-sac (do you use that in America?) — you drive in, get to the end and then have to drive out again.</li> <li>On the other hand, DIY all looks far-too-scary™: there’s provisioning servers, <em>private clouds</em>, firewalls, permissions, block stores, objects stores, … — Argh! (On top of all the usual DNS, and all the rest of it.) <ul> <li><strong>Plus</strong> there’s a tendency I think towards fashion: you’d think you can’t possibly deploy without adopting a micro-service architecture, or a container orchestration platform. <strong>It’s too much</strong>.</li> <li>This is same as, <em>You couldn’t possibly use Django, Postgres… — you have to use the New Hotness™</em>. </li> </ul></li> <li>I think there’s a simpler story: start with a VM, a relational database, a simple network setup, and grow from there. There’s still moving parts, but it’s not <strong>that</strong> complex.</li> <li>I’m working on a tool for all this, <strong>Button</strong>. It’s coming in 2021. It’s a simpler deployment story. It’s part tool, part guide. It get’s you through the <em>Argh! It’s too scary bit.</em> </li> <li>You can sign up for early updates at https://btn.dev </li> </ul> <p><strong>Brian #5:</strong> <a href="https://allcontributors.org/docs/en/overview"><strong>All Contributors</strong></a> “This is a specification for recognizing contributors to an open source project in a way that rewards each and every contribution, not just code. The basic idea is this:</p> <blockquote> <p>Use the project README (or another prominent public documentation page in the project) to recognize the contributions of members of the project community.</p> </blockquote> <p>People are giving themselves and their free time to contribute to open source projects in so many ways, so we believe everyone should be praised for their contributions (code or not).”</p> <ul> <li>used by nbQA</li> <li>It is a specification for how to be consistent in listing contributors.</li> <li>Also includes an <a href="https://allcontributors.org/docs/en/emoji-key">Emoji Key</a>, to be used with contributors name (and optionally avatar) to denote the kind of contribution they’ve made: <ul> <li>💻 <code>code</code></li> <li>📖 <code>doc</code></li> <li>🎨 <code>design</code></li> <li>💡 <code>example</code></li> <li>🚧 <code>maintenance</code></li> <li>🔌 <code>plugin</code></li> <li>and many, many more</li> </ul></li> <li>And a <a href="https://allcontributors.org/docs/en/bot/overview">GitHub bot</a> to automate acknowledging contributors to your open source projects. <ul> <li>Uses natural language parsing to add people as contributors and add the appropriate emoji</li> </ul></li> <li>Also includes a cli for adding contributors, comparing GitHub contributors to your listed contributors, and more.</li> </ul> <p><strong>Michael #6:</strong> <a href="https://anitagraser.github.io/movingpandas/"><strong>MovingPandas</strong></a></p> <ul> <li>A Python library for handling movement data based on Pandas and GeoPandas</li> <li>It provides trajectory data structures and functions for analysis and visualization.</li> <li>MovingPandas development started as a QGIS plugin idea in 2018. But made more sense as its own library</li> <li>Features <ul> <li>Convert GeoPandas GeoDataFrames of time-stamped points into MovingPandas Trajectories and TrajectoryCollections</li> <li>Add trajectory properties, such as movement speed and direction</li> <li>Split continuous observations into individual trips</li> <li>Generalize Trajectories</li> <li>Aggregate TrajectoryCollections into flow maps</li> <li>Create static and interactive visualizations for data exploration</li> </ul></li> <li>MovingPandas makes it straightforward to compute movement characteristics, such as trajectory length and duration, as well as movement speed and direction.</li> <li>Example</li> </ul> <pre><code> df = pd.DataFrame([ {'geometry':Point(0,0), 't':datetime(2018,1,1,12,0,0)}, {'geometry':Point(6,0), 't':datetime(2018,1,1,12,6,0)}, {'geometry':Point(6,6), 't':datetime(2018,1,1,12,10,0)}, {'geometry':Point(9,9), 't':datetime(2018,1,1,12,15,0)} ]).set_index('t') gdf = gpd.GeoDataFrame(df, crs=CRS(31256)) traj = mpd.Trajectory(gdf, 1) </code></pre> <p><strong>Extras</strong></p> <p><strong>Carlton:</strong></p> <ul> <li>Listen to <a href="https://djangochat.com/">Django Chat</a></li> <li>Check out <a href="https://learndjango.com/">Will’s Tutorials and Books</a></li> <li>Sign up for early updates on <a href="https://btn.dev">Button</a></li> </ul> <p><strong>Michael:</strong></p> <ul> <li>Transcripts are back!</li> <li>Trying to live in <a href="https://duckduckgo.com/">DuckDuckGo land</a>. Crazy or smart? :)</li> <li>And remember to do your periodic <a href="https://takeout.google.com/">Google Takeout</a></li> <li>Deployed my first <a href="https://weather.talkpython.fm">Fast API web API & site</a></li> </ul> <p><strong>Joke:</strong></p> <p>“Give a person a program, frustrate them for a day. Teach them to program, frustrate them for a lifetime. 🙂” <em>(…unless you teach them to test at the same time. - Brian)</em></p> <p>The failed interview: “Sorry, we’re looking for someone aged 22-26… with 30 years of experience with Flask”</p>
from Planet Python
via read more
Subscribe to:
Post Comments (Atom)
TestDriven.io: Working with Static and Media Files in Django
This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...
-
Podcasts are a great way to immerse yourself in an industry, especially when it comes to data science. The field moves extremely quickly, an...
-
Graph traversal algorithms are used to perform various operations on a graph data structure. In this article, we will use the breadth-first ...
-
In an earlier tutorial we've already covered how to open dialog windows. These are special windows which (by default) grab the focus o...
No comments:
Post a Comment