The purpose of this document is to list all of the notable changes to this project. The format was inspired by Keep a Changelog. This project adheres to semantic versioning.

Release 7.1.3 (2020-5-31)

Release 7.1.2 (2019-11-28)

  • Support Python 3.8
  • Add -C –codename flag to create chroot with a distribution codename.
  • Blacklist BASE_URL mirror if matches blacklist pattern, this helps when BASE_URL (official) mirror is the only up-to-date one and you find it so slow that you’d like to blacklist it.

Release 7.1.1 (2019-11-04)

  • For Linux Mint, backup official-package-repositories.list to backup_dir: backup_by_apt-smart
  • In Readme, add install commands for Linux Mint and a note about run with sudo

Release 7.1.0 (2019-11-01)

  • Add support for Linux Mint
  • Add -U, –ubuntu to opt in Ubuntu mode for Linux Mint to deal with upstream Ubuntu mirror instead of Linux Mint mirror. e.g. –auto-change-mirror –ubuntu will auto-change Linux Mint’s upstream Ubuntu mirror

Release 7.0.7 (2019-9-30)

  • Fix install_sources_list() for Python 3
  • Fix –change-mirror
  • fix Travis CI  io.UnsupportedOperation:fileno error by changing the way to run test cases containing smart_update()
  • More test cases

Release 7.0.6 (2019-9-25)

  • Readme & help about proxy setting
  • Deal with the [options] in sources.list by stripping it from sources.list, and then get it back when generating new sources.list , fix
  • Add a warning: custom mirror file’s path and filename must NOT contain whitespace
  • Add -R, –create-chroot=local_dir_absolute_path to create chroot with the best mirror in a local directory with absolute_path
  • More test cases

Release 7.0.5 (2019-9-21)

  • Add -F, –file-to-read=local_file_absolute_path (path and filename must NOT contain whitespace) to read a local absolute path file containing custom mirror URLs (one URL per line) to add custom mirrors to rank. So now you can use e.g. -l -F ~/mirrors.txt options to add some custom mirrors to rank with mirrors in official mirror list.

Release 7.0.4 (2019-9-20)

Release 7.0.3 (2019-9-19)

  • Fix –url-char-len option to specify the length of chars in mirrors’ URL to display when using –list-mirrors, so that now you can use e.g. -l -L 29 options to narrow down the table of ranked mirrors when you want to paste it to somewhere the table displayed badly.

Release 7.0.2 (2019-9-19)

  • Add :attr:url_char_len to specify the length of chars in mirrors’ URL to display when using –list-mirrors, so that now you can use e.g. -l -L 29 options to narrow down the table of ranked mirrors when you want to paste it to somewhere the table displayed badly.

Release 7.0.1 (2019-9-18)

  • Better output format when use –list-mirrors

Release 7.0 (2019-9-15)

  • Rename the project and module to apt-smart
  • For Ubuntu, new mirrors discovery mechanism: at first it queries MIRROR_SELECTION_URL, and MIRRORS_URL as fallback.
  • For Debian, new mirrors discovery mechanism: get mirrors within the country which the user is in.
  • New mechanism of determining whether a mirror is up-to-date: download the InRelease file and parse the Date value in it.
  • New and more robust distribution_codename using APT sources.list
  • Enable retry when fetch_url is timeout for bad connections.
  • Drop Python 2.6 support and add Python 3.7
  • Drop max_mirrors limit since we can smartly get mirrors within the user’s country.

Release 6.1 (2018-10-19)

  • Bug fix for Ubuntu keyring selection that prevented ubuntu-archive-removed-keys.gpg from being used.
  • Bug fix for coerce_release() when given a release number.
  • Moved pathnames of Debian and Ubuntu keyring files to constants.
  • Added logging to enable debugging of keyring selection process.
  • Added proper tests for keyring selection and release coercion.

Release 6.0 (2018-10-14)

