{ "info": { "author": "S\u00e9bastien Eustace", "author_email": "sebastien@eustace.io", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Mixology\n\nA generic dependency-resolution algorithm written in pure Python.\n\n\n## Installation\n\nIf you are using [poetry](https://github.com/sdispater/poetry), it's as simple as:\n\n```bash\npoetry add mixology\n```\n\nIf not you can use `pip`:\n\n```bash\npip install mixology\n```\n\n## Usage\n\nMixology is a dependency resolution algorithm.\nIt is heavily inspired by [Molinillo](https://github.com/CocoaPods/Molinillo) in Ruby.\n\nIn order to start using `mixology` you need to initialize a `Resolver` instance\nwith a `SpecificationProvider` and a `UI` which should be adapted to work with\nyour system.\n\nThen, you need to call `Resolver.resolve()` with a list of user-requested dependencies\nand an optional \"locking\" `DependencyGraph`.\n\n### Specification provider\n\nThe `SpecificationProvider` class forms the basis\nfor the key integration point for a client library with Molinillo.\n\nIts methods convert the client's domain-specific model objects into concepts the resolver understands:\n\n- Nested dependencies\n- Names\n- Requirement satisfaction\n- Finding specifications (known internally as possibilities)\n- Sorting dependencies (for the sake of reasonable resolver performance)\n\nThe base class looks like this:\n\n```python\nclass SpecificationProvider(object):\n \"\"\"\n Provides information about specifications and dependencies to the resolver,\n allowing the Resolver class to remain generic while still providing power\n and flexibility.\n\n This contract contains the methods that users of mixology must implement\n using knowledge of their own model classes.\n \"\"\"\n\n @property\n def name_for_explicit_dependency_source(self): # type: () -> str\n return 'user-specified dependency'\n\n @property\n def name_for_locking_dependency_source(self): # type: () -> str\n return 'Lockfile'\n\n def search_for(self, dependency): # type: (Any) -> List[Any]\n \"\"\"\n Search for the specifications that match the given dependency.\n\n The specifications in the returned list will be considered in reverse\n order, so the latest version ought to be last.\n \"\"\"\n return []\n\n def dependencies_for(self, specification): # type: (Any) -> List[Any]\n \"\"\"\n Returns the dependencies of specification.\n \"\"\"\n return []\n\n def is_requirement_satisfied_by(self,\n requirement, # type: Any\n activated, # type: DependencyGraph\n spec # type: Any\n ): # type: (...) -> Any\n \"\"\"\n Determines whether the given requirement is satisfied by the given\n spec, in the context of the current activated dependency graph.\n \"\"\"\n return True\n\n def name_for(self, dependency): # type: (Any) -> str\n \"\"\"\n Returns the name for the given dependency.\n \"\"\"\n return str(dependency)\n\n def sort_dependencies(self,\n dependencies, # type: List[Any]\n activated, # type: DependencyGraph\n conflicts # type: Dict[str, List[Conflict]]\n ): # type: (...) -> List[Any]\n \"\"\"\n Sort dependencies so that the ones\n that are easiest to resolve are first.\n\n Easiest to resolve is (usually) defined by:\n 1) Is this dependency already activated?\n 2) How relaxed are the requirements?\n 3) Are there any conflicts for this dependency?\n 4) How many possibilities are there to satisfy this dependency?\n \"\"\"\n return sorted(\n dependencies,\n key=lambda dep: (\n activated.vertex_named(self.name_for(dep)).payload is None,\n conflicts.get(self.name_for(dep) is None)\n )\n )\n\n def allow_missing(self, dependency): # type: (Any) -> bool\n \"\"\"\n Returns whether this dependency, which has no possible matching\n specifications, can safely be ignored.\n \"\"\"\n return False\n```\n\n### UI\n\nThe `UI` class helps give feedback on and debug the depency resolution process.\n\nYou can subclass it to customize it to your needs.\n\nThe base class looks like this:\n\n```python\nclass UI(object):\n\n def __init__(self, debug=False):\n self._debug = debug\n\n @property\n def output(self):\n return sys.stdout\n\n @property\n def progress_rate(self): # type: () -> float\n return 0.33\n\n def is_debugging(self): # type: () -> bool\n return self._debug\n\n def indicate_progress(self): # type: () -> None\n self.output.write('.')\n\n def before_resolution(self): # type: () -> None\n self.output.write('Resolving dependencies...\\n')\n\n def after_resolution(self): # type: () -> None\n self.output.write('')\n\n def debug(self, message, depth): # type: (...) -> None\n if self.is_debugging():\n debug_info = str(message)\n debug_info = '\\n'.join([\n ':{}: {}'.format(str(depth).rjust(4), s)\n for s in debug_info.split('\\n')\n ]) + '\\n'\n\n self.output.write(debug_info)\n\n```\n\n\n## Contributing\n\nTo work on the Mixology codebase, you'll want to fork the project, clone the fork locally\nand install the required depedendencies via `poetry `_.\n\n```bash\ngit clone git@github.com:sdispater/mixology.git\npoetry install\n```\n\nThen, create your feature branch:\n\n```bash\ngit checkout -b my-new-feature\n```\n\nMake your modifications, add tests accordingly and execute the test suite:\n\n```bash\npoetry run pytest tests/\n```\n\nWhen you are ready commit your changes:\n\n```bash\ngit commit -am 'Add new feature'\n```\n\npush your branch:\n\n```bash\ngit push origin my-new-feature\n```\n\nand finally create a pull request.\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sdispater/mixology", "keywords": "dependency-resolution", "license": "MIT", "maintainer": "S\u00e9bastien Eustace", "maintainer_email": "sebastien@eustace.io", "name": "mixology", "package_url": "https://pypi.org/project/mixology/", "platform": "", "project_url": "https://pypi.org/project/mixology/", "project_urls": { "Homepage": "https://github.com/sdispater/mixology" }, "release_url": "https://pypi.org/project/mixology/0.1.0/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "summary": "A generic dependency-resolution algorithm written in pure Python.", "version": "0.1.0" }, "last_serial": 3763412, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "87823a0ae8b0305d339105a01e70f706", "sha256": "84238fc98a9c1750477b89758a09ac2e792587df8eeaebc03881fac586087db2" }, "downloads": -1, "filename": "mixology-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "87823a0ae8b0305d339105a01e70f706", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 72105, "upload_time": "2018-04-13T23:01:16", "url": "https://files.pythonhosted.org/packages/ff/66/280e5346f03f69395e0f35e76b26053f8a4c289188bca33132045cba03e5/mixology-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a42cc8d59e56f2c7fb4097a398b936a", "sha256": "2c0bfff89124eb1895b7b8f112def72c231d677fbc5e38bea79f4ac6cae41172" }, "downloads": -1, "filename": "mixology-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6a42cc8d59e56f2c7fb4097a398b936a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 17418, "upload_time": "2018-04-13T23:01:17", "url": "https://files.pythonhosted.org/packages/12/d3/80d9618608285050db9f12ae0755f8383ce895b8ae93d9965f0aacbbf32f/mixology-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "87823a0ae8b0305d339105a01e70f706", "sha256": "84238fc98a9c1750477b89758a09ac2e792587df8eeaebc03881fac586087db2" }, "downloads": -1, "filename": "mixology-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "87823a0ae8b0305d339105a01e70f706", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 72105, "upload_time": "2018-04-13T23:01:16", "url": "https://files.pythonhosted.org/packages/ff/66/280e5346f03f69395e0f35e76b26053f8a4c289188bca33132045cba03e5/mixology-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a42cc8d59e56f2c7fb4097a398b936a", "sha256": "2c0bfff89124eb1895b7b8f112def72c231d677fbc5e38bea79f4ac6cae41172" }, "downloads": -1, "filename": "mixology-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6a42cc8d59e56f2c7fb4097a398b936a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 17418, "upload_time": "2018-04-13T23:01:17", "url": "https://files.pythonhosted.org/packages/12/d3/80d9618608285050db9f12ae0755f8383ce895b8ae93d9965f0aacbbf32f/mixology-0.1.0.tar.gz" } ] }