tqdm

Форк
0
/
mksnap.py 
70 строк · 2.2 Кб
1
# -*- encoding: utf-8 -*-
2
"""
3
Auto-generate snapcraft.yaml.
4
"""
5
import sys
6
from pathlib import Path
7
from subprocess import check_output  # nosec
8

9
sys.path.insert(1, str(Path(__file__).parent.parent))
10
import tqdm  # NOQA
11

12
snap_yml = r"""name: tqdm
13
summary: A fast, extensible CLI progress bar
14
description: |
15
 https://tqdm.github.io
16

17
 `tqdm` means "progress" in Arabic (taqadum, تقدّم) and is an
18
 abbreviation for "I love you so much" in Spanish (te quiero demasiado).
19

20
 Instantly make your loops show a smart progress meter and stats - just
21
 replace any pipe "`|`" with "`| tqdm |`", and you're done!
22

23
 ```sh
24
 $ seq 9999999 | tqdm --bytes | wc -l
25
 75.2MB [00:00, 217MB/s]
26
 9999999
27
 $ 7z a -bd -r backup.7z docs/ | grep Compressing | \
28
     tqdm --total $(find docs/ -type f | wc -l) --unit files >> backup.log
29
 100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
30
 ```
31

32
 Overhead is low -- about 60ns per iteration.
33

34
 In addition to its low overhead, `tqdm` uses smart algorithms to predict
35
 the remaining time and to skip unnecessary iteration displays, which
36
 allows for a negligible overhead in most cases.
37

38
 `tqdm` works on any platform (Linux, Windows, Mac, FreeBSD, NetBSD,
39
 Solaris/SunOS), in any console or in a GUI, and is also friendly with
40
 IPython/Jupyter notebooks.
41

42
 `tqdm` does not require any dependencies, just
43
 an environment supporting `carriage return \r` and
44
 `line feed \n` control characters.
45
grade: stable
46
confinement: strict
47
base: core22
48
icon: logo.png
49
version: '{version}'
50
license: MPL-2.0
51
parts:
52
  tqdm:
53
    plugin: python
54
    source: .
55
    source-commit: '{commit}'
56
    python-packages: [.]
57
    build-packages: [git]
58
    override-build: |
59
        craftctl default
60
        cp $SNAPCRAFT_PART_BUILD/tqdm/completion.sh $SNAPCRAFT_PART_INSTALL/
61
apps:
62
  tqdm:
63
    command: bin/tqdm
64
    completer: completion.sh
65
""".format(version=tqdm.__version__, commit=check_output([
66
    'git', 'describe', '--always']).decode('utf-8').strip())  # nosec
67

68
if __name__ == "__main__":
69
    (Path(__file__).resolve().parent.parent / 'snapcraft.yaml').write_text(
70
        snap_yml.decode('utf-8') if hasattr(snap_yml, 'decode') else snap_yml, encoding='utf-8')
71

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.