Enable the creation of Ubuntu <= 12.04 chroots on Ubuntu >= 17.04 hosts by working around (what I am convinced is) a bug in debootstrap which picks the wrong keyring when setting up chroots of old releases. For more information refer to issue #8.

I’ve bumped the major version number for this release because the highly specific apt_smart.eol module changed into the much more generic apt_smart.releases module. Also the release_label property was removed.

Release 5.2 (2018-10-08)

Use without placing our full trust in it like older versions of apt-smart did 😇.

Feedback in issue #6 suggested that is working properly (again) and should be preferred over scraping Launchpad. However I prefer for apt-smart to be a reliable “do what I mean” program and has proven to be unreliable in the past (see the discussion in #6). As a compromise I’ve changed the Ubuntu mirror discovery as follows:

  1. Discover Ubuntu mirrors on Launchpad.
  2. Try to discover mirrors using and iff successful, narrow down the list produced in step 1 based on the URLs reported in step 2.
  3. Rank the discovered / narrowed down mirrors and pick the best one.

The reason why I’ve decided to add this additional complexity is because it has bothered me in the past that Ubuntu mirror discovery was slow and this does help a lot. Also, why not use a service provided by Ubuntu to speed things up?

Unrelated to the use of I’ve also bumped the executor requirement (twice) in order to pull in upstream improvements discussed in executor issue #10 and executor issue #15.

Release 5.1 (2018-06-22)

Work on release 5.1 started with the intention of publishing a 5.0.2 bug fix release for the EOL detection of Debian LTS releases reported in #5, however unrelated changes were required to stabilize the test suite. This explains how 5.0.2 became 5.1 😇.

When I started working on resolving the issue reported in #5 it had been quite a while since the previous release (233 days) and so some technical debt had accumulated in the project, causing the test suite to break. Most significantly, Travis CI switched their workers from Ubuntu 12.04 to 14.04.

