{"id":59,"date":"2017-11-29T10:49:02","date_gmt":"2017-11-29T01:49:02","guid":{"rendered":"http:\/\/blog.peddals.com\/?p=59"},"modified":"2023-04-16T22:21:20","modified_gmt":"2023-04-16T13:21:20","slug":"install_py-tree_on_pythonista3","status":"publish","type":"post","link":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/","title":{"rendered":"Install py-tree on Pythonista3"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">How to install py-tree on Pythonista3 and use it easily.<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">With py-tree command, you can list files and directories in a tree view<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">[mysite]$ tree\n.\n|-- db.sqlite3\n|-- manage.py\n|-- mysite\n|   |-- __init__.py\n|   |-- settings.py\n|   |-- urls.py\n|   `-- wsgi.py\n`-- polls\n    |-- __init__.py\n    |-- admin.py\n    |-- apps.py\n    |-- models.py\n    |-- tests.py\n    |-- urls.py\n    |-- views.py\n    `-- migrations\n        |-- 0001_initial.py\n        `-- __init__.py\n<\/pre>\n\n\n\n<p>Not only in Pythonista3 but also in many cases, you want to see all directories and files of your project in a better format in CLI, StaSh in Pythonista3&#8217;s case. The <strong>py-tree<\/strong> command is the solution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p>You can easily install by running the following command in StaSh (type strings after the command prompt&nbsp;[stash]$ and hit [enter]).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[stash]$ pip install py-tree\n<\/pre>\n\n\n\n<div id=\"alias\">\n<h2>Run the command by entering only &#8220;tree&#8221;.<\/h2>\n<\/div>\n\n\n\n<p>Entering a dash &#8220;-&#8221; character in iPhone is a bit annoying so let&#8217;s create an alias <strong>tree<\/strong>.<br>In StaSh, you can create .stashrc file which works like .bashrc file for Linux&#8217;s &nbsp;bash shell. Follow the example below to create an alias.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[stash]$ cd site-packages\/stash\/\n[stash]$ la\n.gitignore .stash_history .stash_tips .travis.yml CHANGES.md LICENSE README.md __init__.py bin docs getstash.py lib man stash.py system\n[stash]$ touch .stashrc\n[stash]$ echo \"alias tree='py-tree'\" &gt;&gt; .stashrc\n[stash]$ cat .stashrc\nalias tree='py-tree'\n[stash]$ la\n.gitignore .stash_history .stash_tips .stashrc .travis.yml CHANGES.md LICENSE README.md __init__.py bin docs getstash.py lib man stash.py system\n<\/pre>\n\n\n\n<p>Quit and relaunch Pythonista3 to let StaSh load the .stashrc file. Now you can use the <code>tree<\/code> command. Woo-hoo!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create and edit files with different file extension than &#8220;xxx.py&#8221;.<\/h2>\n\n\n\n<p>You cannot create a file like &#8220;.stashrc&#8221; in Pythonista3 as it adds surfix &#8220;.py&#8221;. Also, once a file is created, it won&#8217;t appear in the file list to edit. So, when you need to create such a file, use <strong>touch<\/strong>&nbsp;command then use <strong>edit<\/strong> command to edit it in Pythonista&#8217;s Edit screen. <strong>ls -a<\/strong> or its alias <strong>la<\/strong> is the command to show invisible files in StaSh.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Summary<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Purpose<\/th><th>StaSh Command<\/th><th>Example<\/th><\/tr><tr><td>Create invisible file.<\/td><td><code>touch<\/code><\/td><td><code>touch .invisible<\/code><\/td><\/tr><tr><td>Edit file in Pythonista3.<\/td><td><code>edit<\/code><\/td><td><code>edit .invisible<\/code><\/td><\/tr><tr><td>List files including invisible files.<\/td><td><code>ls -a<\/code><br>or simply<br><code>la<\/code><\/td><td><code>la<\/code><br>(<code>la .*<\/code><br>lists only invisible files.)<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>How to install py-tree on Pythonista3 and use it easily. With py-tree command, you can list files and director &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Install py-tree on Pythonista3&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"53","footnotes":""},"categories":[7,4,5],"tags":[],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-ios","category-python","category-pythonista3","en-US"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Install py-tree on Pythonista3 | Peddals Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Install py-tree on Pythonista3 | Peddals Blog\" \/>\n<meta property=\"og:description\" content=\"How to install py-tree on Pythonista3 and use it easily. With py-tree command, you can list files and director &hellip; Continue reading &quot;Install py-tree on Pythonista3&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/\" \/>\n<meta property=\"og:site_name\" content=\"Peddals Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-29T01:49:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-16T13:21:20+00:00\" \/>\n<meta name=\"author\" content=\"Handsome\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Handsome\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/\"},\"author\":{\"name\":\"Handsome\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#\\\/schema\\\/person\\\/81b2dabca748c3d11a45722f02d9d994\"},\"headline\":\"Install py-tree on Pythonista3\",\"datePublished\":\"2017-11-29T01:49:02+00:00\",\"dateModified\":\"2023-04-16T13:21:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/\"},\"wordCount\":260,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#\\\/schema\\\/person\\\/81b2dabca748c3d11a45722f02d9d994\"},\"articleSection\":[\"iOS\",\"Python\",\"Pythonista3\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/\",\"url\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/\",\"name\":\"Install py-tree on Pythonista3 | Peddals Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#website\"},\"datePublished\":\"2017-11-29T01:49:02+00:00\",\"dateModified\":\"2023-04-16T13:21:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/install_py-tree_on_pythonista3\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\\\/\\\/blog.peddals.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Install py-tree on Pythonista3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#website\",\"url\":\"https:\\\/\\\/blog.peddals.com\\\/\",\"name\":\"Peddals Blog\",\"description\":\"AI, LLM, Python, Mac, Pythonista3, iOS, etc. in Japanese and English\",\"publisher\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#\\\/schema\\\/person\\\/81b2dabca748c3d11a45722f02d9d994\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.peddals.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#\\\/schema\\\/person\\\/81b2dabca748c3d11a45722f02d9d994\",\"name\":\"Handsome\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g\",\"caption\":\"Handsome\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Install py-tree on Pythonista3 | Peddals Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/","og_locale":"en_US","og_type":"article","og_title":"Install py-tree on Pythonista3 | Peddals Blog","og_description":"How to install py-tree on Pythonista3 and use it easily. With py-tree command, you can list files and director &hellip; Continue reading \"Install py-tree on Pythonista3\"","og_url":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/","og_site_name":"Peddals Blog","article_published_time":"2017-11-29T01:49:02+00:00","article_modified_time":"2023-04-16T13:21:20+00:00","author":"Handsome","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Handsome","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/#article","isPartOf":{"@id":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/"},"author":{"name":"Handsome","@id":"https:\/\/blog.peddals.com\/#\/schema\/person\/81b2dabca748c3d11a45722f02d9d994"},"headline":"Install py-tree on Pythonista3","datePublished":"2017-11-29T01:49:02+00:00","dateModified":"2023-04-16T13:21:20+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/"},"wordCount":260,"commentCount":0,"publisher":{"@id":"https:\/\/blog.peddals.com\/#\/schema\/person\/81b2dabca748c3d11a45722f02d9d994"},"articleSection":["iOS","Python","Pythonista3"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/","url":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/","name":"Install py-tree on Pythonista3 | Peddals Blog","isPartOf":{"@id":"https:\/\/blog.peddals.com\/#website"},"datePublished":"2017-11-29T01:49:02+00:00","dateModified":"2023-04-16T13:21:20+00:00","breadcrumb":{"@id":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/blog.peddals.com\/"},{"@type":"ListItem","position":2,"name":"Install py-tree on Pythonista3"}]},{"@type":"WebSite","@id":"https:\/\/blog.peddals.com\/#website","url":"https:\/\/blog.peddals.com\/","name":"Peddals Blog","description":"AI, LLM, Python, Mac, Pythonista3, iOS, etc. in Japanese and English","publisher":{"@id":"https:\/\/blog.peddals.com\/#\/schema\/person\/81b2dabca748c3d11a45722f02d9d994"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.peddals.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.peddals.com\/#\/schema\/person\/81b2dabca748c3d11a45722f02d9d994","name":"Handsome","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g","caption":"Handsome"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g"}}]}},"_links":{"self":[{"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":7,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":272,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/posts\/59\/revisions\/272"}],"wp:attachment":[{"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}