Skip to main content

Agnostic dependencies solver

Project description

DepSolve

This is an asyncio agnostic dependency tree solver

The idea is to take out the problem of depencies solving from packages managers or importers

Usage

import asyncio
from depsolve import Dependency, walk


async def perform_importation(dependency: Dependency):
    # here your package/whatever is supposed to inherit from `Dependency`
    # if any other argument is need for the command line in the package
    # have a look to functools.partial()
    await asyncio.sleep(2)


async def main():
    dependencies = [
        Dependency(name='land'),
        Dependency(name='hen', depends_on=['land']),
        Dependency(name='eggs', depends_on=['hen']),
        Dependency(name='sugar_cane', depends_on=['land']),
        Dependency(name='plain flour', depends_on=['wheat']),
        Dependency(name='sugar', depends_on=['sugar_cane']),
        Dependency(name='genoise', depends_on=['eggs', 'sugar']),
        Dependency(name='strawberry', depends_on=['land']),
        Dependency(name='wheat', depends_on=['land']),
        Dependency(name='sirop', depends_on=['strawberry']),
        Dependency(name='cake', depends_on=['genoise', 'strawberry', 'sirop']),
        Dependency(name='cooking', depends_on=['cake'])
    ]
    for items in walk(dependencies):
        deps_names = [dep.name for dep in items]
        print(f'dependencies to install: {len(items)} : {", ".join(deps_names)}')
        tasks = asyncio.gather(*[perform_importation(dep) for dep in items])
        await tasks


if __name__ == "__main__":
    asyncio.run(main())

wich output:

dependencies to install: 1 : land
dependencies to install: 4 : hen, sugar_cane, strawberry, wheat
dependencies to install: 4 : eggs, plain flour, sugar, sirop
dependencies to install: 1 : genoise
dependencies to install: 1 : cake
dependencies to install: 1 : cooking

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

depsolve-0.2.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

depsolve-0.2.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file depsolve-0.2.0.tar.gz.

File metadata

  • Download URL: depsolve-0.2.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.5.3-arch1-1

File hashes

Hashes for depsolve-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e91209c934b2fd0f33f1386902b9d2f99ddfe869d6401b68446048b60a096a5c
MD5 b1184827f09976092f1f2fc1e3266bd6
BLAKE2b-256 03edda3c5377e525fdfb903d64646b33ab1773ed0a94bec1e32eb786c82ef452

See more details on using hashes here.

File details

Details for the file depsolve-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: depsolve-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.5.3-arch1-1

File hashes

Hashes for depsolve-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37f2faa4be673bc62ba406a954bbcfc0d96a615c0c513d8dc27a06f9cf1574fb
MD5 8adc3e14ebb067d9347ad22744a722a0
BLAKE2b-256 c06d732b9df8471fb6392b7d65b4a63468fb5b1f827542342c90b1180b844f5b

See more details on using hashes here.

Supported by

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