Skip to main content

Ubuntu Archive Mirror reporting tool for apt sources configuration

Project description

Find a fast, up-to-date Ubuntu Archive Mirror.

Features

  • Tests latency to mirrors in a given country’s mirror list at mirrors.ubuntu.com.
    • 3 requests are sent to each mirror, minumum round trip time being used for rank.

  • Reports latency, status, and bandwidth capacity of the fastest mirrors in a ranked list.
    • Status and bandwidth are scraped from launchpad.

  • Generates sources.list file using new mirror.
    • New mirror can be chosen from a list or selected automatically using the top ranked mirror (default).

Installation

Target most recent release:

pip install apt-select

or:

pip3 install apt-select

Target project master branch:

pip install git+https://github.com/jblakeman/apt-select.git

or:

git clone https://github.com/jblakeman/apt-select
python apt-select/setup.py install

Invocation

$ apt-select --help
usage: apt-select [-h] [-C [COUNTRY]] [-t [NUMBER]] [-m [STATUS] | -p]
                  [-c | -l]

Find the fastest Ubuntu apt mirrors.
Generate new sources.list file.

optional arguments:
  -h, --help            show this help message and exit
  -C [COUNTRY], --country [COUNTRY]
                        specify a country to test its list of mirrors
                        used to match country list file names found at mirrors.ubuntu.com
                        COUNTRY should follow ISO 3166-1 alpha-2 format
                        default: US
  -t [NUMBER], --top-number [NUMBER]
                        specify number of mirrors to return
                        default: 1
  -m [STATUS], --min-status [STATUS]
                        return mirrors with minimum status
                        choices:
                           up-to-date
                           one-day-behind
                           two-days-behind
                           one-week-behind
                           unknown
                        default: up-to-date
  -p, --ping-only       rank mirror(s) by latency only, disregard status(es)
                        cannot be used with -m/--min-status
  -c, --choose          choose mirror from a list
                        requires -t/--top-num NUMBER where NUMBER > 1
  -l, --list            print list of mirrors only, don't generate file
                        cannot be used with -c/--choose

The exit code is 0 on success, 1 on error, and 4 if sources.list already has the chosen
mirror and a new one was not generated.

Examples

Get the top mirror from the United Kingdom to generate a new sources.list::

apt-select --country GB

Choose from the top 3 mirrors, including those last updated a week ago::

apt-select -c -t 3 -m one-week-behind

Find the top 10 mirrors, output latency info only, and don’t generate new sources.list::

apt-select -t 10 -p -l

After new sources.list is generated in current working directory, backup and replace to update apt::

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup && \
sudo mv sources.list /etc/apt/

Supported URI Types

Currently, http, https and ftp are supported.

/etc/apt/sources.list should contain sources in the following format::

[deb|deb-src] [http|https|ftp]://mirror.example.com/path [component1] [component2] [...]

Dependencies

Python HTML parser, BeautifulSoup.

HTTP Requests library, requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apt-select-2.2.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

apt_select-2.2.0-py3.7.egg (27.6 kB view details)

Uploaded Egg

apt_select-2.2.0-py2.py3-none-any.whl (14.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file apt-select-2.2.0.tar.gz.

File metadata

  • Download URL: apt-select-2.2.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for apt-select-2.2.0.tar.gz
Algorithm Hash digest
SHA256 65a446aaa119389f65e7e00b337ca2fcbca0626d4466b6dd7934e2be7d3c4346
MD5 fbddcf83600f5aa9b26ac0180d7d5466
BLAKE2b-256 2f605d26706e1e4f755f5860752921b8351bb5b681042ced226862318917d38a

See more details on using hashes here.

File details

Details for the file apt_select-2.2.0-py3.7.egg.

File metadata

  • Download URL: apt_select-2.2.0-py3.7.egg
  • Upload date:
  • Size: 27.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for apt_select-2.2.0-py3.7.egg
Algorithm Hash digest
SHA256 c00e4b392c7d48c47de4ee2eee8764cb5ccda42e0a80ad1968b3685bd1f89da9
MD5 2252cc03dd678a65510865a374cdd37a
BLAKE2b-256 0b93e6c1a8910f95e05dd2899982bba615a3dbed04925ab9a7871429775cd6a7

See more details on using hashes here.

File details

Details for the file apt_select-2.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: apt_select-2.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for apt_select-2.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 05a273e9e20ec8efa3faef8c6e5b2abd3c4f5ae585c767389f37f12e0218dc69
MD5 1529a79c7a76cf77ec80b0067793b692
BLAKE2b-256 6ef09c7b52ec57f7682477108f5f64ba3ed133184f9fc242c140b3a66e96bbbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page