Planet Python

Subscribe to Planet Python feed
Planet Python - http://planetpython.org/
Updated: 18 hours 3 min ago

Programiz: Python List

Wed, 2022-12-07 02:56
In this tutorial, we will learn about Python lists (creating lists, changing list items, removing items and other list operations) with the help of examples.
Categories: FLOSS Project Planets

PyCoder’s Weekly: Issue #554 (Dec. 6, 2022)

Tue, 2022-12-06 14:30

#554 – DECEMBER 6, 2022
View in Browser »

Using Python’s pathlib Module

In this video course, you’ll learn how to effectively work with file system paths in Python 3 using the pathlib module in the standard library.
REAL PYTHON course

A Crash Course in Comprehensions and Generators

A great collection of code snippets that showcase the power and flexibility of list comprehensions, generators and related constructs.
PETE FISON • Shared by Pete FIson

TelemetryHub by Scout APM, A One-Step Solution for Open-Telemetry

Imagine a world where you could see all of your logs, metrics, and tracing data in one place. We’ve built TelemetryHub to be the simplest observability tool on the market. We supply peace of mind by providing an intuitive user experience that allows you to easily monitor your application →
SCOUT APM sponsor

Guido van Rossum: Python and the Future of Programming

An in-depth, 3 hour interview with Guido van Rossum by Lex Fridman.
LEX FRIDMAN podcast

Discussions PEP 683: Immortal Objects, Using a Fixed Refcount

Currently all CPython objects have some memory allocated to maintain state, even those that are immutable. PEP 683 proposes “Immortal Objects” and this thread discusses the proposal.
PYTHON.ORG

What Can Python Do That R Can’t?

REDDIT

Python Jobs Software Engineer - Weissman Lab (Cambridge, MA, USA)

Whitehead Institute for Biomedical Research

Senior Software Engineer (Python, Qt, Linux) (Anywhere)

VIOLET

More Python Jobs >>>

Articles & Tutorials Multiprocessing Race Conditions in Python

A race condition happens when parallel tasks attempt to execute code at the same time and the results are dependent on order of execution. Finding race conditions can be challenging, this article gives some hints as to how to find the different kinds of race conditions when coding with the multiprocessing module.
JASON BROWNLEE

Preparing Data to Measure ML Model Performance

How do you prepare a dataset for machine learning (ML)? How do you go beyond cleaning the data and move toward measuring how the model performs? This week on the show, Jodie Burchell, developer advocate for data science at JetBrains, returns to talk about strategies for better ML model performance.
REAL PYTHON podcast

Connect, Integrate & Automate Your Data - From Python or Any Other Application

At CData, we simplify connectivity between the application and data sources that power business, making it easier to unlock the value of data. Our SQL-based connectors streamline data access making it easy to access real-time data from on-premise or cloud databases, SaaS, APIs, NoSQL and Big Data →
CDATA SOFTWARE sponsor

How to Get a List of All Files in a Directory With Python

In this tutorial, you’ll be examining a couple of methods to get a list of files and folders in a directory with Python. You’ll also use both methods to recursively list directory contents. Finally, you’ll examine a situation that pits one method against the other.
REAL PYTHON

Python Type Hints: Case Study on parsy

This deep article talks about Luke’s journey to try to add type checking and why he often gives up. It walks through what was needed to add types to parsy, one of the libraries he maintains and how it compared to other similar libraries.
LUKE PLANT

Save Using update_fields for Better Django Performance

The update_fields argument to the .save() call restricts the underlying SQL to just the named fields. For some conditions this can mean a performance boost. This article shows where it can be helpful and when it might lead to bugs.
REDOWAN DELOWAR

7 Useful Python Libraries You Should Use in Your Next Project

This article introduces you to 7 useful Python libraries: PySnooper, schedule, MechanicalSoup, ftfy, rpyc, pyglet, and rope. Read on to learn how these can help you with your next project.
FARHAN TANVIR

Python Linter Comparison 2022

There are many linter choices for Python, this article covers a lot of them: Pylint, Pyflakes, Flake8, autopep8, Bandit, Prospector, Pylama, Pyroma, Black, Mypy, Radon, and mccabe.
AL SWEIGART

A Mastodon Opportunity for Developers

As the article starts: “There’s a lot of interest in Mastodon at the moment, For Reasons.” This article talks about how to play with the Mastodon API to embed content.
ANDY PIPER

Time Series Data: Do You Need a Purpose-Built Database

Is time series data just any dataset with a timestamp field? How do time series workloads differ from OLTP or full text search? Get all the answers in this technical e-book from the creators of InfluxDB. Download PDF.
INFLUXDATA sponsor

Python and .NET, an Ongoing Saga

Python.NET has released a new version, so Nikos has written an article that explores the history of Microsoft, .NET, and Python including the state of Iron Python.
NIKOS VAGGALIS

Reddit Monitoring With Python

A step-by-step tutorial on creating a Reddit keyword monitoring tool with Python and praw. Learn how to run a Python script to watch keywords on a subreddit.
LEON WEI

Projects & Code jupyterlite: Wasm Powered Jupyter Running in the Browser

GITHUB.COM/JUPYTERLITE

torchscale: Transformers at Any Scale

GITHUB.COM/MICROSOFT

python-easter-eggs: Easter Eggs and Hidden Jokes in Python

GITHUB.COM/ORKOHUNTER

lumi: Nano Framework to Convert Functions Into a REST API

GITHUB.COM/TANMOY741127

django-relativity: More Expressive ORM Relationships

GITHUB.COM/ALEXHILL

Events STL Python

December 7, 2022
MEETUP.COM

NZPUG-Auckland Coding Evening

December 7, 2022
MEETUP.COM

Weekly Real Python Office Hours Q&A (Virtual)

December 7, 2022
REALPYTHON.COM

Python Atlanta

December 8, 2022
MEETUP.COM

PyCon Bolivia 2022

December 9 to December 11, 2022
PYCON.ORG

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

[ 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 ]

Categories: FLOSS Project Planets

Python Insider: Python 3.11.1, 3.10.9, 3.9.16, 3.8.16, 3.7.16, and 3.12.0 alpha 3 are now available

Tue, 2022-12-06 12:58

Greetings! We bring you a slew of releases this fine Saint Nicholas / Sinterklaas day. Six simultaneous releases has got to be some record. There’s one more record we broke this time, you’ll see below.

In any case, updating is recommended due to security content:

  • 3.7 - 3.12: gh-98739: Updated bundled libexpat to 2.5.0 to fix CVE-2022-43680 (heap use-after-free).
  • 3.7 - 3.12: gh-98433: The IDNA codec decoder used on DNS hostnames by socket or asyncio related name resolution functions no longer involves a quadratic algorithm to fix CVE-2022-45061. This prevents a potential CPU denial of service if an out-of-spec excessive length hostname involving bidirectional characters were decoded. Some protocols such as urllib http 3xx redirects potentially allow for an attacker to supply such a name.
  • 3.7 - 3.12: gh-100001: python -m http.server no longer allows terminal control characters sent within a garbage request to be printed to the stderr server log.
  • 3.8 - 3.12: gh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module.
  • 3.9 - 3.10 (already released in 3.11+ before): gh-97514: On Linux the multiprocessing module returns to using filesystem backed unix domain sockets for communication with the forkserver process instead of the Linux abstract socket namespace. Only code that chooses to use the “forkserver” start method is affected. This prevents Linux CVE-2022-42919 (potential privilege escalation) as abstract sockets have no permissions and could allow any user on the system in the same network namespace (often the whole system) to inject code into the multiprocessing forkserver process. This was a potential privilege escalation. Filesystem based socket permissions restrict this to the forkserver process user as was the default in Python 3.8 and earlier.
  • 3.7 - 3.10: gh-98517: Port XKCP’s fix for the buffer overflows in SHA-3 to fix CVE-2022-37454.
  • 3.7 - 3.9 (already released in 3.10+ before): gh-68966: The deprecated mailcap module now refuses to inject unsafe text (filenames, MIME types, parameters) into shell commands to address CVE-2015-20107. Instead of using such text, it will warn and act as if a match was not found (or for test commands, as if the test failed).
