Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
392 lines (309 loc) · 17.1 KB
/
Copy pathindex.html
File metadata and controls
392 lines (309 loc) · 17.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-107455490-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-107455490-1');
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-2434930922382269",
enable_page_level_ads: true
});
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#c5c5c5">
<meta name="msapplication-navbutton-color" content="#FAFAFA">
<meta name="apple-mobile-web-app-status-bar-style" content="#FAFAFA">
<meta name="title" content="Ptpython - A Python REPL You will Love!" >
<meta name="description" content="ptpython brings some of the most valuable features to your Python shell and it is one of the most advanced python REPL out there which works on all Python versions from 2.6 up to 3.6+ and is cross-platform (Linux, BSD, OS X and Windows)." >
<meta name="keywords" content="python" >
<meta name="author" content="">
<meta name="robots" content="index, follow">
<meta name="revisit-after" content="3 days">
<!-- python,linux,FOSS -->
<!-- For Facebook -->
<meta property="og:title" content="Fosstack Blog" />
<meta property="og:type" content="article" />
<!-- <meta property="og:image" content="" /> -->
<meta property="og:url" content="/tips/ptpython-python-repl/" />
<meta property="og:description" content="ptpython brings some of the most valuable features to your Python shell and it is one of the most advanced python REPL out there which works on all Python versions from 2.6 up to 3.6+ and is cross-platform (Linux, BSD, OS X and Windows)." />
<!-- For Twitter -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Ptpython - A Python REPL You will Love!" />
<meta name="twitter:description" content="ptpython brings some of the most valuable features to your Python shell and it is one of the most advanced python REPL out there which works on all Python versions from 2.6 up to 3.6+ and is cross-platform (Linux, BSD, OS X and Windows)." />
<!-- <meta name="twitter:image" content="" />-->
<title>
Ptpython - A Python REPL You will Love! |
Fosstack
</title>
<!-- favicon -->
<link rel="shortcut icon" type="image/x-icon" href="../../static/images/favicon.ico" />
<!-- Bootstrap core CSS -->
<link href="../../static/core_blog/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../../static/core_blog/css/clean-blog.min.css" rel="stylesheet">
<link href="../../static/app.min.css" rel="stylesheet">
<link href="../../static/core_blog/css/github.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="../../static/core_blog/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<style>
#bg{
background: #ee0979; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #ff6a00, #ee0979); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right,#30B58B,#22D0BA); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
#ov{
background-color: transparent !important;
}
</style>
</head>
<body>
<!-- Navigation -->
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand" href="../../index.html">Fosstack</a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
Menu
<i class="fa fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="../../category/python/index.html">Python</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../category/linux/index.html">Linux</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../index.html">Tips</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../about/index.html">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../contact/index.html">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#" data-toggle="modal" data-target="#mkdocs_search_modal">
<i class="fa fa-search" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="Search Modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
<form role="form" method="get" action="../../index.html" accept-charset="utf-8">
<div class="form-group">
<input autofocus type="text" name="q" class="form-control" placeholder="Search..." id="mkdocs-search-query">
</div>
</form>
<div id="mkdocs-search-results"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<!-- Page Header -->
<header class="masthead" id="bg">
<div class="overlay" id="ov"></div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="post-heading">
<h1>Ptpython - A Python REPL You will Love!</h1>
<h6 class="post-subtitle">
<h2 class="subheading">ptpython brings some of the most valuable features to your Python shell and it is one of the most advanced python REPL out there which works on all Python versions from 2.6 up to 3.6+ and is cross-platform (Linux, BSD, OS X and Windows).</h2>
<span class="meta">Posted by
<a href="index.html#">Mohit</a>
on February 06, 2018
<span id="hits" style="display:inline-block"> <i class="fa fa-eye" aria-hidden="true"></i> 3210 views</span>
</h6>
</span>
</div>
</div>
</div>
</div>
</header>
<article>
<div class="container">
<div class="row">
<div class="post_detail col-lg-8 col-md-10 mx-auto">
<span id="the_content"><p>Imagine you are debugging in your python shell and in order to do that you defined a function but as soon as you press Enter in the end, what you see that you made a Syntax error, Now you have to re-edit the whole function again (Good luck!). Can you go one line above and change something while defining a block of code like function, class etc in your shell (Obviously you can't :P). Well, these are some of the problems that are solved by ptpython.</p>
<p>First, let me tell you what ptpython offers:</p>
<ul>
<li>Syntax highlighting.</li>
<li>Multiline editing (the up arrow works).</li>
<li>Search and Reverse Search</li>
<li>History Browser</li>
<li>Autocompletion.</li>
<li>Documentation Popups</li>
<li>Mouse support.</li>
<li>Support for color schemes.</li>
<li>Both Vi and Emacs key bindings.</li>
<li>Custom keybinds</li>
<li>... and much other stuff</li>
</ul>
<p>This is how it looks...</p>
<p><img src="../../media/uploads/ptpython.png" alt="ptpython" width="950" height="226" /></p>
<p><img src="../../media/uploads/file-completion.png" alt="example" width="873" height="248" /></p>
<p><img src="../../media/uploads/multiline.png" alt="multiline" width="873" height="248" /></p>
<p>Looks Great? Let's get done with the installation part first.</p>
<pre class="language-python"><code>pip install ptpython</code></pre>
<p>Then copy <a href="https://gist.github.com/mohi7solanki/2560b311ceab5f2a43541923296b8e7a" target="_blank" rel="noopener">this</a> file to <code>~/.ptpython/config.py</code> , this file contains different configuration settings which you can modify according to your preference. </p>
<p>Now just type <code>ptpython</code> in your terminal or cmd to try this awesome REPL. You can also embed ptpython by typing this in your python shell (Cool Right ?)</p>
<pre class="language-python"><code>from ptpython.repl import embed
embed(globals(), locals())</code></pre>
<p>You can also use ptpython as your Django shell with <code>django-extensions</code></p>
<p>First, install <code>ptpython</code> then install <code>django-extensions</code></p>
<pre class="language-python"><code>pip install django-extensions</code></pre>
<p>Add <code>django-extensions</code> to your installed apps</p>
<pre class="language-python"><code>INSTALLED_APPS = (
...
'django_extensions',
)</code></pre>
<p>Then in terminal, type <code>python manage.py shell_plus --ptpython</code> (You can leave off "--ptpython" if you haven't installed any other python repl like bpython etc)</p>
<p>If you like this post please share or leave a comment.</p> </span>
<div class="button-group">
<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=fosstack.com/tips/ptpython-python-repl/" class="social facebook"><img width="40px" src="../../static/images/social/facebook-min.png"></a>
<a target="_blank" href="https://twitter.com/intent/tweet?url=fosstack.com/tips/ptpython-python-repl/&via=mohi7solanki&text=Ptpython - A Python REPL You will Love!&original_referer=https://fosstack.com/tips/ptpython-python-repl/&hashtags=<QuerySet [<Tag: shell>, <Tag: ipython>, <Tag: python>, <Tag: bpython>, <Tag: repl>]>" class="social twitter"><img width="40px" src="../../static/images/social/twitter-min.png"></a>
<a target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=fosstack.com/tips/ptpython-python-repl/&title=Ptpython - A Python REPL You will Love!&summary=ptpython brings some of the most valuable features to your Python shell and it is one of the most advanced python REPL out there which works on all Python versions from 2.6 up to 3.6+ and is cross-platform (Linux, BSD, OS X and Windows).&source=" class="social linkedin"><img width="40px" src="../../static/images/social/linkedin-min.png"></a>
<a target="_blank" onclick="window.location = '//www.reddit.com/submit?url=' + encodeURIComponent(window.location) + '&title=Ptpython - A Python REPL You will Love!'; return false" href="https://www.reddit.com/submit" class="social reddit"><img width="40px" src="../../static/images/social/reddit-icon.svg"></a>
</div>
<br>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* <![CDATA[ */
var disqus_shortname = 'Fosstack';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
/* ]]> */
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="https://disqus.com/" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
<br><br>
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<br><h4 class="text-center">Related Posts</h4><br>
<div class="post-preview">
<a href="../../algorithms-with-python/index.html">
<h5 class="text-center post-subtitle">
Learn Algorithms with Python
</h5>
</a>
</div>
<hr>
<div class="post-preview">
<a href="../../setup-sublime-python/index.html">
<h5 class="text-center post-subtitle">
Must-Have Packages and Settings in Sublime Text for a Python Developer
</h5>
</a>
</div>
<hr>
<div class="post-preview">
<a href="../upgrade-all-pip-packages/index.html">
<h5 class="text-center post-subtitle">
How to upgrade all outdated pip packages
</h5>
</a>
</div>
<hr>
<div class="post-preview">
<a href="../../how-to-add-google-authentication-in-django/index.html">
<h5 class="text-center post-subtitle">
How to add Google and Github OAuth in Django
</h5>
</a>
</div>
<hr>
<div class="post-preview">
<a href="../videos-playlist-length-calculator/index.html">
<h5 class="text-center post-subtitle">
Playlist Length Calculator
</h5>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</article>
<hr>
<!-- Footer -->
<footer>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto mb-3">
<form id="subscription_ajax" class="mb-4" method="post" novalidate>
<input type='hidden' name='csrfmiddlewaretoken' value='7pTCFGMCMvSaKsIXLh8sNdPqDbwcPkHCZ51tbrVdz1VRKwOmirU4brE6QthibIL2' />
<div class="input-group">
<input type="email" id="sub_email" name="email" placeholder="Enter your email here" class="form-control border border-secondary" required="required">
<span class="input-group-btn">
<button class="btn btn-outline-secondary" type="submit"><i class="fa fa-send"></i></button>
</span>
</div>
</form>
<ul class="list-inline text-center">
<li class="list-inline-item">
<a href="https://twitter.com/Fosstack">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
<li class="list-inline-item">
<a href="https://facebook.com/Fosstack">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
<li class="list-inline-item">
<a href="https://github.com/Fosstack">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-github fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
</ul>
<p class="copyright text-muted">Copyright © Fosstack 2018</p>
</div>
</div>
</div>
</footer>
<!-- Bootstrap core JavaScript -->
<script src="../../static/core_blog/vendor/jquery/jquery.min.js"></script>
<script src="../../static/core_blog/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="../../static/core_blog/js/clean-blog.min.js"></script>
<script src="../../static/app.min.js"></script>
<script src="../../static/core_blog/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- Custom scripts for this template -->
</body>
</html>