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'])
]
async 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.1.0.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file depsolve-0.1.0.tar.gz
.
File metadata
- Download URL: depsolve-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.8 Linux/6.0.2-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3de5c88b16c7d207aaca72ef73a0dd7cf20cfff2244c91403a7f2e5b4bfac5f |
|
MD5 | 3ab0def0ab3dc4e50ce403b8689dc060 |
|
BLAKE2b-256 | d859c93cbf302ad85ed37495248fe00bf8a140ed0e2a8445666054bf78323056 |
File details
Details for the file depsolve-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: depsolve-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.8 Linux/6.0.2-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bc09457a452377f57911717471bbb886fcac13a3c4cc37f55aaa57ca8b387ea |
|
MD5 | ca212c6f802df47f3e804f845ba37800 |
|
BLAKE2b-256 | 2f0fd12c4a31d118536c80983927215f12197c59bf3750370f7b49ca12de7942 |