{ "info": { "author": "Divo Kaplan", "author_email": "divokaplan@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Other Audience", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Mystery\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://travis-ci.org/DivoK/mystery.svg?branch=master)](https://travis-ci.org/DivoK/mystery)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/mystery.svg)](https://pypi.python.org/pypi/mystery/)\n[![PyPI version fury.io](https://badge.fury.io/py/mystery.svg)](https://pypi.python.org/pypi/mystery/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n> \"It is a riddle, wrapped in a mystery, inside an enigma.\"\n>\n> -- _Sir Winston Churchill_\n\nMystery is a Python package that is instantiated as a _different_ package every time you install it!\n\nIt was inspired by [this episode](https://pythonbytes.fm/episodes/show/116/so-you-want-python-in-a-3d-graphics-engine) of the wonderful podcast [Python Bytes](https://pythonbytes.fm/) (which in turn talked about [this article](https://dustingram.com/articles/2018/03/05/why-pypi-doesnt-know-dependencies/) regarding pip dependencies).\n\nAlso, a shoutout to [this](https://github.com/hugovk/top-pypi-packages) project by [hugovk](https://github.com/hugovk) that creates dumps of the top downloaded packages in [PyPI](https://pypi.org/) every week. Without it's existence, being able to randomly choose a top package from PyPI would've been a lot less fun.\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install mystery.\n\n```bash\npip install --no-cache-dir mystery\n```\n\nThe reason the `--no-cache-dir` flag is used is the [random package choice process](##How-does-it-work?). The dynamically created local instance of the mystery package is simply getting cached so without disabling the caching process the same chosen package will be used in the next reinstallation.\n\n## Usage\n\n```python\nimport mystery # Who knows what's inside?\n\n# `mystery` is now some random package!\n\nmystery.__name__ # Quick cheat if you really are curious ;)\n\n# Here for testing purposes only but go ahead:\nmystery.__mystery_init_py__ # String path pointing to mystery's __init__.py file.\nmystery.__mystery_package_name__ # The mystery package's supposed name.\n```\n\n## How does it work?\n\nMystery doesn't come with it's own `__init__.py` (well actually it does but it's only for setuptools to work, and even this one is also autogenerated when I distribute the package!).\n\nWhat happens behind the scenes is that a `__init__.py` file is being _dynamically generated_ when the package is built and installed. Mystery uses either the newest online dump of the top downloaded PyPI packages stored in [this repository](https://github.com/hugovk/top-pypi-packages) or (in case the repository was unreachable) the backup [offline dump](top-pypi-packages-30-days.min.json) that comes with mystery's distribution.\n\nAfter choosing a package, mystery's `setup.py` will create a **lockfile** in the temporary directory that will store the chosen package's name. The reason for that is that pip will actually run `setup.py` _twice_: first when building the package (`build_py` command) and again when actually installing the package (`install` command). The lockfile will hence be used after it's creation (first run of `setup.py`) to get the chosen package's name out of it (so the `install_requires` parameter in the two calls to `setuptools.setup()` will be in sync) and will then be deleted.\n\n> **Note** that using a lockfile means that if for some reason the lockfile's state gets out of sync (perhaps the setup process is stopped right after the build phase created the lockfile but before the installation phase deleted it) the next attempts at installing mystery will also **fail**. You can fix that by **manually deleting the lockfile** from your filesystem (it's location is stored in [this configuration file](config.json)).\n\n## I ran `import mystery` but I'm getting an error. Why?\n\nIf your error is in the form of:\n\n> Internal error: ...\n> The mystery package wasn't playing nice. Sorry!\n\nThat (hopefully) means that this package's PyPI name does not coorelate to their name under `setuptools.setup()`, so when mystery tries to import that same name (because again, it's done dynamically using the name registered in PyPI) it simply can't find a matching package and that lovely error message will pop up.\n\nSome famous packages who won't work for this reason are *scikit_learn*, _pyyaml_ and... A bunch of Google's stuff. Just reinstall mystery and have fun with a different package!\n\n## License\n\n[MIT](LICENSE.txt)", "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/DivoK/mystery", "keywords": "mystery setuptools fun python-packages random", "license": "", "maintainer": "", "maintainer_email": "", "name": "mystery", "package_url": "https://pypi.org/project/mystery/", "platform": "", "project_url": "https://pypi.org/project/mystery/", "project_urls": { "Homepage": "https://github.com/DivoK/mystery" }, "release_url": "https://pypi.org/project/mystery/1.0.2/", "requires_dist": null, "requires_python": ">=3.6", "summary": "It is a riddle, wrapped in a mystery, inside an enigma.", "version": "1.0.2" }, "last_serial": 5358563, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "8d431b4f2e113c78897ee5ea06bafee2", "sha256": "45a5ea719cc4160fc0ca71b9f26a82a67602c1bf84556f8408a110dec5c78295" }, "downloads": -1, "filename": "mystery-1.0.0.tar.gz", "has_sig": false, "md5_digest": "8d431b4f2e113c78897ee5ea06bafee2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 56184, "upload_time": "2019-05-31T12:31:48", "url": "https://files.pythonhosted.org/packages/20/ba/dfda683b79970f39fca3788016e714516072f46c5c7a4bb8bc6f79a40aa8/mystery-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "afe82b0cfd9de473041827b21205611f", "sha256": "b33d2c298838c06cec2a08e8f865d7d870ad74489f2540b9bb334ac9b4a1943e" }, "downloads": -1, "filename": "mystery-1.0.1.tar.gz", "has_sig": false, "md5_digest": "afe82b0cfd9de473041827b21205611f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 56936, "upload_time": "2019-06-03T21:47:29", "url": "https://files.pythonhosted.org/packages/95/87/d41d22fe91e0c3fd20dfe1e5b85f90790237e0d66263d004b8eec276a52c/mystery-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "e4dd214dba0a3000cad29e87346305cf", "sha256": "66c7d473b0daf9769eaaf091d2fcef622c2518c394fc1918a0d7fc47ba99560a" }, "downloads": -1, "filename": "mystery-1.0.2.tar.gz", "has_sig": false, "md5_digest": "e4dd214dba0a3000cad29e87346305cf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 56962, "upload_time": "2019-06-04T16:31:25", "url": "https://files.pythonhosted.org/packages/7d/10/839cbc6e924983ed61b66c54f87c61a48c3c12c8197cbc458bcbaa4429be/mystery-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e4dd214dba0a3000cad29e87346305cf", "sha256": "66c7d473b0daf9769eaaf091d2fcef622c2518c394fc1918a0d7fc47ba99560a" }, "downloads": -1, "filename": "mystery-1.0.2.tar.gz", "has_sig": false, "md5_digest": "e4dd214dba0a3000cad29e87346305cf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 56962, "upload_time": "2019-06-04T16:31:25", "url": "https://files.pythonhosted.org/packages/7d/10/839cbc6e924983ed61b66c54f87c61a48c3c12c8197cbc458bcbaa4429be/mystery-1.0.2.tar.gz" } ] }