Python 3.12.0 alpha 3

Get it here, read the change log, sing a GPT-3-generated Sinterklaas song:

https://www.python.org/downloads/release/python-3120a3/

216 new commits since 3.12.0 alpha 2 last month.

Python 3.11.1

Get it here, see the change log, read the recipe for quark soup:

https://www.python.org/downloads/release/python-3111/

A whopping 495 new commits since 3.11.0. This is a massive increase of changes comparing to 3.10 at the same stage in the release cycle: there were “only” 339 commits between 3.10.0 and 3.10.1.

Python 3.10.9

Get it here, read the change log, see circular patterns:

https://www.python.org/downloads/release/python-3109/

165 new commits.

Python 3.9.16

Get it here, read the change log, consider upgrading to a newer version:

https://www.python.org/downloads/release/python-3916/

Security-only release with no binaries. 10 commits.

Python 3.8.16

Get it here, see the change log, definitely upgrade to a newer version:

https://www.python.org/downloads/release/python-3816/

Security-only release with no binaries. 9 commits.

Python 3.7.16

Get it here, read the change log, check PEP 537 to confirm EOL is coming to this version in June 2023:

https://www.python.org/downloads/release/python-3716/

Security-only release with no binaries. 8 commits.

We hope you enjoy the new releases!

Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation.

https://www.python.org/psf/

Your friendly release team,

Ned Deily @nad
Steve Dower @steve.dower
Pablo Galindo Salgado @pablogsal
Łukasz Langa @ambv
Thomas Wouters @thomas

 

 

 

 

 

 

 

Categories: FLOSS Project Planets

Django Weblog: DjangoCon US and Europe 2022 Talks Available Online

Tue, 2022-12-06 10:12

The organizers of DjangoCon US and DjangoCon Europe spend a tremendous amount of energy both hosting the conferences and putting all the talks online after. The complete playlists of talks from each conference are now available on YouTube:

Categories: FLOSS Project Planets

PyCon: PyCon US 2023 Registration Launch!

Tue, 2022-12-06 09:04

The news you’ve been waiting for is finally here - registration for PyCon US 2023 is officially open!

PyCon US will take place April 19 - April 27, 2023, online and in Salt Lake City, Utah. The core of the conference, April 21 - April 23, 2023, packs in three days worth of our community’s 95 best talks, amazing keynote speakers, and our famed lightning talks to close out each day, but it is much more than that.

It’s gathering together with the members of our community, to learn from and share with. It’s joining a conversation in the hallway with the creators of open source projects. It’s taking yourself from beginner to intermediate, or intermediate to advanced. For some, it’s getting started with Python for the first time.

We hope you’ll join us for this special anniversary year, celebrating 20 years of PyCon.

Health & Safety Guidelines

PyCon US is committed to protecting the health and safety of our community. To ensure that we are gathering safely, we have implemented COVID-19 guidelines and protocols to be followed by all attendees during the event. We ask that you please review these guidelines prior to registration.

Please note: We will not be rolling back our mask requirement. If the situation changes and there are additional ways to keep attendees safe, we may incorporate those strategies closer to the event. Please check back regularly to stay updated on current guidelines.

How to Register

Once you have created an account on the PyCon US 2023 conference website, you can register via the registration button on your dashboard. Head over to our Registration Information page to get all the details on how to register.

Early Bird Registration Rates

PyCon US is providing discounted rates for Corporate, Student, and Individual tickets for the first 500 tickets sold. Register now to get your discount while supplies last!

  • Corporate - $650 
  • Individual - $350 
  • Student - $75

Once the first 500 tickets are sold, prices will switch to the regular registration rate.

Registration Rates

  • Corporate - $750 USD 
  • Individual - $400 USD 
  • Student - $100 USD 
  • Online - $100 USD 
  • Patron / Patron Online - $1200 USD

Tutorials

Tutorials will be presented Wednesday, April 19, 2023, and Thursday, April 20, 2023. We are accepting proposals for tutorials through December 9, 2022. Find more information and submit a proposal here. Once our program committee has scheduled the selected tutorials, you will be able to add them to your conference registration.

Watch for tutorial launch in February 2023. Opt-in for PyCon US News and follow us on Twitter and Mastodon for the announcement.
Sponsorship and Sponsor Presentations

Sponsorship for PyCon US 2023 is open now, and you can apply directly on our Sponsorship Application page. We’re grateful to all of our sponsors, who make PyCon US possible.

Sponsor Presentations will take place Thursday, April 20, 2023. To reserve a slot for an hour-long Sponsor Presentation on the topic of your choice, please apply for Partner Level Sponsorship or higher and select the check mark next to “Sponsor Presentation.” Slots are limited and typically sell out, so please submit your request soon. Contact sponsors@python.org with any questions.

Hotel

PyCon US has contracted special rates with nearby hotels. When you complete your registration for PyCon US 2023, you will be able to book a hotel reservation on your dashboard through our official housing bureau, Orchid Events. This is the only way to get the conference rates so book now while supplies last!

More information can be found on the Venue and Hotels page.

Note: Beware of Housing Pirates! PyCon US or Orchid Events will not be calling delegates to sell rooms. If you are contacted by an agency other than Orchid Events offering to make your hotel reservations, we urge you to not use their services. We cannot protect you against them if you do book a reservation.

Cancellation Fees

Registration cancellations must be submitted in writing and received by April 3, 2023, in order to receive a refund minus the $50 cancellation fee ($25 for students; waived for cancellation due to health reasons). No refunds will be granted for cancellations received after April 3, 2023, unless you must cancel for any health-related reasons (see more details under Attendance in the Health & Safety Guidelines).

In lieu of cancellation, you are able to transfer your registration to another person. For details about transferring your registration, visit the registration page.

Attendees traveling to PyCon US internationally are encouraged to review our International Travel Refund Policy as well as their countries' international travel guidelines prior to registering. This is especially important for recipients of Travel Grants attending from abroad. PyCon US strives to support the Python community in attending, no matter where they are traveling from.

Travel Grants

Check out the Travel Grant page to learn more about the support we provide for travel, hotel, and registration to ensure that everyone has an opportunity to attend PyCon US. We actively encourage people to apply for travel grants and welcome applications from attendees who otherwise would not be able to attend. Our goal is to support diversity and provide equity to attendees and attract Python developers at all experience levels from around the world. For questions during the application process, visit the Travel Grant FAQ page.

Categories: FLOSS Project Planets

Real Python: Python Basics: Dictionaries

Tue, 2022-12-06 09:00

In plain English, a dictionary is a book containing the definitions of words. Each entry in a dictionary has two parts: the word being defined, and its definition.

Python dictionaries, like lists and tuples, store a collection of objects. However, instead of storing objects in a sequence, dictionaries hold information in pairs of data called key-value pairs. That is, each object in a dictionary has two parts: a key and a value. Each key is assigned a single value, which defines the relationship between the two sets.

In this video course, you’ll learn:

  • What a dictionary is and how it’s structured
  • How dictionaries differ from other data structures
  • How to define and use dictionaries in your own code

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course.

[ 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 ]

Categories: FLOSS Project Planets

PyPy: PyPy v7.3.10 release

Tue, 2022-12-06 08:22
PyPy v7.3.10: release of python 2.7, 3.8, and 3.9

