Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

#255: Closember eve, the cure for Hacktoberfest?

Published Wed, Oct 20, 2021, recorded Wed, Oct 20, 2021

Watch the live stream:

Watch this episode on YouTube
Play on YouTube
Watch the live stream replay

About the show

Sponsored by us:

Special guest: Will McGugan

Michael #1: Wrapping C++ with Cython

  • By Anton Zhdan-Pushkin
  • A small series showcasing the implementation of a Cython wrapper over a C++ library.
  • C library: yaacrl - Yet Another Audio Recognition Library is a small Shazam-like library, which can recognize songs using a small recorded fragment.
  • For Cython to consume yaacrl correctly, we need to “teach” it about the API using `cdef extern
  • It is convenient to put such declarations in *.pxd files.
  • One of the first features of Cython that I find extremely useful — aliasing. With aliasing, we can use names like Storage or Fingerprint for Python classes without shadowing original C++ classes.
  • Implementing a wrapper: pyaacrl - The most common way to wrap a C++ class is to use Extension types. As an extension type a just a C struct, it can have an underlying C++ class as a field and act as a proxy to it.
  • Cython documentation has a whole page dedicated to the pitfalls of “Using C++ in Cython.”
  • Distribution is hard, but there is a tool that is designed specifically for such needs: scikit-build.
  • PyBind11 too

Brian #2: tbump : bump software releases

  • suggested by Sephi Berry
  • limits the manual process of updating a project version
  • tbump init 1.2.2 initializes a tbump.toml file with customizable settings
    • --pyproject will append to pyproject.toml instead
  • tbump 1.2.3 will
    • patch files: wherever the version listed
    • (optional) run configured commands before commit
      • failing commands stop the bump.
    • commit the changes with a configurable message
    • add a version tag
    • push code
    • push tag
    • (optional) run post publish command
    • Tell you what it’s going to do before it does it. (can opt out of this check)
  • pretty much everything is customizable and configurable.
  • I tried this on a flit based project. Only required one change

        # For each file to patch, add a [[file]] config
        # section containing the path of the file, relative to the
        # tbump.toml location.
        src = ""
        search = '__version__ = "{current_version}"'
  • cool example of a pre-commit check:

        #  [[before_commit]]
        #  name = "check changelog"
        #  cmd = "grep -q {new_version} Changelog.rst"

Will #3: Closember by Matthias Bussonnier

Michael #4: scikit learn goes 1.0

  • via Brian Skinn
  • The library has been stable for quite some time, releasing version 1.0 is recognizing that and signalling it to our users.
  • Features:
  • Keyword and positional arguments - To improve the readability of code written based on scikit-learn, now users have to provide most parameters with their names, as keyword arguments, instead of positional arguments.
  • Spline Transformers - One way to add nonlinear terms to a dataset’s feature set is to generate spline basis functions for continuous/numerical features with the new SplineTransformer.
  • Quantile Regressor - Quantile regression estimates the median or other quantiles of Y conditional on X
  • Feature Names Support - When an estimator is passed a pandas’ dataframe during fit, the estimator will set a feature_names_in_ attribute containing the feature names.
  • A more flexible plotting API
  • Online One-Class SVM
  • Histogram-based Gradient Boosting Models are now stable
  • Better docs

Brian #5: Using devpi as an offline PyPI cache

  • Jason R. Coombs
  • This is the devpi tutorial I’ve been waiting for.
  • Single machine local server mirror of PyPI (mirroring needs primed), usable in offline mode.

        $ pipx install devpi-server
        $ devpi-init
        $ devpi-server
  • now in another window, prime the cache by grabbing whatever you need, with the index redirected

        (venv) $ export PIP_INDEX_URL=http://localhost:3141/root/pypi/
        (venv) $ pip install pytest, ...
  • then you can restart the server anytime, or even offline

         $ devpi-server --offline
  • tutorial includes examples, proving how simple this is.

Will #6: PyPi command line



  • I’ve started using pyenv on my Mac just for downloading Python versions. Verdict still out if I like it better than just downloading from
  • Also started using Starship with no customizations so far. I’d like to hear from people if they have nice Starship customizations I should try.
  • is a thing, announcement just today




Want to go deeper? Check our projects