Tuesday, February 1, 2022

PyCoder’s Weekly: Issue #510 (Feb. 1, 2022)

#510 – FEBRUARY 1, 2022
View in Browser »

The PyCoder’s Weekly Logo


What Is a JIT and How Can Pyjion Speed Up Your Python?

How can you can speed up Python? Have you thought of using a JIT (Just-In-Time Compiler)? This week on the show, we have Real Python author and previous guest Anthony Shaw to talk about his project Pyjion, a drop-in JIT compiler for CPython 3.10.
REAL PYTHON podcast

10 Unknown Security Pitfalls for Python

“In this blog post, we share 10 security pitfalls we encountered in real-world Python projects. We chose pitfalls that we believe are less known in the developer community.”
DENNIS BRINKROLF

Monitor and Optimize Python Application Uptime and Trace App Requests in Real Time With Datadog APM

alt

Trace requests across service boundaries and identify latency and other potential errors with end-to-end application tracing. Datadog’s unified platform enables you to correlate traces with related metrics and logs for fast troubleshooting. Track Python app performance by trying Datadog APM out →
DATADOG sponsor

Draw the Mandelbrot Set in Python

In this tutorial, you’ll visualize the famous Mandelbrot set using Python’s Matplotlib and Pillow libraries. You’ll learn how to draw the fractal in black and white, grayscale, and color.
REAL PYTHON

Apple Removes Python 2.7 in macOS Monterey 12.3

“Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead.” Also see the related discussion on Hacker News.
APPLE.COM

Black, the Python Code Formatter, Is Stable

The popular Python auto-formatter Black is finally non-beta software. Related discussion on Hacker News and Black’s stability policy doc.
HACKER NEWS

Django Security Releases Issued: 4.0.2, 3.2.12, and 2.2.27

Includes fixes for a possible XSS via debug template tag and a denial-of-service possibility in file uploads.
DJANGO SOFTWARE FOUNDATION

Discussions

Should PyPI Deprecate .egg Uploads?

.egg uploads make up less than 1% of built distribution uploads in Dec 2021. Do you still build or install eggs, or maintain a tool that supports eggs?
DUSTIN INGRAM

Python Jobs

Senior Python Engineer (Anywhere)

Flashpoint

Senior Backend Engineer Django (UK, Europe)

Datapane

Backend Software Engineer (Anywhere)

Catalpa International

Senior Full-Stack Web Developer (Anywhere)

MonetizeMore

Python Engineer Web Scraping (Asia, TX, America)

NewsCatcher

Python Trainer (Jakarta, Indonesia)

Physikalisch-Technische Bundesanstalt

More Python Jobs >>>

Articles & Tutorials

Looping With Python enumerate()

Once you learn about for loops in Python, you know that using an index to access items in a sequence isn’t very Pythonic. So what do you do when you need that index value? In this course, you’ll learn all about Python’s built-in enumerate(), where it’s used, and how you can emulate its behavior.
REAL PYTHON course

PySide2 vs PySide6: What Are the Differences, and Is It Time to Upgrade?

If you are already developing Python GUI apps with PySide2, you might be asking yourself whether it’s time to upgrade to PySide6 and use the latest version of the Qt library.
MARTIN FITZPATRICK

Data Elixir: Data Science Newsletter

Data Elixir is a free newsletter that curates intermediate and advanced data science content from around the web. Covers analytics, machine learning, data visualization, analytics, and strategy →
DATA ELIXIR sponsor

The Fastest Way to Read a CSV in Pandas

This article covers: Pandas’ default CSV reading, the faster, more parallel CSV reader introduced in v1.4, and a different approach that can make things even faster.
ITAMAR TURNER-TRAURING

Executable Docs

It’s common to include interactive Python sessions inside documentation. With a small script we can turn these docs into Jupyter notebooks and serve them instantly.
IVO HOUBRECHTS • Shared by Ivo Houbrechts

Raining Outside? Build a Weather CLI App With Python

In this tutorial, you’ll write a nicely formatted Python CLI app that displays information about the current weather in any city you provide the name for.
REAL PYTHON

Find and Fix Performance Issues Fast With Scout APM

Scout APM is an application performance monitoring tool that ties performance anomalies directly to endpoints, saving developers hours of time spent on troubleshooting and debugging. Start your free trial today to see if Scout APM is right for you!
SCOUT APM sponsor

Projects & Code

Events

PyCascades Remote 2020

February 5 to February 7, 2022
PYCASCADES.COM


Happy Pythoning!
This was PyCoder’s Weekly Issue #510.
View in Browser »

alt

[ Subscribe to 🐍 PyCoder’s Weekly πŸ’Œ – Get the best Python news, articles, and tutorials delivered to your inbox once a week >> Click here to learn more ]



from Planet Python
via read more