The PyPy team is proud to release version 7.3.10 of PyPy. We have some nice speedups and bugfixes we wish to share. The release includes three different interpreters:

  • PyPy2.7, which is an interpreter supporting the syntax and the features of Python 2.7 including the stdlib for CPython 2.7.18+ (the + is for backported security updates)

  • PyPy3.8, which is an interpreter supporting the syntax and the features of Python 3.8, including the stdlib for CPython 3.8.15.

  • PyPy3.9, which is an interpreter supporting the syntax and the features of Python 3.9, including the stdlib for CPython 3.9.15. We have gained confidence in the stability of this version, and are removing the "beta" label.

The interpreters are based on much the same codebase, thus the multiple release. This is a micro release, all APIs are compatible with the other 7.3 releases. Highlights of the release, since the release of 7.3.9 in March 2022 include:

  • A release of Apple Silicon M1 arm64 versions. This work was sponsored by an anonymous donor and is tested on our buildbots.

  • Many improvements to the basic interpreter to make it 15-20% faster

  • The conda-forge community has built over 1000 packages for PyPy3.8 and 3.9, making it easier than ever to use PyPy.

  • Update the packaged OpenSSL to 1.1.1s, sqlite3 to 3.39.4, and apply applicable security fixes from CPython 3.9.15 to PyPy2.7

  • Update the HPy backend in PyPy3.8 and PyPy3.9 to 0.0.4

We recommend updating. You can find links to download the v7.3.10 releases here:

https://pypy.org/download.html

We would like to thank our donors for the continued support of the PyPy project. If PyPy is not quite good enough for your needs, we are available for direct consulting work. If PyPy is helping you out, we would love to hear about it and encourage submissions to our blog via a pull request to https://github.com/pypy/pypy.org

We would also like to thank our contributors and encourage new people to join the project. PyPy has many layers and we need help with all of them: bug fixes, PyPy and RPython documentation improvements, or general help with making RPython's JIT even better. Since the previous release, we have accepted contributions from five new contributors, thanks for pitching in, and welcome to the project!

If you are a python library maintainer and use C-extensions, please consider making a HPy / CFFI / cppyy version of your library that would be performant on PyPy. In any case, both cibuildwheel and the multibuild system support building wheels for PyPy.

What is PyPy?

PyPy is a Python interpreter, a drop-in replacement for CPython 2.7, 3.8 and 3.9. It's fast (PyPy and CPython 3.7.4 performance comparison) due to its integrated tracing JIT compiler.

We also welcome developers of other dynamic languages to see what RPython can do for them.

We provide binary builds for:

  • x86 machines on most common operating systems (Linux 32/64 bits, Mac OS 64 bits, Windows 64 bits)

  • 64-bit ARM machines running Linux (aarch64).

  • Apple M1 arm64 machines (macos_arm64).

  • s390x running Linux

PyPy support Windows 32-bit, Linux PPC64 big- and little-endian, and Linux ARM 32 bit, but does not release binaries. Please reach out to us if you wish to sponsor binary releases for those platforms. Downstream packagers provide binary builds for debian, Fedora, conda, OpenBSD, FreeBSD, Gentoo, and more.

What else is new?

For more information about the 7.3.10 release, see the full changelog.

Please update, and continue to help us make pypy better.

Cheers, The PyPy Team

Categories: FLOSS Project Planets

Django Weblog: Django bugfix release: 4.1.4

Tue, 2022-12-06 04:32

Today we've issued the 4.1.4 bugfix release.

The release package and checksums are available from our downloads page, as well as from the Python Package Index. The PGP key ID used for this release is Carlton Gibson: E17DF5C82B4F9D00.

Categories: FLOSS Project Planets

Python Bytes: #313 Programming Robots With a Marker

