Lonami / grammers

(tele)gramme.rs - use Telegram's API from Rust
https://t.me/gramme_rs
Apache License 2.0
562 stars 117 forks source link

Having a look at the entire dependency tree. #9

Closed swarnimarun closed 3 years ago

swarnimarun commented 4 years ago

I will just be showing off the dependencies of the tree of grammers crate, Assuming it represents a max result of the entire dependency tree...

grammers v0.1.0 
└── grammers-client v0.1.0
    ├── fallible-iterator v0.2.0
    ├── grammers-mtproto v0.1.0
    │   ├── crc v1.8.1
    │   │   [build-dependencies]
    │   │   └── build_const v0.2.1
    │   ├── flate2 v1.0.13
    │   │   ├── cfg-if v0.1.10
    │   │   ├── crc32fast v1.2.0
    │   │   │   └── cfg-if v0.1.10 (*)
    │   │   ├── libc v0.2.66
    │   │   └── miniz_oxide v0.3.6
    │   │       └── adler32 v1.0.4
    │   ├── getrandom v0.1.14
    │   │   ├── cfg-if v0.1.10 (*)
    │   │   └── libc v0.2.66 (*)
    │   ├── grammers-crypto v0.1.0
    │   │   ├── getrandom v0.1.14 (*)
    │   │   ├── grammers-tl-types v0.1.0
    │   │   │   [build-dependencies]
    │   │   │   └── grammers-tl-parser v1.0.0 
    │   │   │       └── crc32fast v1.2.0 (*)
    │   │   ├── num v0.2.1
    │   │   │   ├── num-bigint v0.2.6
    │   │   │   │   ├── num-integer v0.1.42
    │   │   │   │   │   └── num-traits v0.2.11
    │   │   │   │   │       [build-dependencies]
    │   │   │   │   │       └── autocfg v1.0.0
    │   │   │   │   │   [build-dependencies]
    │   │   │   │   │   └── autocfg v1.0.0 (*)
    │   │   │   │   └── num-traits v0.2.11 (*)
    │   │   │   │   [build-dependencies]
    │   │   │   │   └── autocfg v1.0.0 (*)
    │   │   │   ├── num-complex v0.2.4
    │   │   │   │   └── num-traits v0.2.11 (*)
    │   │   │   │   [build-dependencies]
    │   │   │   │   └── autocfg v1.0.0 (*)
    │   │   │   ├── num-integer v0.1.42 (*)
    │   │   │   ├── num-iter v0.1.40
    │   │   │   │   ├── num-integer v0.1.42 (*)
    │   │   │   │   └── num-traits v0.2.11 (*)
    │   │   │   │   [build-dependencies]
    │   │   │   │   └── autocfg v1.0.0 (*)
    │   │   │   ├── num-rational v0.2.3
    │   │   │   │   ├── num-bigint v0.2.6 (*)
    │   │   │   │   ├── num-integer v0.1.42 (*)
    │   │   │   │   └── num-traits v0.2.11 (*)
    │   │   │   │   [build-dependencies]
    │   │   │   │   └── autocfg v1.0.0 (*)
    │   │   │   └── num-traits v0.2.11 (*)
    │   │   ├── openssl v0.10.28
    │   │   │   ├── bitflags v1.2.1
    │   │   │   ├── cfg-if v0.1.10 (*)
    │   │   │   ├── foreign-types v0.3.2
    │   │   │   │   └── foreign-types-shared v0.1.1
    │   │   │   ├── lazy_static v1.4.0
    │   │   │   ├── libc v0.2.66 (*)
    │   │   │   └── openssl-sys v0.9.54
    │   │   │       └── libc v0.2.66 (*)
    │   │   │       [build-dependencies]
    │   │   │       ├── autocfg v1.0.0 (*)
    │   │   │       ├── cc v1.0.50
    │   │   │       └── pkg-config v0.3.17
    │   │   ├── sha1 v0.6.0
    │   │   └── sha2 v0.8.1
    │   │       ├── block-buffer v0.7.3
    │   │       │   ├── block-padding v0.1.5
    │   │       │   │   └── byte-tools v0.3.1
    │   │       │   ├── byte-tools v0.3.1 (*)
    │   │       │   ├── byteorder v1.3.2
    │   │       │   └── generic-array v0.12.3
    │   │       │       └── typenum v1.11.2
    │   │       ├── digest v0.8.1
    │   │       │   └── generic-array v0.12.3 (*)
    │   │       ├── fake-simd v0.1.2
    │   │       └── opaque-debug v0.2.3
    │   └── grammers-tl-types v0.1.0 (*)
    ├── grammers-mtsender v0.1.0 
    │   ├── getrandom v0.1.14 (*)
    │   ├── grammers-crypto v0.1.0 (*)
    │   ├── grammers-mtproto v0.1.0 (*)
    │   └── grammers-tl-types v0.1.0 (*)
    ├── grammers-session v0.1.0 
    ├── grammers-tl-types v0.1.0 (*)
    ├── locate-locale v0.1.0
    └── os_info v1.3.3
        ├── log v0.4.8
        │   └── cfg-if v0.1.10 (*)
        ├── regex v1.3.4
        │   ├── aho-corasick v0.7.8
        │   │   └── memchr v2.3.0
        │   ├── memchr v2.3.0 (*)
        │   ├── regex-syntax v0.6.14
        │   └── thread_local v1.0.1
        │       └── lazy_static v1.4.0 (*)
        ├── serde v1.0.104
        └── serde_derive v1.0.104
            ├── proc-macro2 v1.0.8
            │   └── unicode-xid v0.2.0
            ├── quote v1.0.2
            │   └── proc-macro2 v1.0.8 (*)
            └── syn v1.0.14
                ├── proc-macro2 v1.0.8 (*)
                ├── quote v1.0.2 (*)
                └── unicode-xid v0.2.0 (*)
➜  grammers git:(master) cargo tree | wc -l
106

PS: tool used to generate the tree cargo-tree

What this shows us? Well clearly the grammers-client is the one which holds the entire list of dependencies at this point. A total count of 105.

swarnimarun commented 4 years ago

Some suggestions,

Lonami commented 4 years ago

I have tried to keep the dependencies to a minimum, and also tried to choose those with the smallest amount of dependencies themselves. But it's surprising the list is so large.

Of course, the top-level library depends on lower-level libraries.

We can definitely dump openssl in favour of rustls, but I could not find the AES-IGE mode in their docs, which is why I just went with openssl.

Lonami commented 4 years ago

Some work in this area:

After https://github.com/DarkEld3r/os_info/pull/144 is merged we will cut down on a few extra lines.

Lonami commented 3 years ago

I've been putting some time into trimming down the dependency tree (https://github.com/Lonami/grammers/commit/67f09912e1b8735e5a2202b5c17c8be6097240dd, https://github.com/Lonami/grammers/commit/09f6b522699bb1e09c6ab2818738159625d8c44b, https://github.com/Lonami/grammers/commit/83c7157c7a33e7b69dcd178356f5f7a38ba3cc48) and documenting why each of the dependencies we use is needed (https://github.com/Lonami/grammers/commit/9e4a17c8bfb8e43a47bc1180a6ab6b4881320574).

I'm happy with the current state of the tree, so I'll close this issue, but if anyone wants to replace a dependency with a lighter one or to merge similar dependencies into a common one, I'll be more than welcome to review a pull request. (You may also send a pull request to the repositories of said dependencies and help every crate using them, like I did with os_info!)