{ "info": { "author": "Idin", "author_email": "py@idin.ca", "bugtrack_url": null, "classifiers": [], "description": "# Route\n\nRoute is a Python library for interacting with the file system in an object oriented manner. \nI know you can use os and os.path to do all of these but I find their usage hard to remember \nand true to object oriented principles. \n\n# Installation\n\nYou can use pip to install Route.\n\n```bash\npip install route\n```\n\n# Usage\n\nAll files and directories (folders) are considered *Path* objects. \nAny path except the root, has a parent: the directory it is in. \nDirectories have children, some of them are files and some are subdirectories.\n\n\n## Path\n\nThe *Path* object points to an existing or non-existing file or directory.\n```python\nfrom route import Path\npath = Path('C:\\\\')\n```\n\n\n### *get_current_directory*\n\nUsually we want to start in the current working directory:\n```python\npath = Path.get_current_directory()\n```\n\n\n### *list*, *dir*, *ls* \n\nAll of the above methods do the same thing; \n*ls* is for linux people, *dir* is for windows people, and *list* is for literal people.\n\n```python\nprint(path.list())\n```\n\n\n### *directories*\n\nTo get the sub-directories of a directory use the *directories* attribute which returns a list of *Paths*:\n```python\nsubdirectories = path.directories\n```\n\n\n### *files*\n\nTo get the files inside a directory use the *files* attribute which returns a list of *Paths*:\n```python\nfiles = path.files\n```\n\n### *parent_directory*\n\nThe parent directory is the directory a *Path* (either file or directory) is inside of.\n```python\nparent_directory = path.parent_directory\n```\n\n\n### *make_directory*\n\nTo create a new directory **inside** a *Path* that is also a directory, use *make_directory* \nwith the name of the new directory as the *name* argument:\n```python\npath.make_directory(name='new_directory')\n```\n\n\nYou can also create a directory at the location of the *Path* object by letting the *name* \nargument take its default value of *None*:\n```python\npath.make_directory()\n```\n\n\n### *make_parent_directory*\n\nSometimes you need to create a new file at a *Path* that doesn't already exist, *i.e.* the directory\nof the file location doesn't exist. This is when *make_parent_directory* becomes handy:\n```python\npath.make_parent_directory(ignore_if_exists=True)\n```\nThe default value of *ignore_if_exists* is *True*.\n\n\n### *delete*\n\nThe *delete* function moves a file or directory to the trash. If the *name* argument is provided\nthe file or directory inside the *Path* with that name will be deleted:\n```python\npath.delete(name='new_directory')\n```\n\n\nIf the *name* argument is not provided the file or directory the *Path* points to will be deleted:\n```python\npath.delete()\n```\n\n\n### *save*\n\nTo save a Python object as a **Pickle** file using the *pickle* or *dill* library you can just use the\n*save* function of the *Path* which saves the object right at the location of *Path*.\n```python\nmy_list = [1, 2, 3]\nPath('my_list.pickle').save(method='pickle')\nPath('my_list.dill').save(method='dill')\n```\n\n\n### *load*\n\nTo load an object from a **Pickle** file located at a *Path* you can run the *load* function of the *Path*.\n```python\nlist_from_pickle = Path('my_list.pickle').load(method='pickle')\nlist_from_dill = Path('my_list.dill').load(method='dill')\n```\n\n\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/idin/route", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "route", "package_url": "https://pypi.org/project/route/", "platform": "", "project_url": "https://pypi.org/project/route/", "project_urls": { "Homepage": "https://github.com/idin/route" }, "release_url": "https://pypi.org/project/route/0.1.4/", "requires_dist": [ "dill", "send2trash" ], "requires_python": "~=3.6", "summary": "Python library for interacting with the file system", "version": "0.1.4" }, "last_serial": 4970613, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "7c2c9f227abbb36f2477c65cea5701b9", "sha256": "bcbe31a7efd714cb4828369a44cc893b12aa8fc69a3d65f9609732c7b99c9d0d" }, "downloads": -1, "filename": "route-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7c2c9f227abbb36f2477c65cea5701b9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 5592, "upload_time": "2019-03-15T20:34:13", "url": "https://files.pythonhosted.org/packages/01/01/d556dbc0312945c599be5c9a4db1042853e542aeafdf8594eb52b7dec3a8/route-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "288c59ee44ffba7482400d24e7c6f125", "sha256": "3c6b84488d5ab9329ac9cd9191ec12b7ab8e526f908c4338ee1a4e235b1d8d3a" }, "downloads": -1, "filename": "route-0.1.2.tar.gz", "has_sig": false, "md5_digest": "288c59ee44ffba7482400d24e7c6f125", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 3888, "upload_time": "2019-03-15T20:34:15", "url": "https://files.pythonhosted.org/packages/20/40/75bcf4bbdc4136e3b83990c82f08f2c026ee29277d7d841c7c3fe18c43ac/route-0.1.2.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "4dd1a835661c4e3ceb3cb005d647ac6e", "sha256": "49d87a68e47acfda14356023340ff93190dce3ff0a14fd376358849f6155c033" }, "downloads": -1, "filename": "route-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "4dd1a835661c4e3ceb3cb005d647ac6e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 9283, "upload_time": "2019-03-22T00:34:16", "url": "https://files.pythonhosted.org/packages/09/63/da318bdee6f29ff71381d268454337ab0db8f72a5750852a73ba05656d2f/route-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c692aeae7f13316a221b996638d95d37", "sha256": "81c49f0e28b3d8dc1271492c4c9dbcdad9396a296b9695dbddbac78d5f52d90b" }, "downloads": -1, "filename": "route-0.1.4.tar.gz", "has_sig": false, "md5_digest": "c692aeae7f13316a221b996638d95d37", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 4792, "upload_time": "2019-03-22T00:34:17", "url": "https://files.pythonhosted.org/packages/11/cd/924b74c4b14e75a3af23853237cdebf0d5f730be616a3ab07f5bf981011e/route-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4dd1a835661c4e3ceb3cb005d647ac6e", "sha256": "49d87a68e47acfda14356023340ff93190dce3ff0a14fd376358849f6155c033" }, "downloads": -1, "filename": "route-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "4dd1a835661c4e3ceb3cb005d647ac6e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 9283, "upload_time": "2019-03-22T00:34:16", "url": "https://files.pythonhosted.org/packages/09/63/da318bdee6f29ff71381d268454337ab0db8f72a5750852a73ba05656d2f/route-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c692aeae7f13316a221b996638d95d37", "sha256": "81c49f0e28b3d8dc1271492c4c9dbcdad9396a296b9695dbddbac78d5f52d90b" }, "downloads": -1, "filename": "route-0.1.4.tar.gz", "has_sig": false, "md5_digest": "c692aeae7f13316a221b996638d95d37", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 4792, "upload_time": "2019-03-22T00:34:17", "url": "https://files.pythonhosted.org/packages/11/cd/924b74c4b14e75a3af23853237cdebf0d5f730be616a3ab07f5bf981011e/route-0.1.4.tar.gz" } ] }