Tue, 2022-12-06 03:00
<a href='https://www.youtube.com/watch?v=d-JoGzArMHg' style='font-weight: bold;'>Watch on YouTube</a><br> <br> <p><strong>About the show</strong></p> <p>Sponsored by <a href="http://pythonbytes.fm/foundershub2022"><strong>Microsoft for Startups Founders Hub</strong></a>.</p> <p><strong>Connect with the hosts</strong></p> <ul> <li>Michael: <a href="https://fosstodon.org/@mkennedy"><strong>@mkennedy@fosstodon.org</strong></a></li> <li>Brian: <a href="https://fosstodon.org/@brianokken"><strong>@brianokken@fosstodon.org</strong></a></li> <li>Special guest: <a href="https://twitter.com/KellyPared"><strong>Kelly Schuster-Paredes</strong></a></li> <li>Special guest: <a href="https://twitter.com/smtibor"><strong>Sean Tibor</strong></a></li> </ul> <p><strong>Michael #1:</strong> <strong>How do you say that number?</strong></p> <ul> <li>Inflect: <a href="https://fosstodon.org/@linuxgal@techhub.social/109430499504962727"><strong>fosstodon.org/@linuxgal@techhub.social/109430499504962727</strong></a></li> <li><p>Num2Words: <a href="https://pypi.org/project/num2words/"><strong>pypi.org/project/num2words/</strong></a></p> <pre><code># Inflect: import inflect inflector=inflect.engine() print(inflector.number_to_words(8675309)) # eight million, six hundred and seventy-five thousand, three hundred and nine # Num2Words from num2words import num2words print(num2words(8675309)) # eight million, six hundred and seventy-five thousand, three hundred and nine </code></pre></li> <li><p>Num2Words also has a CLI:</p></li> <li><code>pipx install num2words</code></li> <li><code>$ num2words 2948475</code></li> <li><code>two million, nine hundred and forty-eight thousand, four hundred and seventy-five</code></li> </ul> <p><strong>Brian #2:</strong> <a href="https://inference-review.com/article/the-origins-of-python"><strong>The Origins of Python</strong></a></p> <ul> <li>Lambert Meertens</li> <li>A wonderful tale starting with TELCOMP, traveling through ABC, and finally reaching Python. </li> <li>This is a long article, but a wonderful story.</li> <li>It includes a nice emphasis at all times to keep a language simple enough for the absolute beginner but powerful enough to not be annoying for experienced developers.</li> <li>A few quotes from the article: <ul> <li>“Ease of learning and ease of use are both desirable attributes in any programming language. Nonetheless, I have often felt that this aspect of language design does not always receive the attention it deserves. And what may seem easy to a designer may not necessarily be easy for a language learner.”</li> <li>Regarding ABC: “To serve our intended users, absolute beginners, we sought to hide low-level implementation details and instead to provide powerful high-level, task-oriented features.</li> <li>Then Python: “The growth in popularity of Python, from its inception thirty years ago as a one-person effort flying under the radar, has been phenomenal, but not meteoric. Instead it has been a long, slow, and steady rise. Python’s ease of learning gave it a competitive advantage in a period when there was a perpetual need for more programmers. Its clean syntax and semantics make it easier to maintain a software base written in Python than other languages—an important consideration given that the cost of maintaining software dwarfs the cost of creating new software.”</li> </ul></li> </ul> <p><strong>Kelly</strong> <strong>#3:</strong> </p> <ul> <li><a href="https://shop.ozobot.com/cart">Ozobot Evo</a> Introduces a Python Beta Version. (<a href="https://ozobot.com/2022/08/17/"><strong>August 17, 2022</strong></a>)</li> <li>The original Ozobot model – the Ozobot Bit – is no longer available for purchase . The New Evo Ozobit- has three Kit options. The Entry Kit (single robot), the Ozobot Evo 12-Pack, and the Ozobot Evo 18-Pack. </li> <li>https://beta.python.ozobot.com/doc-python-api/ozobot.html#module-0 </li> <li>Still has the updated OzoBlockly platform for Block Programming.</li> <li>This tiny bot comes with: <ul> <li>Line following</li> <li>Color detection</li> <li>Sound</li> <li>proximity sensor</li> <li>bluetooth</li> <li>Crash detection</li> <li>Students can even code functions</li> </ul></li> <li>Ozobot simulator(block) https://games.ozoblockly.com/shapetracer-freeform</li> <li>Web beta app: <a href="https://beta.python.ozobot.com">beta.python.ozobot.com</a></li> </ul> <p><strong>Michael #4:</strong> <a href="https://pypi.org/project/setproctitle/"><strong>setproctitle</strong></a></p> <ul> <li><p>A Python module to customize the process title</p></li> <li><p>Awesome for servers and anytime “python” is not enough</p></li> <li><p>Easy to use directly:</p></li> <li><p>from setproctitle import setproctitle</p></li> <li><p>setproctitle("tp-search daemon")</p></li> <li><p>Used automatically by servers like uwsgi and gunicorn I believe.</p> <pre><code>### # uWSGI server configuration ### [uwsgi] # uWSGI provides some functionality which can help identify the workers procname-prefix = training- auto-procname = true </code></pre></li> <li><p>Some nice results, example from Talk Python Training <img src="https://python-bytes-static.nyc3.digitaloceanspaces.com/server-with-names.png" alt="" /></p></li> </ul> <p><strong>Brian #5:</strong> <strong>Looking forward to Python 3.12</strong></p> <ul> <li><a href="https://www.python.org/downloads/release/python-3120a2/">New features in 3.12a2</a> <ul> <li>Improved Error Messages</li> <li>lots of other goodies, like <code>pathlib.walk()</code>.</li> </ul></li> <li><a href="https://peps.python.org/pep-0693/">Release scheduled for Oct 2023</a></li> <li>But why wait? Start testing your projects with it now: <a href="http://localhost:1313/testing-with-python-3.12">Te</a><a href="https://pythontest.com/testing-with-python-3-12">sting with Python 3.12</a></li> <li>Note that “During the alpha phase, features may be added up until the start of the beta phase (2023-05-08) and, if necessary, may be modified or deleted up until the release candidate phase (2023-07-31). Please keep in mind that this is a preview release and its use is not recommended for production environments.”</li> <li>Actually, with that note, you might want to wait. I don’t. I’ll deal with it when/if I get a failure. </li> </ul> <p><strong>Sean</strong> <strong>#6:</strong> <a href="https://www.youtube.com/watch?v=rRBLl7MsZVU&amp;list=PL2yQDdvlhXf9F-GUSSZ2jBtelyiWRFHNV&amp;index=13"><strong>Re:Invent 2022 EF Education Breakout</strong></a></p> <ul> <li>Presentation at AWS Re:Invent 2022</li> <li>Complete redesign of online learning platform by one of the largest education companies in the world</li> <li>We’ve all seen Zoom classrooms with rows on rows of students</li> <li>A more immersive experience for learning with green screens, digital sets, and props</li> <li>Massive amount of analytics around student engagement and learning, including full transcription of every student, engagement tracking, and computer vision</li> <li> <img src="https://paper-attachments.dropboxusercontent.com/s_8972A8B4AFB195FA45E7A043E2BDE6670DA22712B4D99F7D7829C7C10300934F_1670335403294_image.png" alt="" /></li> </ul> <p><strong>Extras</strong> </p> <p>Michael:</p> <ul> <li>You can support the PSF if you’re selling things on EBay. Check “Donate a portion to charity” and choose “Python Software Foundation” via Joe Riedley</li> <li><a href="https://learn.microsoft.com/en-us/windows/powertoys/text-extractor">Textinator for Windows</a> (the Windows version of <a href="https://www.textsniper.app">TextSniper</a>)</li> <li><a href="https://paperlike.com">Paperlike</a> for iPad</li> </ul> <p>Kelly: A new Special Interest Group for the PSF launched 6 days ago. “Edu-sig, through its <a href="http://www.python.org/mailman/listinfo/edu-sig">mailing list</a>, provides an informal venue for comparing notes and discussing future possibilities for Python in education.” Led by Timothy Wilson.</p> <p>Sean:</p> <ul> <li><a href="https://www.youtube.com/watch?v=RfvL_423a-I">Dr. Werner Vogel’s keynote</a> - everything is coming up async</li> <li><a href="https://aws.amazon.com/eventbridge/pipes/">EventBridge Pipes</a></li> </ul> <p><strong>Jokes:</strong> </p> <p><a href="https://fosstodon.org/@kimvanwyk/109389398652030679">fosstodon.org/@kimvanwyk/109389398652030679</a></p> <p>And a new mastodon user:</p> <p><a href="https://fosstodon.org/@vruz@mastodon.social/109394538570819699">fosstodon.org/@vruz@mastodon.social/109394538570819699</a></p> <p><img src="https://imgs.xkcd.com/comics/feature_comparison.png" alt="Feature Comparison" /></p>
Categories: FLOSS Project Planets

Read the Docs: Read the Docs newsletter - December 2022

Mon, 2022-12-05 19:00

This newsletter contains the first features and updates that have hatched since we announced a Q4 focus on core platform features in the previous newsletter.

News and updates

Here are the latest updates from our team:

You can always see the latest changes to our platforms in our Read the Docs Changelog.

Upcoming features
  • We’re working on improving our integration with Material for MkDocs, which is a great theme for MkDocs documentation projects.

  • Many improvements to our URL handling code, which will allow us to support more flexible URL configurations for projects.

  • A search redesign to make it nicer across our dashboard and in-doc search experiences.

  • 404 pages are being improved by contextualization the user message, giving relevant guidance to readers and project owners.

Possible issues

Sphinx 6 is coming very soon. For those of you planning to upgrade immediately, we are preparing a blog post with a couple of considerations in that regard.

If you find regressions in any new releases of the sphinx-rtd-theme, please don’t hesitate to open an issue on GitHub.

Our Q4 focus also includes deprecating old and outdated approaches to using our platform. We don’t have anything firm to announce here yet, but we do plan to be more active in removing these features in the coming months.

Tip of the month

Do you need to document past or upcoming events? Chris Sewell has created sphinx-timeline for exactly this.

See sphinx-timeline in full action on the main page of AiiDA (which by the way is built with Read the Docs).

Awesome Project of the month

Nautobot is a great example of a documentation landing page with several subprojects. See all the highlights in the following Twitter thread:

Nautobot is the project of our today’s 💫 Showcase the Docs 🌟 edition!

“An extensible and flexible Network Source of Truth and Network Automation Platform that is the cornerstone of any network automation architecture” #Nautobot #documentation pic.twitter.com/icp2q2Epty

— Read the Docs (@readthedocs) November 22, 2022 Awesome Read the Docs Projects List 🕶️

Looking for more inspiration? Check out our new list: Awesome Read the Docs Projects.

Considering using Read the Docs for your next documentation project? Check out our documentation to get started!

Questions? Comments? Ideas for the next newsletter? Contact us!

Categories: FLOSS Project Planets

Real Python: Python News: What's New From November 2022

Mon, 2022-12-05 09:00

The Python world never stops spinning! After the release of Python 3.11 in October, the Python release team is already launching the first alpha versions of Python 3.12. The excitement of trying shiny new things shouldn’t distract you from being cautious while coding, though. Recently, researchers found more malicious packages on PyPI, and lawyers raised concerns about license violations when using GitHub Copilot to generate code.

Let’s dive into the biggest Python news from the past month!

Join Now: Click here to join the Real Python Newsletter and you'll never miss another Python tutorial, course update, or post.

Python 3.12 Alpha Released

One of the most newsworthy events from October was the release of Python 3.11. While many of us are exploring the cool new features of Python 3.11, others are already hard at work on the next release.