PyCharm: Tutorial: Developing FastAPI Applications using K8s & AWS

We’re happy to announce the new PyCharm Guide tutorial by Mukul Mantosh, this time on FastAPI, Kubernetes, and AWS. In the video below he talks to Paul Everitt and shares a sneak peek at what you should expect from this amazing — almost 6 hours long — course. Let’s take a quick look!

REST APIs In The Cloud

In this free tutorial, you will build a sample e-commerce application with everything along the way and then deploy it to AWS with Kubernetes. Here’s what it looks like:

  • Introducing FastAPI, a modern, fast (high-performance), web framework
  • Setting up FastAPI project type in PyCharm Professional
  • Setting up the database connection and migrations
  • Implementing the REST APIs with routing and CRuD
  • Configuring Celery & Redis with FastAPI
  • Integrating FastAPI with JWT Tokens
  • Writing Unit Tests using Pytest & Asyncio
  • Writing K8s manifests & deploying in minikube
  • Deploying application using EKS, RDS, ElastiCache, Route53 & AWS Certificate Manager
  • Combine your K8s manifests into a single package using Helm Charts

Each of the 17 sections includes a narrated video demonstration, text explaining everything, and working code snippets.

Start now!

Previous Tutorials

This isn’t the first long-form tutorial series from Mukul. He’s done two previously on AWS in the PyCharm Guide:



from Planet Python
via read more

Wingware: Wing Python IDE Version 8.1.3 - February 1, 2022

Wing 8.1.3 adds support for using Unreal Engine with Wing, writes a preconfigured wingdbstub.py when creating new projects, expands Run Arguments and other dialog fields, correctly finds printers on Linux, and fixes a number of code analysis problems and other minor issues.

See the change log for details.

Download Wing 8 Now: Wing Pro | Wing Personal | Wing 101 | Compare Products


What's New in Wing 8.1


Wing 8 Screen Shot

Support for Containers and Clusters

Wing 8 adds support for developing, testing, and debugging Python code that runs inside containers, such as those provided by Docker and LXC/LXD, and clusters of containers managed by a container orchestration system like Docker Compose. A new Containers tool can be used to start, stop, and monitor container services, and new Docker container environments may be created during project creation.

For details, see Working with Containers and Clusters.

New Package Management Tool

Wing 8 adds a new Packages tool that provides the ability to install, remove, and update packages found in the Python environment used by your project. This supports pipenv, pip, and conda as the underlying package manager. Packages may be selected manually from PyPI or by package specifications found in a requirements.txt or Pipfile.

For details, see Package Manager .

Improved Project Creation

Wing 8 redesigns New Project support so that the host, project directory, Python environment, and project type may all be selected independently. New projects may use either an existing or newly created source directory, optionally cloning code from a revision control repository. An existing or newly created Python environment may be selected, using virtualenv, pipenv, conda, or Docker.

Improved Python Code Analysis and Warnings

Wing 8 expands the capabilities of Wing's static analysis engine, by improving its support for f-strings, named tuples, and other language constructs. Find Uses, Refactoring, and auto-completion now work within f-string expressions, Wing's built-in code warnings work with named tuples, the Source Assistant displays more detailed and complete value type information, and code warning indicators are updated more cleanly during edits.

And More

Wing 8 also adds support for Python 3.10, native executable for Apple Silicon (M1) hardware, a new Nord style display theme, reduced application startup time, Delete Symbol and Rename Current Module refactoring operations, improved debug stepping and exception handling in async code, and much more.

For a complete list of new features in Wing 8, see What's New in Wing 8.


Try Wing 8 Now!


Wing 8 is an exciting new step for Wingware's Python IDE product line. Find out how Wing 8 can turbocharge your Python development by trying it today.

Downloads: Wing Pro | Wing Personal | Wing 101 | Compare Products

See Upgrading for details on upgrading from Wing 7 and earlier, and Migrating from Older Versions for a list of compatibility notes.



from Planet Python
via read more

Python's len() Function

In many situations, you’ll need to find the number of items stored in a data structure. Python’s built-in function len() is the tool that will help you with this task.

There are some cases in which the use of len() is straightforward. However, there are other times when you’ll need to understand how this function works in more detail and how to apply it to different data types.

In this course, you’ll learn how to:

  • Find the length of built-in data types using len()
  • Use len() with third-party data types
  • Provide support for len() with user-defined classes

[ Improve Your Python With 🐍 Python Tricks πŸ’Œ – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]



from Real Python
read more

Tryton News: Newsletter February 2022

Time goes by and improvements to Tryton continue to be made. Here you can find the latest changes which have been included in the last month.

Changes for the User

The forecasts are now used for all supply calculations instead of only the purchase requests.

In the web client, the list of tabs no longer wraps on large screens but scrolls horizontally and each tab entry takes up the full width on small screens.