Here’s a detailed overview of changes:

  • Bug fix for EOL detection of Debian LTS releases (reported in #5).
  • Bug fix for trivial string matching issue in test suite (caused by a naively written test).
  • Bug fix for recursive repr() calls potentially causing infinite recursion, depending on logging level (see e.g. build 395421319).
  • Updated bundled EOL dates based on distro-info-data available in Ubuntu 18.04.
  • Added this changelog to the documentation, including a link in the readme.
  • Make sure the test_gather_eol_dates test method runs on Travis CI (by installing the distro-info-data package). This exposed a Python 3 incompatibility (in build 395410569) that has since been resolved.
  • Include documentation in source distributions (
  • Silence flake8 complaining about bogus D402 issues.
  • Add license=’MIT’ key to script.
  • Bumped copyright to 2018.

Release 5.0.1 (2017-11-01)

Bug fix release for invalid enumeration value (oops).

Release 5.0 (2017-11-01)

Reliable end of life (EOL) detection.

Recently I ran into the issue that the logic to check whether a release is EOL (that works by checking if the security mirror serves a Release.gpg file for the release) failed on me. More specifically the following URL existed at the time of writing (2017-11-01) even though Ubuntu 12.04 went EOL back in April:

At the same time issue #1 and pull request #2 were also indications that the EOL detection was fragile and error prone. This potential fragility had bugged me ever since publishing apt-smart and this week I finally finished a more robust and deterministic EOL detection scheme.

This release includes pull requests #2 and #4, fixing issues #1 and #3. Here’s a detailed overview of changes:

  • Addition: Allow optional arguments to apt-get update (#3, #4).
    • I simplified and improved the feature requested in issue #3 and implemented in pull request #4 by switching from an optional list argument to ‘star-args’ and applying the same calling convention to smart_update() as well.
    • This is backwards incompatible with the implementation in pull request #4 (which I merged into the dev branch but never published to PyPI) and it’s also technically backwards incompatible in the sense that keyword arguments could previously be given to smart_update() as positional arguments. This explains why I’m bumping the major version number.
  • Bug fix for incorrect marking of EOL when HTTP connections fail (#2).
  • Refactoring: Apply timeout handling to HTTP response bodies.
  • Refactoring: Distinguish 404 from other HTTP errors:
    • This change enhances validate_mirror() by making a distinction between a confirmed HTTP 404 response versus other error conditions which may be of a more transient nature.
    • The goal of this change is to preserve the semantics requested in issue #1 and implemented in pull request #2 without needing the additional HTTP request performed by can_connect_to_mirror().
    • Because validate_mirror() previously returned a boolean but now returns an enumeration member this change is technically backwards incompatible, then again validate_mirror() isn’t specifically intended for callers because it concerns internal logic of apt-smart. I’m nevertheless bumping the major version number.
  • Refactoring: Improve HTTP request exception handling:
    • 404 responses and timeouts are no longer subject to retrying.
    • The exception apt_smart.http.NotFoundError is now raised on HTTP 404 responses. Other unexpected HTTP response codes raise apt_smart.http.InvalidResponseError.
    • The specific distinction between 404 and !200 was made because the 404 response has become significant in checking for EOL status.

Release 4.0 (2017-06-14)

Robust validation of available mirrors (backwards incompatible).

Release 3.1 (2017-06-13)

Made mirror comparison more robust.

Release 3.0 (2017-06-13)

Added Debian archive support (with old releases):

  • Addition: Added Debian archive support (old releases).
  • Improvement: Don’t bother validating archive / old-releases mirror.
  • Refactoring: Moved URLs to backend specific modules.

Release 2.1 (2017-06-12)

Restored Python 3 compatibility, improved robustness:

  • Improvement: Make the is_available and is_updating properties of the CandidateMirror class more robust.
  • Bug fix: I suck at Unicode in Python (most people do :-p).
  • Cleanup: Remove unused import from test suite.

Release 2.0 (2017-06-11)

Generation of sources.list files and chroot creation.

Detailed overview of changes:

  • Addition: Added a simple debootstrap wrapper.
  • Addition: Programmatic /etc/apt/sources.list generation
  • Bug fix for check_suite_available().
  • Bug fix: Never apply Ubuntu’s old release handling to Debian.
  • Bug fix: Never remove /var/lib/apt/lists/lock file.
  • Improvement: Enable stable mirror selection
  • Improvement: Make it possible to override distributor ID and codename
  • Improvement: Render interactive spinner during mirror ranking.
  • Refactoring: Generalize AptMirrorUpdater initializer (backwards incompatible!)
  • Refactoring: Generalize backend module loading
  • Refactoring: Modularize /etc/apt/sources.list writing.

Release 1.0 (2017-06-08)

Improved Ubuntu mirror discovery, added an automated test suite, and more.

The bump to version 1.0 isn’t so much intended to communicate that this is now mature software, it’s just that I made several backwards incompatible changes in order to improve the modularity of the code base, make it easier to develop automated tests, maintain platform support, etc :-).

A more detailed overview of (significant) changes:

  • Improved Ubuntu mirror discovery (by scraping Launchpad instead).
  • Extracted mirror discovery to separate (backend specific) modules.
  • Extracted HTTP handling to a separate module.
  • Enable Control-C to interrupt concurrent connection tests.
  • Expose limit in Python API and command line interface and make limit optional by passing 0.
  • Bug fix for Python 3 incompatibility: Stop using sys.maxint :-).

Release 0.3.1 (2016-06-29)

Avoid ‘nested’ smart updates (the old code worked fine but gave confusing output and performed more work than necessary, which bothered me :-).

Release 0.3 (2016-06-29)

Make smart update understand EOL suites

Release 0.2 (2016-06-29)

Bug fix: Replace as well.

Release 0.1.2 (2016-06-29)

Bug fix: Explicitly terminate multiprocessing pool.

Release 0.1.1 (2016-03-10)

Initial release (added

Release 0.1 (2016-03-10)

Initial commit.