Right on track with the Python 3.12 release schedule, the Python release team unveiled Python 3.12 alpha 2 in the middle of November. The core team is still early in the development cycle, but so far, the list of new features seems exciting.

Here’s some of what’s coming in Python 3.12:

  • Even more improved error messages
  • Support for the Linux perf profiler
  • Deprecation of old functions, classes, and modules

While Python 3.11 already improved error messages, the next feature release will offer even better suggestions for fixing errors. For example, check out what it does when you forget to import a module or order your import statements wrong:

>>>>>> sys.version_info Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'sys' is not defined. Did you forget to import 'sys'? >>> import pi from math File "<stdin>", line 1 import pi from math ^^^^^^^^^^^^^^^^^^^ SyntaxError: Did you mean to use 'from ... import ...' instead?

Especially when you’re learning Python, constructive error messages can point you in the right direction to improve your code. But also, if you’re a seasoned Python developer, then the upcoming Python release will have something in stock for your code improvements:

Read the full article at https://realpython.com/python-news-november-2022/ »

[ 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 ]

Categories: FLOSS Project Planets

Python for Beginners: Create Index in a Pandas Series

Mon, 2022-12-05 09:00

Pandas series objects are used to store data when we need to access it using its position as well as labels. In this article, we will discuss different ways to create index in a pandas series. 

Table of Contents
  1. Create Index in a Pandas Series Using the Index Parameter
  2. Create Index in a Pandas Series Using the Index Attribute
  3. Create an Index in a Pandas Series Using the set_axis() Method
    1. The set_axis() Method
  4. Create Index Inplace in a Pandas Series
  5. Conclusion
Create Index in a Pandas Series Using the Index Parameter

When we create a pandas series, it has a default index starting from 0 to the length of the series-1. For instance, consider the following example.

import pandas as pd import numpy as np letters=["a","b","c","ab","abc","abcd","bc","d"] series=pd.Series(letters) print("The series is:") print(series)

Output:

The series is: 0 a 1 b 2 c 3 ab 4 abc 5 abcd 6 bc 7 d dtype: object

In the above example, we have created a series of 8 elements. You can observe that the indices of the elements in the series are numbered from 0 to 7. These are the default indices.

If you want to assign a custom index to the series, you can use the index parameter in the Series() constructor. The index parameter in the Series() constructor takes a list having an equal number of elements as the elements in the series and creates a custom index for the series as shown below.

import pandas as pd import numpy as np letters=["a","b","c","ab","abc","abcd","bc","d"] numbers=[3,23,11,14,16,2,45,65] series=pd.Series(letters,index=numbers) print("The series is:") print(series)

Output:

The series is: 3 a 23 b 11 c 14 ab 16 abc 2 abcd 45 bc 65 d dtype: object

In the above example, we have passed the python list [3, 23, 11, 14, 16, 2, 45, 65] to the index parameter of the Series() constructor. After the execution of the Series() constructor, the elements of this list are assigned as the indices of the elements in the series.

Create Index in a Pandas Series Using the Index Attribute

You can also create a new index for a series after creating the series. For instance, if you want to assign other values as indices in the series, you can use the index attribute of the series object. To create a new custom index, you can assign a list of values to the index attribute as shown below.

import pandas as pd import numpy as np letters=["a","b","c","ab","abc","abcd","bc","d"] numbers=[3,23,11,14,16,2,45,65] series=pd.Series(letters) series.index=numbers print("The series is:") print(series)

Output:

The series is: 3 a 23 b 11 c 14 ab 16 abc 2 abcd 45 bc 65 d dtype: object

In this example, we have assigned the list [3, 23, 11, 14, 16, 2, 45, 65] to the index attribute of the series after creating the series. Hence, the elements of this list are assigned as the indices of the elements in the series.

Here, the list passed to the index attribute must have a length equal to the number of elements in the series. Otherwise, the program will run into a ValueError exception. You can observe this in the following example.

import pandas as pd import numpy as np letters=["a","b","c","ab","abc","abcd","bc","d"] numbers=[3,23,11,14,16,2,45,65,117] series=pd.Series(letters) series.index=numbers print("The series is:") print(series)

Output:

ValueError: Length mismatch: Expected axis has 8 elements, new values have 9 elements

In the above example, you can observe that the list "letters" has only 8 elements. As a result, the series contains only 8 elements. On the other hand, the list "numbers" has 9 elements. Hence, when we assign the "numbers" list to the index attribute of the series, the program runs into a ValueError exception.

Suggested Reading: If you are into machine learning, you can read this MLFlow tutorial with code examples. You might also like this article on clustering mixed data types in Python.

Create an Index in a Pandas Series Using the set_axis() Method

Instead of using the index attribute, we can use the set_axis() method to create an index in a pandas series. 

The set_axis() Method

The set_axis() method has the following syntax.

Series.set_axis(labels, *, axis=0, inplace=_NoDefault.no_default, copy=_NoDefault.no_default)

Here, 

  • The labels parameter takes a list-like object containing index values. You can also pass an Index object to the labels parameter. The number of elements in any object passed to the labels parameter should have the same number of elements as the series on which the set_axis() method is invoked.
  • The axis parameter is used to decide if we want to create the index for rows or columns. As a Series has only one column, the axis parameter is unused. 
  • After creating a new index, the set_axis() method returns a new Series object. If you want to modify the original Series object, you can set the inplace parameter to True. 
  • The copy parameter is used to decide whether to make a copy of the underlying data instead of modifying the original series. By default, it is True. 

To create an index using the set_axis() method, we will invoke this method on the original series object. We will pass a list containing the new index values to the set_axis() method as an input argument. After execution, the set_axis() method will return a new series having a modified index. You can observe this in the following example.

import pandas as pd import numpy as np letters=["a","b","c","ab","abc","abcd","bc","d"] numbers=[3,23,11,14,16,2,45,65] series=pd.Series(letters) series=series.set_axis(labels=numbers) print("The series is:") print(series)

Output:

The series is: 3 a 23 b 11 c 14 ab 16 abc 2 abcd 45 bc 65 d dtype: object

In this example, we have first created a series containing 8 elements. Then, we used the set_index() method to assign new indices to the elements in the series. You can observe that the set_index() method returns a new series. Hence, the original series isn’t modified. To modify the original series by assigning new indices instead of creating a new one, you can create an index in place in the series.

Create Index Inplace in a Pandas Series

To create an index inplace in a pandas series, you can assign the new index to the index attribute of the series object as shown in the following example.

import pandas as pd import numpy as np letters=["a","b","c","ab","abc","abcd","bc","d"] numbers=[3,23,11,14,16,2,45,65] series=pd.Series(letters) series.index=numbers print("The series is:") print(series)

Output:

The series is: 3 a 23 b 11 c 14 ab 16 abc 2 abcd 45 bc 65 d dtype: object

You can also use the set_axis() method to create an index inplace in a series. For this, you can pass the list containing the new index values to the set_axis() method and set the inplace parameter to True while invoking the set_axis() method on the original series object. After execution, you will get the modified series object as shown below.

import pandas as pd import numpy as np letters=["a","b","c","ab","abc","abcd","bc","d"] numbers=[3,23,11,14,16,2,45,65] series=pd.Series(letters) series.set_axis(labels=numbers,inplace=True) print("The series is:") print(series)

Output:

The series is: 3 a 23 b 11 c 14 ab 16 abc 2 abcd 45 bc 65 d dtype: object

In this example, we used the set_index() method to assign new indices to the elements in the series. You can observe that we have set the inplace parameter to True in the set_index() method. Hence, the new indices are assigned in the original series object itself.

While using the inplace parameter you will get a FutureWarning stating "FutureWarning: Series.set_axis 'inplace' keyword is deprecated and will be removed in a future version. Use obj = obj.set_axis(..., copy=False) instead". It means that the inplace parameter has been deprecated. Hence, if the same code is used in future versions of pandas, the program may run into an error. To avoid this, you can use the copy parameter.

