importlib — Python’s Import Mechanism — PyMOTW 3

The importlib module includes functions that the underlying implementation of Python’s import mechanism for loading code in packages and modules, all implemented in Python. It is one access point to importing modules dynamically, and useful in some cases where the name of the module that needs to be imported is unknown when the code is written (for example, for plugins or extensions to an application).

Read more…

This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

demoshell 0.1.0

demoshell is a simplified shell for live demonstrations. It always shows the command prompt at the top of the screen and pushes command output down instead of letting it scroll up.

This is the first public release of demoshell, a new program inspired by a tweet  (and my own personal annoyance). h/t to @vmbrasseur for retweeting  @genehack.

Huh?

POSIX shells print their output in such a way that it scrolls up and off the top of the screen because they are using tty semantics, which are based on hardware that used to literally print everything on a roll of paper that moved up through the machine and over the top.

It’s the 21st century. We don’t use paper-based terminals any more. While continuing to pretend we do is fine for day-to-day work, when we are giving live presentations it is not ideal because the most interesting thing you are doing is probably at the bottom of your screen during a live demo. That is the hardest part of the screen for people at the back of the room to see, because it is often blocked by other people’s heads.

demoshell avoids this problem by always keeping the command prompt at the top of the screen and showing the output of commands below, pushing older commands off of the bottom of the screen to make space for newer text.

Check the readme file for installation instructions. Patches and bug reports are welcome!

urllib.robotparser — Internet Spider Access Control — PyMOTW 3

robotparser implements a parser for the robots.txt file format, including a function that checks if a given user agent can access a resource. It is intended for use in well-behaved spiders, or other crawler applications that need to either be throttled or otherwise restricted.

Read more…

This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

sphinxcontrib-spelling 4.1.0

sphinxcontrib-spelling is a spelling checker for Sphinx-based documentation. It uses PyEnchant to produce a report showing misspelled words.

What’s new in 4.1.0?

  • Make it possible to provide several wordlists (contributed by Tobias Olausson)
  • Update developer documentation (contributed by Tobias Olausson)
  • Update home page link (contributed by Devin Sevilla)

New owner and package for name “bartender” on PyPI

A few days ago Logan Jones contacted me about my Python package bartender, to ask if I would let him use the name since the package I published is unmaintained. Since it is also (as far as I know) unused, I agreed.

I don’t know what happens to the name if I delete the existing entry, so I’ve given him Owner rights to it so he can publish packages to overwrite what is there now rather than deleting the entry and having neither of us able to use it again.

So, if you’ve been using bartender for composing WSGI applications and having it suddenly not installable from PyPI, let me know and I will publish it under a different name or I will help you take over management and publish the new version.

unittest — Automated Testing Framework — PyMOTW 3

Python’s unittest module is based on the XUnit framework design by Kent Beck and Erich Gamma. The same pattern is repeated in many other languages, including C, Perl, Java, and Smalltalk. The framework implemented by unittest supports fixtures, test suites, and a test runner to enable automated testing.

Read more…

This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.