We now calculate an early date for the partial quantity if there isn’t one for the full quantity.

It is no longer possible to close (or remove) the type of an account that is already used in account move lines.

The auto-detection of CSV headers now stops on the first error in the web client.

We now support editing Shopify orders.

The accounts can have another type when their balance is a credit. This is the opposite of the existing debit type.

We do not create any more dunning for lines with pending payment.

Production orders with missing early moves are no more proposed for early planning.

We renamed the split lines accounting wizard into reschedule lines to be less confusing.

Changes for the System Administrator

The country module supports pycountry version 22.1.10.

We mirror the geonames zip files and use our mirror by default. This was needed because the original host has frequent downtime.

We removed the entropy check on user password. We found that it was not a good way to enforce good password. We recommend to use the forbidden list instead.

Changes for the Developer

We process sales for Shopify asynchronously as it can be quite slow due to the Shopify rate limit.

The view_id is now set in the context when parsing the view. So it can be used to apply attributes depending on the view in ModelView.view_attributes.

We replaced the deepcopy of the JSON-RPC result in the desktop client by a faster implementation based on the json types.

The country module can now load subdivisions with unknown types. This was needed to support future versions of pycountry.

The ORM uses now the already cached data to instantiate relational target records for which the context depends on other fields. This optimization prevents extra SQL queries for most of the cases.

The stock margin report retrieves the product’s unit from the SQL query instead of using a Function field which was triggering a second execution of the table query.

We replaced the back-off time on Shopify API calls by an automatic retry loop. This allows to make the first calls quickly until it consume the available bucket.

The board action domain is now limited to active_id and active_ids and they are stored in a dedicated _actions dictionary.

We added on ir.ui.view the view_get RPC method which can be used by the board to support inheritance like the other views.

The xpath inheritance of views applies now on all matching elements (instead of only the first) by default.

1 post - 1 participant

Read full topic



from Planet Python
via read more

Monday, January 31, 2022

Test and Code: 178: The Five Factors of Automated Software Testing

"There are five practical reasons that we write tests. Whether we realize it or not, our personal testing philosophy is based on how we judge the relative importance of these reasons." - Sarah Mei

This episode discusses the factors.

Sarah's order:

  1. Verify the code is working correctly
  2. Prevent future regressions
  3. Document the code’s behavior
  4. Provide design guidance
  5. Support refactoring

Brian's order:

  1. Verify the code is working correctly
  2. Prevent future regressions
  3. Support refactoring
  4. Provide design guidance
  5. Document the code’s behavior

The episode includes reasons why I've re-ordered them.

Sponsored By:

Support Test & Code in Python

Links:

<p>&quot;There are five practical reasons that we write tests. Whether we realize it or not, our personal testing philosophy is based on how we judge the relative importance of these reasons.&quot; - Sarah Mei</p> <p>This episode discusses the factors.</p> <p>Sarah&#39;s order:</p> <ol> <li>Verify the code is working correctly</li> <li>Prevent future regressions</li> <li>Document the code’s behavior</li> <li>Provide design guidance</li> <li>Support refactoring</li> </ol> <p>Brian&#39;s order:</p> <ol> <li>Verify the code is working correctly</li> <li>Prevent future regressions</li> <li>Support refactoring</li> <li>Provide design guidance</li> <li>Document the code’s behavior</li> </ol> <p>The episode includes reasons why I&#39;ve re-ordered them.</p><p>Sponsored By:</p><ul><li><a href="https://ift.tt/YiqCze6lr" rel="nofollow">Sauce Labs</a>: <a href="https://ift.tt/YiqCze6lr" rel="nofollow">Visit saucelabs.com/testbetter for more information and a free trial. Sauce Labs. Test Continuously. Test Smarter. Develop with confidence.</a></li><li><a href="https://ift.tt/DsiQ6Bc8S" rel="nofollow">PyCharm Professional</a>: <a href="https://ift.tt/DsiQ6Bc8S" rel="nofollow">Try PyCharm Pro for 4 months and learn how PyCharm will save you time.</a> Promo Code: TESTANDCODE22</li></ul><p><a href="https://ift.tt/pABqSD2Fb" rel="payment">Support Test & Code in Python</a></p><p>Links:</p><ul><li><a href="https://ift.tt/OG0KFBux4" title="Five Factor Testing - Sarah Mei" rel="nofollow">Five Factor Testing - Sarah Mei</a></li></ul>

from Planet Python
via read more

Zero to Mastery: Python Monthly Newsletter πŸ’»πŸ January 2022

26th issue of the Python Monthly Newsletter! Read by 20,000+ Python developers every month. This monthly Python newsletter covers the latest Python news so that you stay up-to-date with the industry and keep your skills sharp.

from Planet Python
via read more

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...