By default, the copy parameter is set to True. Hence, the set_axis() method uses a copy of the original series and modifies it. If you want to modify the original series, you can set the copy parameter to False in the set_axis() method.

Conclusion

In this article, we discussed different ways to create the index in a pandas series in Python. To know more about the pandas module, you can read this article on how to sort a pandas dataframe. You might also like this article on how to drop columns from a pandas dataframe.

The post Create Index in a Pandas Series appeared first on PythonForBeginners.com.

Categories: FLOSS Project Planets

Mike Driscoll: PyDev of the Week: Miroslav Šedivý

Mon, 2022-12-05 08:23

This week we welcome Miroslav Šedivý as our PyDev of the Week! Miro has been a speaker at several different Python conferences. You can also catch up with Miro on his website or by checking out Miro's GitHub Profile.

Let's take some time to get to know Miro better!

Can you tell us a little about yourself (hobbies, education, etc):

My name is Miroslav Šedivý, but most people call me Miro, which allows them to avoid typing some letters they do not have on their keyboard. I was born in Czechoslovakia (yes, I am over 30 now), studied computer sciences in France and Germany, and now I am living in Austria.

Computers and programming were the hobbies that became my occupation. Another hobby, which is difficult to combine professionally with the first one, is human languages. As a Central European fascinated by travel, I speak a bunch of languages and enjoy using them every day.

Apart from this, I love spending time with my family, hiking, biking, fixing OpenStreetMap, camping, and woodworking.

You can find me at https://mas.to/@eumiro and occasionally at some Python events.

Why did you start using Python?

After I have developed a quite complex power forecasting system for wind turbines in Perl using PDL (Perl equivalent to NumPy), my colleagues started using Python for new projects. It was around 2008, in the age of Python 2.5 with some rumors of Python 3. I got myself a book called “Perl to Python Migration” and tried to wrap my head around the new concepts.

The worst thing I remember from my beginnings was the necessity to "import re" each time I wanted to work with regular expressions. In Perl it was second nature to do almost anything with regular expressions. Not it Python. And this is beautiful about different languages: the way of thinking in them. Just like in French one does not simply count to seventy, nor in Czech say “one beer” (“one” is actually a synonym for “beer”), in Python one, can use other tools to dissect strings.

What other programming languages do you know and which is your favorite?

There were some BASIC and Pascal somewhere in the past century, but now my number one is Python, accompanied by Shell. I remember some Perl, Java, C, and PHP from more or less serious projects in the past, and I have played with Go and Rust.

The choice of language usually depends on the task. I also do not use English to speak about food and cuisine, or Polish to comment a Python code review. I am using Python only for stuff it fits well. Luckily, it fits most of the stuff I am working on.

What projects are you working on now?

Apart from my work, I have some sleeping projects at https://github.com/eumiro, which are currently waiting for another burst of enthusiasm or external input. A day has only 24±1 hours, but I wish it had more.

Which Python libraries are your favorite (core or 3rd party)?

From standard lib, I am always happy if I can reach into the itertools module and simplify my code. Migration to Python 3 brings pathlib, which is a complete game changer when working with file system. I am also happy to see some gaps closing between the different modules, so you do not have to import anything else to obtain Unix timestamp of a datetime object, for instance.

There are plenty of wonderful third-party libraries I have worked with. The most important and complex one is probably pandas.

How did you end up contributing to open source projects?

At my first Python conference EuroPython 2015 in Bilbao, I met Francesc Alted from the PyTables team and as an active user of the library I had a long discussion with him at the end, we even did a sprint and with his help, I removed one obsolete exception-raiser from the codebase that was bugging me since some time.

Later I occasionally contributed to some projects I was using, but then around Christmas 2020 I had quite a lot of free time and I discovered outdated CI/CD configurations in dozens of Python projects, so I started systematically helping them to fix the pipelines and also to modernize their code. This is where one of my talks “There Are Python 2 Relics In Your Code!” were born. Python 2 hacks like `int(math.floor(x))` work in Python 3 but they do not make sense in modern code and should be refactored.

What are the top three things you've learned as a contributor?

Make small steps. Even smaller. If you think you've done a great bunch of work and submit a huge PR, the maintainers will have a very difficult time reviewing it and any rebase in an active project will probably stop their interest in your contribution.

Maintainers are humans with jobs paying their bills. Respect their time and energy and do not expect they're here only for you.

Comment on the project. Show how you're using it in your own work to make the maintainers feel their endeavor matters.

Is there anything else you’d like to say?

Please do not use backslashes to deliberately break lines. If there's some line length limit (whether it is 78, 80, 88, 100, or 120), it makes your code more readable. There's virtually always a possibility to reformat your code to respect this limit and avoid horizontal scrolling in editor. Every such formatting allows you to break the line at a suitable position. Breaking lines with backslashes tells the reader “you have to join these lines in your head into a very long one to understand it.”

Finally, I'd like to thank Mike for his engagement and the whole Python community for collaborating on such a marvelous set of products and the whole ecosystem around it. So happy to be a part of it!

Thanks for doing the interview, Miro!

The post PyDev of the Week: Miroslav Šedivý appeared first on Mouse Vs Python.

Categories: FLOSS Project Planets

Zato Blog: LDAP and Active Directory as Python API Services

Mon, 2022-12-05 05:41

LDAP and Active Directory often play key a role in the management of a company’s network resources yet it is not always very convenient to query a directory directly using the LDAP syntax and protocol that few people truly specialize in. This is why in this article we are using Zato to offer a REST API on top of directory services so that API clients can use REST and JSON instead.

Installing Zato

Start off by installing Zato - if you are not sure what to choose, pick the Docker Quickstart option and this will set up a working environment in a few minutes.

Creating connections

