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.1.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file depsolve-0.2.1.tar.gz
.
File metadata
- Download URL: depsolve-0.2.1.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.6-arch2-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98bffc138121fd767780b4bdf8bce30e3888d97a460964b530afc5b4230492ca |
|
MD5 | 2ff01d0b015e43ae262e48eda8f5fcf5 |
|
BLAKE2b-256 | c4986f09e342e2a933b8e193fabc41a806097f9c07ab124b44a74d51c03bbb58 |
File details
Details for the file depsolve-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: depsolve-0.2.1-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.6-arch2-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff20075600c3ec26804fc30b7006eef69770623622768c6f5b2036ecc5a53699 |
|
MD5 | e9b533edf3a31aed52c98b5610900e03 |
|
BLAKE2b-256 | e6bffe5378131e0c5434458527d17bbad42341788c0ad809cbf3259c709b6704 |