Once Zato is running, connections can be easily created in its Dashboard (by default, http://127.0.0.1:8183). Navigate to Connections -> Outgoing -> LDAP ..

.. and then click Create a new connection which will open a form as below:

The same form works for both regular LDAP and Active Directory - in the latter case, make sure that Auth type is set to NTLM.

The most important information is:

  • User credentials
  • Authentication type
  • Server or servers to connect to

Note that if authentication type is not NTLM, user credentials can be provided using the LDAP syntax, e.g. uid=MyUser,ou=users,o=MyOrganization,dc=example,dc=com.

Right after creating a connection be sure to set its password too - the password asigned by default is a randomly generated one.

Pinging

It is always prudent to ping a newly created connection to ensure that all the information entered was correct.

Note that if you have more than one server in a pool then the first available one of them will be pinged - it is the whole pool that is pinged, not a particular part of it.

Active Directory as a REST service

As the first usage example, let’s create a service that will translate JSON queries into LDAP lookups - given username or email the service will basic information about the person’s account, such as first and last name.

Note that the conn object returned by client.get() below is capable of running any commands that its underlying Python library offers - in this case we are only using searches but any other operation can also be used, e.g. add or modify as well.

# -*- coding: utf-8 -*- # stdlib from json import loads # Bunch from bunch import bunchify # Zato from zato.server.service import Service # Where in the directory we expect to find the user search_base = 'cn=users, dc=example, dc=com' # On input, we are looking users up by either username or email search_filter = '(&(|(uid={user_info})(mail={user_info})))' # On output, we are interested in username, first name, last name and the person's email query_attributes = ['uid', 'givenName', 'sn', 'mail'] class ADService(Service): """ Looks up users in AD by their username or email. """ class SimpleIO: input_required = 'user_info' output_optional = 'message', 'username', 'first_name', 'last_name', 'email' response_elem = None skip_empty_keys = True def handle(self): # Connection name to use conn_name = 'My AD Connection' # Get a handle to the connection pool with self.out.ldap[conn_name].conn.client() as client: # Get a handle to a particular connection with client.get() as conn: # Build a filter to find a user by user_info = self.request.input['user_info'] user_filter = search_filter.format(user_info=user_info) # Returns True if query succeeds and has any information on output if conn.search(search_base, user_filter, attributes=query_attributes): # This is where the actual response can be found response = conn.entries # In this case, we expect at most one user matching input criteria entry = response[0] # Convert it to JSON for easier handling .. entry = entry.entry_to_json() # .. and load it from JSON to a Python dict entry = loads(entry) # Convert to a Bunch instance to get dot access to dictionary keys entry = bunchify(entry['attributes']) # Now, actually produce a JSON response. For simplicity's sake, # assume that users have only one of email or other attributes. self.response.payload.message = 'User found' self.response.payload.username = entry.uid[0] self.response.payload.first_name = entry.givenName[0] self.response.payload.last_name = entry.sn[0] self.response.payload.email = entry.mail[0] else: # No business response = no such user found self.response.payload.message = 'No such user'

After creating a REST channel, we can invoke the service from command line, thus confirming that we can offer the directory as a REST service:

$ curl "localhost:11223/api/get-user?user_info=MyOrganization\\MyUser" ; echo { "message": "User found", "username": "MyOrganization\\MyUser", "first_name": "First", "last_name": "Last", "email": "address@example.com" } $ Next steps
  • Start the tutorial to learn more technical details about Zato, including its architecture, installation and usage. After completing it, you will have a multi-protocol service representing a sample scenario often seen in banking systems with several applications cooperating to provide a single and consistent API to its callers.

  • Check more resources for developers and screenshots.

  • Para aprender más sobre las integraciones de Zato y API en español, haga clic aquí

Categories: FLOSS Project Planets

Podcast.__init__: Declarative Machine Learning For High Performance Deep Learning Models With Predibase

Sun, 2022-12-04 19:42
Deep learning is a revolutionary category of machine learning that accelerates our ability to build powerful inference models. Along with that power comes a great deal of complexity in determining what neural architectures are best suited to a given task, engineering features, scaling computation, etc. Predibase is building on the successes of the Ludwig framework for declarative deep learning and Horovod for horizontally distributing model training. In this episode CTO and co-founder of Predibase, Travis Addair, explains how they are reducing the burden of model development even further with their managed service for declarative and low-code ML and how they are integrating with the growing ecosystem of solutions for the full ML lifecycle.Preamble

This is a cross-over episode from our new show The Machine Learning Podcast, the show about going from idea to production with machine learning.

Summary

Deep learning is a revolutionary category of machine learning that accelerates our ability to build powerful inference models. Along with that power comes a great deal of complexity in determining what neural architectures are best suited to a given task, engineering features, scaling computation, etc. Predibase is building on the successes of the Ludwig framework for declarative deep learning and Horovod for horizontally distributing model training. In this episode CTO and co-founder of Predibase, Travis Addair, explains how they are reducing the burden of model development even further with their managed service for declarative and low-code ML and how they are integrating with the growing ecosystem of solutions for the full ML lifecycle.

Announcements
  • Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great!
  • When you’re ready to launch your next app or want to try a project you hear about on the show, you’ll need somewhere to deploy it, so take a look at our friends over at Linode. With their managed Kubernetes platform it’s easy to get started with the next generation of deployment and scaling, powered by the battle tested Linode platform, including simple pricing, node balancers, 40Gbit networking, dedicated CPU and GPU instances, and worldwide data centers. And now you can launch a managed MySQL, Postgres, or Mongo database cluster in minutes to keep your critical data safe with automated backups and failover. Go to pythonpodcast.com/linode and get a $100 credit to try out a Kubernetes cluster of your own. And don’t forget to thank them for their continued support of this show!
  • Your host is Tobias Macey and today I’m interviewing Travis Addair about Predibase, a low-code platform for building ML models in a declarative format
Interview
  • Introduction
  • How did you get involved in machine learning?
  • Can you describe what Predibase is and the story behind it?
  • Who is your target audience and how does that focus influence your user experience and feature development priorities?
  • How would you describe the semantic differences between your chosen terminology of "declarative ML" and the "autoML" nomenclature that many projects and products have adopted?
    • Another platform that launched recently with a promise of "declarative ML" is Continual. How would you characterize your relative strengths?
  • Can you describe how the Predibase platform is implemented?
    • How have the design and goals of the product changed as you worked through the initial implementation and started working with early customers?
    • The operational aspects of the ML lifecycle are still fairly nascent. How have you thought about the boundaries for your product to avoid getting drawn into scope creep while providing a happy path to delivery?
  • Ludwig is a core element of your platform. What are the other capabilities that you are layering around and on top of it to build a differentiated product?
  • In addition to the existing interfaces for Ludwig you created a new language in the form of PQL. What was the motivation for that decision?
    • How did you approach the semantic and syntactic design of the dialect?
    • What is your vision for PQL in the space of "declarative ML" that you are working to define?
  • Can you describe the available workflows for an individual or team that is using Predibase for prototyping and validating an ML model?
    • Once a model has been deemed satisfactory, what is the path to production?
  • How are you approaching governance and sustainability of Ludwig and Horovod while balancing your reliance on them in Predibase?
  • What are some of the notable investments/improvements that you have made in Ludwig during your work of building Predibase?
  • What are the most interesting, innovative, or unexpected ways that you have seen Predibase used?
  • What are the most interesting, unexpected, or challenging lessons that you have learned while working on Predibase?
  • When is Predibase the wrong choice?
  • What do you have planned for the future of Predibase?
Contact Info Parting Question
  • From your perspective, what is the biggest barrier to adoption of machine learning today?
Closing Announcements
  • Thank you for listening! Don’t forget to check out our other shows. The Data Engineering Podcast covers the latest on modern data management. The Machine Learning Podcast helps you go from idea to production with machine learning.
  • Visit the site to subscribe to the show, sign up for the mailing list, and read the show notes.
  • If you’ve learned something or tried out a project from the show then tell us about it! Email hosts@podcastinit.com) with your story.
  • To help other people find the show please leave a review on iTunes and tell your friends and co-workers
Links

The intro and outro music is from Hitman’s Lovesong feat. Paola Graziano by The Freak Fandango Orchestra/CC BY-SA 3.0

Categories: FLOSS Project Planets

Brian Okken: Testing with Python 3.12

Sun, 2022-12-04 19:00
Python 3.12.0a2 is out. So now may be a great time to get your projects to start testing against 3.12. Note about alpha releases of Python This is from the same link as above: “During the alpha phase, features may be added up until the start of the beta phase (2023-05-08) and, if necessary, may be modified or deleted up until the release candidate phase (2023-07-31). Please keep in mind that this is a preview release and its use is not recommended for production environments.
Categories: FLOSS Project Planets

John Ludhi/nbshare.io: ERROR Could not find a version that satisfies the requirement numpy==1 22 3

Sun, 2022-12-04 02:39
ERROR: Could not find a version that satisfies the requirement numpy==1.22.3

You might run in to following error if you try to install numpy version 1.22+.
The reason is mostly the wrong Python version as shown below.

In [2]: pip --version pip 22.2.2 from /home/anaconda3/envs/py373/lib/python3.7/site-packages/pip (python 3.7) Note: you may need to restart the kernel to use updated packages. In [7]: !python --version Python 3.7.3 In [8]: !pip install numpy==1.22.3 ERROR: Ignored the following versions that require a different python version: 1.22.0 Requires-Python >=3.8; 1.22.0rc1 Requires-Python >=3.8; 1.22.0rc2 Requires-Python >=3.8; 1.22.0rc3 Requires-Python >=3.8; 1.22.1 Requires-Python >=3.8; 1.22.2 Requires-Python >=3.8; 1.22.3 Requires-Python >=3.8; 1.22.4 Requires-Python >=3.8; 1.23.0 Requires-Python >=3.8; 1.23.0rc1 Requires-Python >=3.8; 1.23.0rc2 Requires-Python >=3.8; 1.23.0rc3 Requires-Python >=3.8; 1.23.1 Requires-Python >=3.8; 1.23.2 Requires-Python >=3.8; 1.23.3 Requires-Python >=3.8; 1.23.4 Requires-Python >=3.8; 1.23.5 Requires-Python >=3.8; 1.24.0rc1 Requires-Python >=3.8 ERROR: Could not find a version that satisfies the requirement numpy==1.22.3 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3, 1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0rc1, 1.17.0rc2, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0rc1, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0rc1, 1.19.0rc2, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0rc1, 1.20.0rc2, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0rc1, 1.21.0rc2, 1.21.0, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6) ERROR: No matching distribution found for numpy==1.22.3 How to fix error - Could not find a version that satisfies the requirement numpy==1.22.3

Install Python3.8 or Python3.8+

In [1]: !python --version Python 3.8.0 In [14]: !pip install numpy==1.22.3 Collecting numpy==1.22.3 Using cached numpy-1.22.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB) Installing collected packages: numpy Successfully installed numpy-1.22.3 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Categories: FLOSS Project Planets

John Ludhi/nbshare.io: Understand Python Slicing

Sat, 2022-12-03 23:39
Understand Python Slicing

Python slicing is used to slice lists or tuples. Let us learn Python slicing through examples.

Let us declare a Python list.

In [1]: x = [1,2,3,4,5,6,7,8,9]

Python slicing can be used in two ways...
x[start:stop:step] -- Start through stop-1
x[slice(start,stop,step) -- Start through stop-1

In [2]: x[0:1] Out[2]: [1] In [3]: x[0:1:1] Out[3]: [1] In [4]: x[slice(0,1)] Out[4]: [1] In [5]: x[slice(0,1,1)] Out[5]: [1]

Note step parameter is optional, by default it is 1.

Python slice all but first element In [6]: x[1:] Out[6]: [2, 3, 4, 5, 6, 7, 8, 9] Python slice all but last element In [7]: x[:8] Out[7]: [1, 2, 3, 4, 5, 6, 7, 8] Python slice and copy the whole list In [8]: x[:] Out[8]: [1, 2, 3, 4, 5, 6, 7, 8, 9] Python slice every other element in the list

The below command means start from index 0 and extract every 2nd element.
index 0 , index (2) 0 +2, index (4) 0 + 2 +2, index (6) 0 + 2 + 2 +2 , index (8) 0 + 2 + 2 + 2 +2

Note two colons in the below syntax. There is nothing between Ist and 2nd colon that means evreything from start to end of list.

In [9]: x[0::2] Out[9]: [1, 3, 5, 7, 9] Python Slicing - Negative and Positive step values

Negative step of -1 means go from right to left
Positive step of 1 means go from left to right

Python slicing using negative indices

Negative number -1 means last element, -2 means seconda last element so on and so forth.

In [10]: x[-1] Out[10]: 9

The below syntax will print nothing, because index is starting from -1 which means last element in the list then it goes to index 0 because by default step is 1 but our "stop" is -3. To fix this we will have to give step of -1.

In [11]: x[-1:-3] Out[11]: []

As we can see, the index will start from -1, the last element, then goes to -2 because step is -1, then stops at -3

In [12]: x[-1:-3:-1] Out[12]: [9, 8] Python Reverse all the items in the array using Slicing In [13]: x[::-1] Out[13]: [9, 8, 7, 6, 5, 4, 3, 2, 1]

Note in the above, since step is -1, Python considers start:stop as -1:-10, we can re-write above as shown below.

In [14]: x[-1:-10:-1] Out[14]: [9, 8, 7, 6, 5, 4, 3, 2, 1]

print last 3 elements. Note below syntax means -3 to last element (right to left) and step is 1 by default

In [15]: x[-3:] Out[15]: [7, 8, 9]

Below syntax means, start at -3 index, then go to (-5) -3-2 so on and so forth to all the way to start of the list (right to left) because step is -1.

In [16]: x[-3::-2] Out[16]: [7, 5, 3, 1] Python Slicing - Reverse first two items In [17]: x[1::-1] Out[17]: [2, 1]

Let us see how did the above slicing syntax works.
The index will start at...
index 1, index (0) 1-1
Note -1 tells it go from right to left

In [18]: x[1::-1] Out[18]: [2, 1] Python Everything Except the last two items - Reversed In [19]: x[-3::-1] Out[19]: [7, 6, 5, 4, 3, 2, 1]

Note all the above can be used with slice method. The different is instead of ":" (colon) use None to indicate end or start of list index.

In [20]: x[slice(-3,None,-1)] Out[20]: [7, 6, 5, 4, 3, 2, 1]
Categories: FLOSS Project Planets

Peter Hoffmann: beautiful leaflet markers with folium and fontawesome

Sat, 2022-12-03 19:00

Folium is a Python library that allows users to create and display interactive maps. The library uses the Leaflet.js library and is capable of creating powerful and visually appealing maps. Folium can be used to visualize geographical data by adding markers, polygons, heatmaps, and other geographical elements onto a map. The library is easy to use and offers a range of options for customizing the maps and the elements that are displayed on them.

Minimal marker

The minimal example just adds a marker at a specific location:

import folium loc = [45.957916666667, 7.8123888888889] m = folium.Map(location=loc, zoom_start=13) folium.Marker( location=loc ).add_to(m) m

Marker with a bootstrap icon

Markers can be customized through providing a Icon instance. As a default you can use bootstrap glyphicons that provide over 250 glyphs for free:

In addition you can colorize the marker. Available color names are red blue green purple orange darkred lightred beige darkblue darkgreen cadetblue darkpurple white pink lightblue lightgreen gray black lightgray .

m = folium.Map(location=loc) folium.Marker( location=loc, icon=folium.Icon(icon="home", color="purple", icon_color="blue") ).add_to(m)

Marker with a fonteawesome icon

Font Awesome is a collection of scalable vector icons that can be customized and used in a variety of ways, such as in graphic design projects, websites, and applications. The icons are available in different styles, including Solid, Regular, and Brands, and can be easily integrated by adding the fa prefix

m = folium.Map(location=loc) folium.Marker( location=loc, icon=folium.Icon(icon="tents", prefix='fa') ).add_to(m)

Extended Marker Customization with BeautifulIcons

The Leaflet Beautiful Icons is lightweight plugin that adds colorful iconic markers without images for Leaflet by giving full control of style to end user ( i.e. unlimited colors and many more...).

It ist exposed to folium via the Beautiful Icon plugin

Supported icon shapes are circle circle-dot doughnut rectangle rectangle-dot marker and the color be either one of the predefined or any valid hex code.

import folium.plugins as plugins folium.Marker( location=loc, icon=plugins.BeautifyIcon( icon="tent", icon_shape="circle", border_color='purple', text_color="#007799", background_color='yellow' ) ).add_to(m)

Categories: FLOSS Project Planets

Declassed Art: Declassed Plausible Deniability Toolkit

Fri, 2022-12-02 19:00
How to make your computer looking an innocent toy, used only to play tux racer and watch cats on youtube. Forensics would find the data with abnormally high entropy in unused sectors, a few suspicious tweaks in your system, but none of explicit evidences of encryption. This may help to avoid rubber-hose cryptanalysis, highly possible if you used LUKS, Tomb, Shufflecake, or simply encrypted your files.
Categories: FLOSS Project Planets

Pages