{"componentChunkName":"component---src-templates-blog-list-template-js","path":"/117","result":{"data":{"allMarkdownRemark":{"edges":[{"node":{"excerpt":"What is Bot? According to Wikipedia, It is a software application that runs automated tasks (scripts) over the Internet. In other terms, It…","fields":{"slug":"/engineering/how-to-make-telegram-bot/"},"html":"<h2 id=\"what-is-bot\" style=\"position:relative;\"><a href=\"#what-is-bot\" aria-label=\"what is bot permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is Bot?</h2>\n<p>According to Wikipedia, It is a software application that runs automated tasks (scripts) over the Internet. In other terms, It is a program written to mimic human behaviour in order to perform some tasks. Bots take input and do simple and repetitive tasks, which is much faster than humans. </p>\n<p>There are two types of bots:</p>\n<ul>\n<li>Good Bots: Bots that are  beneficial to organizations as well as individuals such as ChatBots, Social Media bots, etc</li>\n<li>Bad Bots: These are the bots that are used to perform malicious activities such as Scraping and Spamming.</li>\n</ul>\n<p>In this, We will make Telegram Chatbot, which would send a copy of the input that the user has sent.</p>\n<h2 id=\"making-our-telegram-chatbot\" style=\"position:relative;\"><a href=\"#making-our-telegram-chatbot\" aria-label=\"making our telegram chatbot permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Making our Telegram Chatbot</h2>\n<p>We will be using <strong>Python language</strong> to make the bot and will be using <strong>Telegram package</strong> for our bot.\nYou can know more about the telegram package from <a href=\"https://python-telegram-bot.readthedocs.io/en/stable/telegram.html\">here</a></p>\n<p>Firstly, we will generate our telegram token. Below are the steps to follow to generate your own token.</p>\n<ol>\n<li>Search BotFather on Telegram.</li>\n<li>Type <strong>/start</strong> to get started.</li>\n<li>Type <strong>/newbot</strong> to get a bot.</li>\n<li>Enter your Bot name and unique Username, which should end with the bot.</li>\n<li>Then, you would get your Bot token.</li>\n</ol>\n<p>After generating our token, we will make a python program to create a Telegram bot that will send the Text, Emojis, and Stickers similar to the user's input.</p>\n<ul>\n<li>Importing libraries required.</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> logging</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">from</span><span class=\"mtk1\"> telegram.ext </span><span class=\"mtk15\">import</span><span class=\"mtk1\"> Updater, Filters, CommandHandler, MessageHandler</span></span></code></pre>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">logging.basicConfig(</span><span class=\"mtk12\">format</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&#39;</span><span class=\"mtk4\">%(asctime)s</span><span class=\"mtk8\"> - </span><span class=\"mtk4\">%(name)s</span><span class=\"mtk8\"> - </span><span class=\"mtk4\">%(levelname)s</span><span class=\"mtk8\"> - </span><span class=\"mtk4\">%(message)s</span><span class=\"mtk8\">&#39;</span><span class=\"mtk1\">,     </span><span class=\"mtk3\">#take time,level,name</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                    </span><span class=\"mtk12\">level</span><span class=\"mtk1\">=logging.INFO)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">logger = logging.getLogger(</span><span class=\"mtk12\">__name__</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>This script does a basic configuration for the logging system. It takes time, level, and name.</p>\n<ul>\n<li>Now, we will make a variable Token, which will take your Telegram token.</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">TOKEN = </span><span class=\"mtk8\">&quot;ENTER YOUR TOKEN&quot;</span><span class=\"mtk1\">  </span></span></code></pre>\n<ul>\n<li>After writing the token, we will make some functions that our bot will perform.</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">def</span><span class=\"mtk1\"> </span><span class=\"mtk11\">start</span><span class=\"mtk1\">(</span><span class=\"mtk12\">bot</span><span class=\"mtk1\">,</span><span class=\"mtk12\">update</span><span class=\"mtk1\">):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    name  = update.message.from_user.first_name  </span><span class=\"mtk3\">#first name of the user messaging</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    reply = </span><span class=\"mtk8\">&quot;Hi!! </span><span class=\"mtk4\">{}</span><span class=\"mtk8\">&quot;</span><span class=\"mtk1\">.format(name)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    bot.send_message(</span><span class=\"mtk12\">chat_id</span><span class=\"mtk1\"> = update.message.chat_id, </span><span class=\"mtk12\">text</span><span class=\"mtk1\"> = reply)      </span><span class=\"mtk3\">#sending message</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">def</span><span class=\"mtk1\"> </span><span class=\"mtk11\">help</span><span class=\"mtk1\">(</span><span class=\"mtk12\">bot</span><span class=\"mtk1\">,</span><span class=\"mtk12\">update</span><span class=\"mtk1\">):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    reply = </span><span class=\"mtk8\">&quot;How can I help You&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    bot.send_message(</span><span class=\"mtk12\">chat_id</span><span class=\"mtk1\"> = update.message.chat_id, </span><span class=\"mtk12\">text</span><span class=\"mtk1\"> = reply)  </span><span class=\"mtk3\">#sending message</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">def</span><span class=\"mtk1\"> </span><span class=\"mtk11\">echo_text</span><span class=\"mtk1\">(</span><span class=\"mtk12\">bot</span><span class=\"mtk1\">,</span><span class=\"mtk12\">update</span><span class=\"mtk1\">):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    reply = update.message.text</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    bot.send_message(</span><span class=\"mtk12\">chat_id</span><span class=\"mtk1\"> = update.message.chat_id, </span><span class=\"mtk12\">text</span><span class=\"mtk1\"> = reply)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">def</span><span class=\"mtk1\"> </span><span class=\"mtk11\">sticker</span><span class=\"mtk1\">(</span><span class=\"mtk12\">bot</span><span class=\"mtk1\">,</span><span class=\"mtk12\">update</span><span class=\"mtk1\">):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    reply = update.message.sticker.file_id</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    bot.send_sticker(</span><span class=\"mtk12\">chat_id</span><span class=\"mtk1\"> = update.message.chat_id, </span><span class=\"mtk12\">sticker</span><span class=\"mtk1\"> = reply)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">def</span><span class=\"mtk1\"> </span><span class=\"mtk11\">error</span><span class=\"mtk1\">(</span><span class=\"mtk12\">bot</span><span class=\"mtk1\">,</span><span class=\"mtk12\">update</span><span class=\"mtk1\">):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    logger.error(</span><span class=\"mtk8\">&quot;Shit!! Update </span><span class=\"mtk4\">{}</span><span class=\"mtk8\"> caused error </span><span class=\"mtk4\">{}</span><span class=\"mtk8\">&quot;</span><span class=\"mtk1\">.format(update,update.error))</span></span></code></pre>\n<p><strong>start</strong> function would be taking the user's input and would be sending, Hi, with the user's name.</p>\n<p><strong>help</strong> function will prompt the message of how can I help you.</p>\n<p><strong>echo_text</strong> and <strong>sticker</strong> function will send the same message or the stickers which the user has sent.</p>\n<p><strong>error</strong> function would be printing the error message on the command prompt.</p>\n<ul>\n<li>Finally, we will make the main function, which would be executed first on running the program. It will take the updates and handle the updates.</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">def</span><span class=\"mtk1\"> </span><span class=\"mtk11\">main</span><span class=\"mtk1\">():</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    updater = Updater(TOKEN)  </span><span class=\"mtk3\">#take the updates</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    dp = updater.dispatcher   </span><span class=\"mtk3\">#handle the updates</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    dp.add_handler(CommandHandler(</span><span class=\"mtk8\">&quot;start&quot;</span><span class=\"mtk1\">, start))</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    dp.add_handler(CommandHandler(</span><span class=\"mtk8\">&quot;help&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk11\">help</span><span class=\"mtk1\">))</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    dp.add_handler(MessageHandler(Filters.text, echo_text))   </span><span class=\"mtk3\">#if the user sends text</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    dp.add_handler(MessageHandler(Filters.sticker, sticker))  </span><span class=\"mtk3\">#if the user sends sticker</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    dp.add_error_handler(error)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    updater.start_polling()</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    logger.info(</span><span class=\"mtk8\">&quot;Started...&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    updater.idle()</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">if</span><span class=\"mtk1\"> </span><span class=\"mtk12\">__name__</span><span class=\"mtk1\">==</span><span class=\"mtk8\">&quot;__main__&quot;</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    main()</span></span></code></pre>\n<blockquote>\n<p>Save the program and execute it to check the working of the telegram bot on telegram.</p>\n</blockquote>\n<p>You can get the source code to make the Telegram bot from this Github Repository <a href=\"https://github.com/LoginRadius/engineering-blog-samples/tree/master/Telegram-Bot\">Bot :robot:</a>. You can also make some changes to the code to make the bot do cool stuff such as Getting News, Articles, or Movies recommendations.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n</style>","frontmatter":{"date":"October 20, 2020","updated_date":null,"description":"What is a bot and How to make our own Telegram bot.","title":"How to make a telegram bot","tags":["Telegram Bot","Python"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.4814814814814814,"src":"/static/aceaa6a49195f6d0417cb80f93f56be4/58556/bot.webp","srcSet":"/static/aceaa6a49195f6d0417cb80f93f56be4/61e93/bot.webp 200w,\n/static/aceaa6a49195f6d0417cb80f93f56be4/1f5c5/bot.webp 400w,\n/static/aceaa6a49195f6d0417cb80f93f56be4/58556/bot.webp 800w,\n/static/aceaa6a49195f6d0417cb80f93f56be4/99238/bot.webp 1200w,\n/static/aceaa6a49195f6d0417cb80f93f56be4/135cd/bot.webp 1280w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Rajan Puri","github":"rjn01","avatar":null}}}},{"node":{"excerpt":"Apple's smartphone OS running on iPhone, iPad, iPod Touch hardware is iOS. For these computers, Apple offers tools and services for…","fields":{"slug":"/engineering/getting-started-with-ios-app-development/"},"html":"<p>Apple's smartphone OS running on iPhone, iPad, iPod Touch hardware is iOS. For these computers, Apple offers tools and services for developing iOS apps and accessories.</p>\n<p>You can use React Native (JavaScript) or Xamarin (C# &#x26; F#) as an iOS developer to programme in native languages like Swift or Objective-C or build native cross-platform applications.</p>\n<p>In this article, we'll explore how to build iOS apps. We're going to look at how you can learn to develop an iOS application and play with existing apps.</p>\n<p>As with learning something new, learning to build iOS is difficult. Although, It is enjoyable, exciting, and satisfying!</p>\n<p>Here's what we'll get into:</p>\n<ol>\n<li>Setup your MAC for ios app development</li>\n<li>Setup, your editor for ios application</li>\n<li>Create your first ios app</li>\n<li>Run the ios application</li>\n</ol>\n<p>You will have a step-by-step plan to learn how to create an ios app when you have completed reading this guide. You know precisely what you should do, what steps you should take, and how you should take them. Yeah, and you don't need any coding experience to get started.</p>\n<p>So let's get started...</p>\n<h2 id=\"1-setup-your-mac-for-ios-app-development\" style=\"position:relative;\"><a href=\"#1-setup-your-mac-for-ios-app-development\" aria-label=\"1 setup your mac for ios app development permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1. Setup your MAC for ios app development</h2>\n<p>Apple prefers a closed ecosystem over an open system. iOS can only be run on Apple's own devices, including the iPhone and iPad.</p>\n<p>We can run Mac on window machines using VMWare or Hackintosh, but these are not recommended for iOS coding purposes.\nSo basically, as an iOS developer, you will need a Mac for the development/debugging/testing of an iOS app.</p>\n<h2 id=\"2-setup-your-editor-for-ios-application\" style=\"position:relative;\"><a href=\"#2-setup-your-editor-for-ios-application\" aria-label=\"2 setup your editor for ios application permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2. Setup, your editor for ios application</h2>\n<p>To start developing iOS apps, Xcode is the only tool you need to download. Xcode is an integrated development environment (IDE) provided by Apple. It includes the iOS SDK (Software Development Kit), a source code editor(UI), debugging tools, and much more.</p>\n<p>Many helping tools and needed simulators with a particular iOS version can be installed and added to Xcode.\nYou will need to have an Apple ID to download Xcode, deploy your app to a real iPhone/iPad for testing, and download any other software from AppStore.</p>\n<p>Apple ID is used to authenticate a user in Apple devices. You may create it by visiting the apple <a href=\"https://appleid.apple.com/account#!&#x26;page=create\">official site</a>.</p>\n<p>To install Xcode, go to the Mac App Store. App Store can be found in the dock. Login there with your Apple ID. In the Mac App Store, search \"Xcode\" and click the \"Get\" button to download it.</p>\n<p><img src=\"/eb4087ec36d030ba63d08fde5a4b9023/Imag1.webp\"></p>\n<h2 id=\"3-create-your-first-ios-app\" style=\"position:relative;\"><a href=\"#3-create-your-first-ios-app\" aria-label=\"3 create your first ios app permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3. Create your first ios app</h2>\n<p>Now click and launch Xcode. Choose create a new Xcode project option to make a new project. Then choose the Single View App option as a type of the project and click Next. It will come with one view controller and a storyboard that you can customize further.</p>\n<p>Let's name your project as HelloWorld as per the convention 😉. Choose Team None for now. Select Swift as Language, click Next, and you are ready with your empty app doing nothing yet.</p>\n<blockquote>\n<p>Note: For creating a native <a href=\"https://www.loginradius.com/blog/engineering/secure-enclave-ios-app/\">iOS app</a>, you have to use one from Objective-c or Swift. Swift is a new and easy language provided by Apple, got so much popularity in less time.</p>\n</blockquote>\n<p><img src=\"/2d051b2c11984f8dc6eded5a15a4c6c0/Image2.webp\"></p>\n<p>Not to worry, you will soon modify your created app saying Hello to the World. 😍\nIn Xcode, you can navigate to a file or folder from the code editor's left panel. The right panel of the code editor, called Utility Area, will help you dealing with views or any component in the storyboard.</p>\n<p>On the top toolbar, you can see the Run and Stop buttons. At the bottom of the code area, you can see the debug/console area with breakpoint and other runtime tools.</p>\n<p><img src=\"/acc8133b158a35588991b53e9384515b/Image6.webp\"></p>\n<p>Now find and open Main.storyboard in the project directory by clicking on it. The storyboard is a file to design your view to show and layout all the components such as buttons, labels, lists, tab and navigation bars, and many more. Here you will see a blank view. Select the view by clicking on it. </p>\n<p>From Xcode 10 or above, for objects like a label to add, click on View menu in menu bar>click Show Library and drag the label to focused view. Or in older Xcode, you may find Object Library in the bottom right part of Xcode. Now double click on the label you have dropped on the view and change it's text to Hello World!</p>\n<p><img src=\"/633e42cc27973114869cb95c0f98ac2b/Image3.webp\"></p>\n<p>Feeling excited? 😃</p>\n<p><strong>Here you go with your first-ever app on screen</strong></p>\n<h2 id=\"4-run-the-ios-application\" style=\"position:relative;\"><a href=\"#4-run-the-ios-application\" aria-label=\"4 run the ios application permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>4. Run the ios application</h2>\n<p>Select the device destination or simulator from the Xcode screen's top left near the Run/Stop button. And press Command ⌘ + R to run the app or click the run button. It will initiate the iOS simulator and run your first app.</p>\n<p>For running the app on a real device, connect the device via cable to Mac. The device will automatically be shown in the list of device destinations. Now select the device and press Command ⌘ + R.</p>\n<p><img src=\"/ea2e25ecbb9a337ef4a3d2441836f8db/Image4.webp\"></p>\n<p>Share your first app with your parents and friends, and feel proud. 👏 </p>\n<p><img src=\"/58421c91afb17198bf5a507862b11fd7/hello_word.webp\" alt=\"HelloWorld\"></p>\n<blockquote>\n<p>Note: If you want to debug or run any existing app/demo instead of developing your own. For example, You might have some projects downloaded from Github on your local system. Now follow the instructions from project's Github to explore the project.\nOpen the project in Xcode and run in a simulator or real device by following step 4 described above.</p>\n</blockquote>\n<p>That's it. </p>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>It's incredibly entertaining and satisfying to create your app idea. It's not just the result that counts-what makes it worth it is the gradual progress of improving, learning, and refining. And in the process, you will cultivate a special, employable skill of iOS development.</p>\n<p>I hope you liked this tutorial. Kindly share the blog and comment for any query or suggestion. </p>\n<p>To learn more about iOS applications, you can check out this article on “How to obtain iOS application logs without Mac” to learn about ios app logs in mac.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"date":"October 19, 2020","updated_date":null,"description":"I will guide you through the best approach to learning how to develop iOS apps in this post, so you can build and publish your own iOS apps from scratch.","title":"iOS App Development: How To Make Your First App","tags":["ios","swift","xcode","mac"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5267175572519085,"src":"/static/dde63430f9de95dd6a3ca8d01bdc5f00/58556/CoverImage.webp","srcSet":"/static/dde63430f9de95dd6a3ca8d01bdc5f00/61e93/CoverImage.webp 200w,\n/static/dde63430f9de95dd6a3ca8d01bdc5f00/1f5c5/CoverImage.webp 400w,\n/static/dde63430f9de95dd6a3ca8d01bdc5f00/58556/CoverImage.webp 800w,\n/static/dde63430f9de95dd6a3ca8d01bdc5f00/cc834/CoverImage.webp 1024w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Tanvi Jain","github":"tanvijn","avatar":null}}}},{"node":{"excerpt":"We'll talk about Apache Beam in this guide and discuss its fundamental concepts. We will begin by showing the features and advantages of…","fields":{"slug":"/engineering/apache-beam/"},"html":"<p>We'll talk about Apache Beam in this guide and discuss its fundamental concepts. We will begin by showing the features and advantages of using Apache Beam, and then we will cover basic concepts and terminologies.</p>\n<p>Ever since the concept of big data got introduced to the programming world, a lot of different technologies, frameworks have emerged. The processing of data can be categorized into two different paradigms. One is Batch Processing, and the other is Stream Processing. </p>\n<p>Different technologies came into existence for different paradigms, solving various big data world problems, for, e.g., Apache Spark, Apache Flink, Apache Storm, etc. </p>\n<p>As a developer or a business, it's always challenging to maintain different tech stacks and technologies. Hence, Apache Beam to the rescue!</p>\n<p><img src=\"/87621ed80402579f61f4dbe1f4acf3b0/timeline-bigdata-frameworks.webp\" alt=\"Timeline of Big Data Frameworks\"></p>\n<h2 id=\"what-is-apache-beam\" style=\"position:relative;\"><a href=\"#what-is-apache-beam\" aria-label=\"what is apache beam permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is Apache Beam?</h2>\n<p>Apache Beam is an open source, centralised model for describing parallel-processing pipelines for both batch and streaming data. The programming model of the Apache Beam simplifies large-scale data processing dynamics. </p>\n<p>The Apache Beam model offers helpful abstractions that insulate you from distributed processing information at low levels, such as managing individual staff, exchanging databases, and other activities. These low-level information are handled entirely by Dataflow. </p>\n<p><img src=\"/e60848d90d78a223537b25ced757ebd8/beam_architecture.webp\" alt=\"Beam-Model\"></p>\n<h2 id=\"features-of-apache-beam\" style=\"position:relative;\"><a href=\"#features-of-apache-beam\" aria-label=\"features of apache beam permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Features of Apache Beam</h2>\n<p>The unique features of Apache  beam are as follows:</p>\n<ol>\n<li>Unified - Use a single programming model for both batch and streaming use cases.</li>\n<li>Portable - Execute pipelines in multiple execution environments. Here, execution environments mean different runners. Ex. Spark Runner, Dataflow Runner, etc</li>\n<li>Extensible - Write custom SDKs, IO connectors, and transformation libraries.</li>\n</ol>\n<h2 id=\"apache-beam-sdks-and-runners\" style=\"position:relative;\"><a href=\"#apache-beam-sdks-and-runners\" aria-label=\"apache beam sdks and runners permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Apache Beam SDKs and Runners</h2>\n<p>As of today, there are 3 Apache beam programming SDKs</p>\n<ol>\n<li>Java</li>\n<li>Python</li>\n<li>Golang</li>\n</ol>\n<p>Beam Runners translate the beam pipeline to the API compatible backend processing of your choice. Beam currently supports runners that work with the following backends.</p>\n<ol>\n<li>Apache Spark</li>\n<li>Apache Flink</li>\n<li>Apache Samza</li>\n<li>Google Cloud Dataflow</li>\n<li>Hazelcast Jet</li>\n<li>Twister2</li>\n</ol>\n<p>Direct Runner to run on the host machine, which is used for testing purposes.</p>\n<h2 id=\"basic-concepts-in-apache-beam\" style=\"position:relative;\"><a href=\"#basic-concepts-in-apache-beam\" aria-label=\"basic concepts in apache beam permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Basic Concepts in Apache Beam</h2>\n<p>Apache Beam has three main abstractions. They are</p>\n<ol>\n<li>Pipeline</li>\n<li>PCollection</li>\n<li>PTransform</li>\n</ol>\n<p><img src=\"/43c6ed2905ff270fda8ca418748b7aeb/pipeline-design.webp\" alt=\"Beam-Pipeline\"></p>\n<h3 id=\"pipeline\" style=\"position:relative;\"><a href=\"#pipeline\" aria-label=\"pipeline permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Pipeline:</h3>\n<p>A pipeline is the first abstraction to be created. It holds the complete data processing job from start to finish, including reading data, manipulating data, and writing data to a sink. Every pipeline takes in options/parameters that indicate where and how to run. </p>\n<h3 id=\"pcollection\" style=\"position:relative;\"><a href=\"#pcollection\" aria-label=\"pcollection permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>PCollection:</h3>\n<p>A pcollection is an abstraction of distributed data. A pcollection can be bounded, i.e., finite data, or unbounded, i.e., infinite data. The initial pcollection is created by reading data from the source. From then on, pcollections are the source and sink of every step in the pipeline.</p>\n<h3 id=\"transform\" style=\"position:relative;\"><a href=\"#transform\" aria-label=\"transform permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Transform:</h3>\n<p>A transform is a data processing operation. A transform is applied on one or more pcollections. Complex transforms have other transform nested within them. Every transform has a generic <code>apply</code> method where the logic of the transform sits in.</p>\n<h2 id=\"example-of-pipeline\" style=\"position:relative;\"><a href=\"#example-of-pipeline\" aria-label=\"example of pipeline permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Example of Pipeline</h2>\n<p>Here, let's write a pipeline to output all the jsons where the name starts with a vowel.</p>\n<p>Let's take a sample input. Name the file as <code>input.json</code></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"json\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk8\">&quot;abhi&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">&quot;score&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk7\">12</span><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk8\">&quot;virat&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">&quot;score&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk7\">23</span><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk8\">&quot;dhoni&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">&quot;score&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk7\">45</span><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk8\">&quot;rahul&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">&quot;score&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk7\">156</span><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;Edmund&quot;</span><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;Ojha&quot;</span><span class=\"mtk1\">}</span></span></code></pre>\n<p>The input should be a newline delimited JSON.</p>\n<p>Include the following dependencies in your <code>pom.xml</code></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">&lt;dependency&gt;</span>\n<span class=\"grvsc-line\">    &lt;groupId&gt;org.apache.beam&lt;/groupId&gt;</span>\n<span class=\"grvsc-line\">    &lt;artifactId&gt;beam-sdks-java-core&lt;/artifactId&gt;</span>\n<span class=\"grvsc-line\">    &lt;version&gt;2.24.0&lt;/version&gt;</span>\n<span class=\"grvsc-line\">&lt;/dependency&gt;</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">&lt;dependency&gt;</span>\n<span class=\"grvsc-line\">    &lt;groupId&gt;org.apache.beam&lt;/groupId&gt;</span>\n<span class=\"grvsc-line\">    &lt;artifactId&gt;beam-runners-direct-java&lt;/artifactId&gt;</span>\n<span class=\"grvsc-line\">    &lt;version&gt;2.24.0&lt;/version&gt;</span>\n<span class=\"grvsc-line\">&lt;/dependency&gt;</span></code></pre>\n<p>Let's code the beam pipeline. Follow the steps</p>\n<ol>\n<li>\n<p>Create a pipeline.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"java\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk10\">Pipeline</span><span class=\"mtk1\"> </span><span class=\"mtk12\">pipeLine</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">Pipeline</span><span class=\"mtk1\">.</span><span class=\"mtk11\">create</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// OR </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// Pipeline pipeLine = Pipeline.create(options);</span></span></code></pre>\n<p>Create a pipeline which binds all the pcollections and transforms. Optionally you can pass the PipelineOptions <code>options</code> if needed.</p>\n</li>\n<li>\n<p>Read the input file</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"java\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk10\">PCollection</span><span class=\"mtk1\">&lt;</span><span class=\"mtk10\">String</span><span class=\"mtk1\">&gt; </span><span class=\"mtk12\">inputCollection</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">pipeLine</span><span class=\"mtk1\">.</span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Read My File&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">TextIO</span><span class=\"mtk1\">.</span><span class=\"mtk11\">read</span><span class=\"mtk1\">().</span><span class=\"mtk11\">from</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;input.json&quot;</span><span class=\"mtk1\">));</span></span></code></pre>\n<p>Use the <code>TextIO</code> transform to read the input files. Every line is a different json record.</p>\n</li>\n<li>\n<p>Apply a transform to filter out the names starting from a vowel</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"java\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk10\">PCollection</span><span class=\"mtk1\"> </span><span class=\"mtk12\">filteredCollection</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">inputCollection</span><span class=\"mtk1\">.</span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Filter names starting with vowels&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">Filter</span><span class=\"mtk1\">.</span><span class=\"mtk11\">by</span><span class=\"mtk1\">(</span><span class=\"mtk15\">new</span><span class=\"mtk1\"> </span><span class=\"mtk10\">SerializableFunction</span><span class=\"mtk1\">&lt;</span><span class=\"mtk10\">String</span><span class=\"mtk1\">, </span><span class=\"mtk10\">Boolean</span><span class=\"mtk1\">&gt;() {</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> </span><span class=\"mtk10\">Boolean</span><span class=\"mtk1\"> </span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk10\">String</span><span class=\"mtk1\"> </span><span class=\"mtk12\">input</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk10\">ObjectMapper</span><span class=\"mtk1\"> </span><span class=\"mtk12\">jacksonObjMapper</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">new</span><span class=\"mtk1\"> </span><span class=\"mtk11\">ObjectMapper</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk15\">try</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk10\">JsonNode</span><span class=\"mtk1\"> </span><span class=\"mtk12\">jsonNode</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">jacksonObjMapper</span><span class=\"mtk1\">.</span><span class=\"mtk11\">readTree</span><span class=\"mtk1\">(input);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk10\">String</span><span class=\"mtk1\"> </span><span class=\"mtk12\">name</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">jsonNode</span><span class=\"mtk1\">.</span><span class=\"mtk11\">get</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;name&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">textValue</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk12\">vowels</span><span class=\"mtk1\">.</span><span class=\"mtk11\">contains</span><span class=\"mtk1\">(</span><span class=\"mtk12\">name</span><span class=\"mtk1\">.</span><span class=\"mtk11\">substring</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">,</span><span class=\"mtk7\">1</span><span class=\"mtk1\">).</span><span class=\"mtk11\">toLowerCase</span><span class=\"mtk1\">());</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            } </span><span class=\"mtk15\">catch</span><span class=\"mtk1\"> (</span><span class=\"mtk10\">JsonProcessingException</span><span class=\"mtk1\"> </span><span class=\"mtk12\">e</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk12\">e</span><span class=\"mtk1\">.</span><span class=\"mtk11\">printStackTrace</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk4\">false</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }))</span></span></code></pre>\n<p>The filter transform takes a SerializableFunction Object where the <code>apply</code> method is overridden. Every json-string record is converted to a JSON. The first character of the <code>name</code> is checked if it's a vowel. The transform is applied to each input JSON record. Based on the boolean value returned, the record is retained or discarded.</p>\n</li>\n<li>\n<p>Write the results to a file</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"java\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">inputCollection</span><span class=\"mtk1\">.</span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;write to file&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">TextIO</span><span class=\"mtk1\">.</span><span class=\"mtk11\">write</span><span class=\"mtk1\">().</span><span class=\"mtk11\">to</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;result&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">withSuffix</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.txt&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">withoutSharding</span><span class=\"mtk1\">());</span></span></code></pre>\n<p>The results of the <code>Filter</code> transform are stored in a text file using the write method of the <code>TextIO</code> transform. As PCollections are distributed across machines, the results are written to multiple files/shards. To avoid this, we use <code>withoutSharding</code> where all the output is written to a single file.</p>\n</li>\n</ol>\n<p>Output:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"json\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;Edmund&quot;</span><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;Ojha&quot;</span><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">{</span><span class=\"mtk12\">&quot;name&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk8\">&quot;abhi&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">&quot;score&quot;</span><span class=\"mtk1\">:</span><span class=\"mtk7\">12</span><span class=\"mtk1\">}</span></span></code></pre>\n<hr>\n<p>Complete Code:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"java\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk10\">Pipeline</span><span class=\"mtk1\"> </span><span class=\"mtk12\">pipeLine</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">Pipeline</span><span class=\"mtk1\">.</span><span class=\"mtk11\">create</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">final</span><span class=\"mtk1\"> </span><span class=\"mtk10\">Set</span><span class=\"mtk1\">&lt;</span><span class=\"mtk10\">String</span><span class=\"mtk1\">&gt; </span><span class=\"mtk12\">vowels</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">new</span><span class=\"mtk1\"> </span><span class=\"mtk10\">HashSet</span><span class=\"mtk1\">&lt;</span><span class=\"mtk10\">String</span><span class=\"mtk1\">&gt;(</span><span class=\"mtk12\">Arrays</span><span class=\"mtk1\">.</span><span class=\"mtk11\">asList</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;a&quot;</span><span class=\"mtk1\">,</span><span class=\"mtk8\">&quot;e&quot;</span><span class=\"mtk1\">,</span><span class=\"mtk8\">&quot;i&quot;</span><span class=\"mtk1\">,</span><span class=\"mtk8\">&quot;o&quot;</span><span class=\"mtk1\">,</span><span class=\"mtk8\">&quot;u&quot;</span><span class=\"mtk1\">));</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">pipeLine</span><span class=\"mtk1\">.</span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Read My File&quot;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk12\">TextIO</span><span class=\"mtk1\">.</span><span class=\"mtk11\">read</span><span class=\"mtk1\">().</span><span class=\"mtk11\">from</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;input.json&quot;</span><span class=\"mtk1\">))</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        .</span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Filter names starting with vowels&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">Filter</span><span class=\"mtk1\">.</span><span class=\"mtk11\">by</span><span class=\"mtk1\">(</span><span class=\"mtk15\">new</span><span class=\"mtk1\"> </span><span class=\"mtk10\">SerializableFunction</span><span class=\"mtk1\">&lt;</span><span class=\"mtk10\">String</span><span class=\"mtk1\">, </span><span class=\"mtk10\">Boolean</span><span class=\"mtk1\">&gt;() {</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> </span><span class=\"mtk10\">Boolean</span><span class=\"mtk1\"> </span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk10\">String</span><span class=\"mtk1\"> </span><span class=\"mtk12\">input</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk10\">ObjectMapper</span><span class=\"mtk1\"> </span><span class=\"mtk12\">jacksonObjMapper</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">new</span><span class=\"mtk1\"> </span><span class=\"mtk11\">ObjectMapper</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk15\">try</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                    </span><span class=\"mtk10\">JsonNode</span><span class=\"mtk1\"> </span><span class=\"mtk12\">jsonNode</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">jacksonObjMapper</span><span class=\"mtk1\">.</span><span class=\"mtk11\">readTree</span><span class=\"mtk1\">(input);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                    </span><span class=\"mtk10\">String</span><span class=\"mtk1\"> </span><span class=\"mtk12\">name</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">jsonNode</span><span class=\"mtk1\">.</span><span class=\"mtk11\">get</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;name&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">textValue</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                    </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk12\">vowels</span><span class=\"mtk1\">.</span><span class=\"mtk11\">contains</span><span class=\"mtk1\">(</span><span class=\"mtk12\">name</span><span class=\"mtk1\">.</span><span class=\"mtk11\">substring</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">,</span><span class=\"mtk7\">1</span><span class=\"mtk1\">).</span><span class=\"mtk11\">toLowerCase</span><span class=\"mtk1\">());</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                } </span><span class=\"mtk15\">catch</span><span class=\"mtk1\"> (</span><span class=\"mtk10\">JsonProcessingException</span><span class=\"mtk1\"> </span><span class=\"mtk12\">e</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                    </span><span class=\"mtk12\">e</span><span class=\"mtk1\">.</span><span class=\"mtk11\">printStackTrace</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk4\">false</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        }))</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        .</span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;write to file&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">TextIO</span><span class=\"mtk1\">.</span><span class=\"mtk11\">write</span><span class=\"mtk1\">().</span><span class=\"mtk11\">to</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;result&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">withSuffix</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.txt&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">withoutSharding</span><span class=\"mtk1\">());</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">pipeLine</span><span class=\"mtk1\">.</span><span class=\"mtk11\">run</span><span class=\"mtk1\">().</span><span class=\"mtk11\">waitUntilFinish</span><span class=\"mtk1\">();</span></span></code></pre>\n<p>For more advanced concepts, refer to the official site - beam.apache.org</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n</style>","frontmatter":{"date":"October 16, 2020","updated_date":null,"description":"Apache Beam simplifies large-scale data processing dynamics. Let’s read more about the features, basic concepts, and the fundamentals of Apache beam.","title":"Apache Beam: A Basic Guide","tags":["Engineering","Big Data","Streaming","Apache Beam","Java"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/8afbe1aebda6504f38c81e81dee39f35/58556/main.webp","srcSet":"/static/8afbe1aebda6504f38c81e81dee39f35/61e93/main.webp 200w,\n/static/8afbe1aebda6504f38c81e81dee39f35/1f5c5/main.webp 400w,\n/static/8afbe1aebda6504f38c81e81dee39f35/58556/main.webp 800w,\n/static/8afbe1aebda6504f38c81e81dee39f35/99238/main.webp 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Abhilash K R","github":"Better-Boy","avatar":null}}}},{"node":{"excerpt":"In this article, we'll talk about the basic concept of virtual environment in python -  what it is and how to use it and also how to build…","fields":{"slug":"/engineering/python-virtual-environments/"},"html":"<p>In this article, we'll talk about the basic concept of virtual environment in python -  what it is and how to use it and also how to build and manage separate environments for your Python projects using virtual environments. </p>\n<h2 id=\"what-is-a-virtual-environment\" style=\"position:relative;\"><a href=\"#what-is-a-virtual-environment\" aria-label=\"what is a virtual environment permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is a virtual environment?</h2>\n<p>A virtual environment is simply a tool that separates the dependencies of different projects by creating a separate isolated environment for each project.</p>\n<p>These are simply the directories so that unlimited virtual environments can be created. This is one of the popular tools used by most of the Python developers.</p>\n<h2 id=\"why-do-we-need-a-virtual-environment\" style=\"position:relative;\"><a href=\"#why-do-we-need-a-virtual-environment\" aria-label=\"why do we need a virtual environment permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why do we need a virtual environment?</h2>\n<p><a href=\"/python-basics-in-minutes/\">Python has various modules</a> and packages for different applications. During our project, it may require a third-party library, which we install. Another project also uses the same directory for retrieval and storage but doesn't require any other third-party packages.</p>\n<p>So, the virtual environment can come into play and make a separate isolated environment for both projects, and each project can store and retrieve packages from their specific environment.</p>\n<p>Also, let us consider another case where we are creating a web application <a href=\"https://www.djangoproject.com/start/\">using Django</a>. Suppose you are working on two projects project1 and project2. </p>\n<p>If project1 uses Django-2.2 and project2 uses Django-3.2, they would be stored in the same directory with the same name, and the error may occur. Then, in such cases, virtual environments can be really helpful for you to maintain the dependencies of both the projects.</p>\n<h2 id=\"how-does-a-virtual-environment-work\" style=\"position:relative;\"><a href=\"#how-does-a-virtual-environment-work\" aria-label=\"how does a virtual environment work permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How does a virtual environment work?</h2>\n<p>To create a virtual environment, we need a <a href=\"https://pypi.org/project/virtualenv/\">module named</a> virtualenv. It creates a folder with all the necessary executables to run Python projects. Make sure <strong>pip</strong> is installed on your computer. If not, then use the following command:</p>\n<p><img src=\"/9fa10fcc5576d9428768731619cba792/pip.webp\" alt=\"Pip\" /><br></p>\n<h3 id=\"install-virtualenv\" style=\"position:relative;\"><a href=\"#install-virtualenv\" aria-label=\"install virtualenv permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Install virtualenv:</h3>\n<p>Open the terminal and paste the following command to install a virtualenv:</p>\n<p><img src=\"/f9658abd5f1e49b3e951afcd884adb6a/install.webp\" alt=\"Install\" /><br></p>\n<h3 id=\"check-your-version-of-virtualenv\" style=\"position:relative;\"><a href=\"#check-your-version-of-virtualenv\" aria-label=\"check your version of virtualenv permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Check your version of virtualenv:</h3>\n<p>If you want to confirm whether it is installed or not, paste the command below in your terminal:</p>\n<p><img src=\"/5221153f420814832190b6a8eb7c5ec4/check.webp\" alt=\"Check\" /><br></p>\n<h3 id=\"create-a-virtual-environment\" style=\"position:relative;\"><a href=\"#create-a-virtual-environment\" aria-label=\"create a virtual environment permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Create a virtual environment:</h3>\n<p>After successful installation of virtualenv, now you can create a virtual environment with your desired name using following command:</p>\n<p><img src=\"/76cce15130697d584fb75e02df60601b/name.webp\" alt=\"Check\" /><br></p>\n<p>Here, I created <code>venv</code> as the name of my virtual environment. You can name it whatever you desire. The folder with the name <code>venv</code> is created that contains all the necessary executables to <a href=\"/speed-up-python-code/\">run the Python project</a>. This is the folder where all your python packages will run.</p>\n<p>To specify the Python interpreter of your choice, you can do it easily by specifying Python{version-name}.\nEg: To create python2.7 virtual environment, we use following command:</p>\n<p><img src=\"/a5b7c69d3dff106d6fe355ae725541dd/version.webp\" alt=\"Version\" /><br></p>\n<p>After successfully creating the virtual environment, you need to activate it to enter into that particular isolated environment. Always remember to activate the required virtual environment before working on the project. To activate it, we move to the location where the name of your desired virtual environment is located and follow the command below:</p>\n<p><img src=\"/9d3d2c7f55a4fd52999a514f73ac46ef/activate.webp\" alt=\"Activate\" /><br></p>\n<p><strong>Note:</strong> Instead of <code>venv</code>, you write the name of your virtual environment you created.<br></p>\n<h4 id=\"in-windows\" style=\"position:relative;\"><a href=\"#in-windows\" aria-label=\"in windows permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>In Windows,</h4>\n<p><img src=\"/9fb235d96fd1d14f07bfa3fffa942419/windows.webp\" alt=\"Windows\" /><br></p>\n<p>After activating the virtual environment, you can see your name on the virtual environment on the terminal's left side. It confirms the activation of your virtual environment and is currently active. </p>\n<p><img src=\"/affe1c8aa1265fe5783364e3f41de2fc/activated.webp\" alt=\"Activated\" /><br></p>\n<p>Finally, you successfully created and activated your virtual environment. Now, you can install the dependencies and requirements your project asks for without interfering with other projects.</p>\n<p>Once you completed your work, then you can return to the system default environment by just using the <strong>deactivate</strong> command as shown below:</p>\n<img src=\"/2d752ab9b41bfc22473be6e2614d02c2/deactivate.webp\" alt=\"Deactivate\" />\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"date":"October 16, 2020","updated_date":null,"description":"We'll cover the basics of virtual environments in this guide and how to use them. We will then take a closer look at how virtual environments actually work.","title":"Python Virtual Environment: What is it and how it works?","tags":["Python"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":2.127659574468085,"src":"/static/674ce17a9dc4e13f0616a1fd935bc596/58556/python.webp","srcSet":"/static/674ce17a9dc4e13f0616a1fd935bc596/61e93/python.webp 200w,\n/static/674ce17a9dc4e13f0616a1fd935bc596/1f5c5/python.webp 400w,\n/static/674ce17a9dc4e13f0616a1fd935bc596/58556/python.webp 800w,\n/static/674ce17a9dc4e13f0616a1fd935bc596/7bd08/python.webp 1171w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Ashish Maharjan","github":"AshishMhrzn10","avatar":null}}}},{"node":{"excerpt":"Writing a foolproof code is hard, especially with a team collaborating on a single project. Thus it becomes increasingly important to ensure…","fields":{"slug":"/engineering/e2e-testing-with-jest-puppeteer/"},"html":"<p>Writing a foolproof code is hard, especially with a team collaborating on a single project. Thus it becomes increasingly important to ensure that no new code breaks existing functionality. And for this purpose, automated tests are used. </p>\n<h2 id=\"requirements\" style=\"position:relative;\"><a href=\"#requirements\" aria-label=\"requirements permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Requirements</h2>\n<ol>\n<li>Basic knowledge of Javascript</li>\n<li>Familiarity with Node.js</li>\n</ol>\n<p>In this blog, we will learn how to integrate Jest and Puppeteer in our project for End-to-End Testing. <a href=\"https://github.com/facebook/jest\">Jest</a> is a javascript testing framework maintained by Facebook. <a href=\"https://github.com/puppeteer/puppeteer\">Puppeteer</a> is a Node library created by Google, which provides a high-level API to control headless Chrome. Before we delve deeper into Jest and Puppeteer, let's familiarise ourselves with a few things.</p>\n<p><strong>End-to-End(E2E) Testing:</strong> E2E testing refers to the testing of a complete functionality of some application. It checks that a functionality acts as intended.</p>\n<p><strong>Headless Testing:</strong> Headless testing is a way or running browser UI tests without any browser UI. It is a preferred method mainly due to its performance. It is fast, light-weight, and less resource-intensive. </p>\n<h2 id=\"installation\" style=\"position:relative;\"><a href=\"#installation\" aria-label=\"installation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Installation</h2>\n<p>To install Jest and Puppeteer, open the command line in your project directory and run:</p>\n<p><strong>For npm users:</strong><br>\n<code>npm install --save-dev jest puppeteer jest-puppeteer</code></p>\n<p><strong>For yarn users:</strong><br>\n<code>yarn add --dev jest puppeteer jest-puppeteer.</code></p>\n<p>Now that we've installed Jest and Puppeteer, it is time to set up the testing environment. Create a file <code>jest.config.js</code> in the project root directory and write the following code in it:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk10\">module</span><span class=\"mtk1\">.</span><span class=\"mtk10\">exports</span><span class=\"mtk1\"> = {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">preset:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;jest-puppeteer&quot;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">globals:</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">URL:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;http://localhost:8080&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  },</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">testMatch:</span><span class=\"mtk1\"> [</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk8\">&quot;&lt;path-to-the-tests-folder&gt;/**.test.js&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  ],</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">verbose:</span><span class=\"mtk1\"> </span><span class=\"mtk4\">true</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">};</span></span></code></pre>\n<p>Defining the preset sets up a puppeteer environment for testing. Test match directs it to the folder where tests are defined, for a piece of more detailed knowledge about running Jest with Puppeteer <a href=\"https://jestjs.io/docs/en/puppeteer\">check this out</a>.</p>\n<p>Now create a file <code>jest-puppeteer.config.js</code> in the project root directory. Here we define the testing environment further. To begin with you can add the following in this file:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk10\">module</span><span class=\"mtk1\">.</span><span class=\"mtk10\">exports</span><span class=\"mtk1\"> = {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">launch:</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">headless:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">process</span><span class=\"mtk1\">.</span><span class=\"mtk12\">env</span><span class=\"mtk1\">.</span><span class=\"mtk12\">HEADLESS</span><span class=\"mtk1\"> !== </span><span class=\"mtk8\">&#39;false&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">slowMo:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">process</span><span class=\"mtk1\">.</span><span class=\"mtk12\">env</span><span class=\"mtk1\">.</span><span class=\"mtk12\">SLOWMO</span><span class=\"mtk1\"> ? </span><span class=\"mtk12\">process</span><span class=\"mtk1\">.</span><span class=\"mtk12\">env</span><span class=\"mtk1\">.</span><span class=\"mtk12\">SLOWMO</span><span class=\"mtk1\"> : </span><span class=\"mtk7\">0</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">devtools:</span><span class=\"mtk1\"> </span><span class=\"mtk4\">true</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<h2 id=\"testing\" style=\"position:relative;\"><a href=\"#testing\" aria-label=\"testing permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Testing</h2>\n<p>Now we can begin writing our tests. In this example, we'll start writing a basic test to check the title of the page opened. Now head over to the tests folder defined and create a file <code>title.test.js</code>. As you might have noticed, <code>.test.js</code> would be the file extension of the jest tests defined. </p>\n<p>This is what a typical <code>title.test.js</code> would look like:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">// Defining the timeout for the test</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">timeout</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">process</span><span class=\"mtk1\">.</span><span class=\"mtk12\">env</span><span class=\"mtk1\">.</span><span class=\"mtk12\">SLOWMO</span><span class=\"mtk1\"> ? </span><span class=\"mtk7\">6000</span><span class=\"mtk1\"> : </span><span class=\"mtk7\">4000</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">fs</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">require</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;fs&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// Go to the specified path and wait for the domcontent to load before running the tests</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">beforeAll</span><span class=\"mtk1\">(</span><span class=\"mtk4\">async</span><span class=\"mtk1\"> () </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">path</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">fs</span><span class=\"mtk1\">.</span><span class=\"mtk11\">realpathSync</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;file://&lt;file-path&gt;&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk12\">page</span><span class=\"mtk1\">.</span><span class=\"mtk11\">goto</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;file://&#39;</span><span class=\"mtk1\"> + </span><span class=\"mtk12\">path</span><span class=\"mtk1\">, {</span><span class=\"mtk12\">waitUntil:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;domcontentloaded&#39;</span><span class=\"mtk1\">});</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">});</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">describe</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;Title of the page&#39;</span><span class=\"mtk1\">, () </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">test</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;Title of the page&#39;</span><span class=\"mtk1\">, </span><span class=\"mtk4\">async</span><span class=\"mtk1\"> () </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk3\">// Gets page title</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">title</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk12\">page</span><span class=\"mtk1\">.</span><span class=\"mtk11\">title</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk3\">// Compares it with the intended behaviour</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">expect</span><span class=\"mtk1\">(</span><span class=\"mtk12\">title</span><span class=\"mtk1\">).</span><span class=\"mtk11\">toBe</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;&lt;title-of-the-page&gt;&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }, </span><span class=\"mtk12\">timeout</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">});</span></span></code></pre>\n<p>Hurray! You've added Headless UI tests to your project. Now you can similarly define tests for different functionalities using the docs <a href=\"https://devdocs.io/puppeteer/\">here</a>.</p>\n<h2 id=\"cons-of-using-jest-puppeteer\" style=\"position:relative;\"><a href=\"#cons-of-using-jest-puppeteer\" aria-label=\"cons of using jest puppeteer permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Cons of using jest-puppeteer</h2>\n<ol>\n<li>It is headless and hence fast, light-weight, and less resource-intensive. </li>\n<li>It can stimulate keyboard-press and mouse-click akin to manual testing functions.</li>\n<li>It is simple and easy to use and works out of the box.</li>\n</ol>\n<h2 id=\"problems-that-you-might-face\" style=\"position:relative;\"><a href=\"#problems-that-you-might-face\" aria-label=\"problems that you might face permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Problems that you might face</h2>\n<p>It could give a sandbox-ing error if you run it in a container without a defined user. When running headless Chrome in a container without a defined user, the chromeOptions environment property needs a --no-sandbox args (in addition to the other headless args), or Chrome won't be able to startup. The <strong>possible solutions</strong> to this are:</p>\n<ol>\n<li>Make sure you're not running them as a root user. </li>\n<li>If running them as a root user, include <code>args: ['--no-sandbox']</code> in jest-puppeteer.config.js (not recommended).</li>\n<li>Make sure you have all the required dependencies installed.\nFor Debian systems that can be installed using:\n<code>sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget</code>  </li>\n</ol>\n<p><strong>Happy coding! =)</strong></p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n</style>","frontmatter":{"date":"October 15, 2020","updated_date":null,"description":"Learn how to integrate Jest and Puppeteer in your project for End-to-End Testing.","title":"End-to-End Testing with Jest and Puppeteer","tags":["Testing","Jest","Puppeteer"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.6129032258064515,"src":"/static/eac53dcd5bac1a253375e85170c64e4e/c622d/jest-puppeteer.webp","srcSet":"/static/eac53dcd5bac1a253375e85170c64e4e/61e93/jest-puppeteer.webp 200w,\n/static/eac53dcd5bac1a253375e85170c64e4e/1f5c5/jest-puppeteer.webp 400w,\n/static/eac53dcd5bac1a253375e85170c64e4e/c622d/jest-puppeteer.webp 799w","sizes":"(max-width: 799px) 100vw, 799px"}}},"author":{"id":"Shreya Sharma","github":"cypherean","avatar":null}}}},{"node":{"excerpt":"A Few Ways to Speed Up Your Python Code Python is one of the most popular languages all over the world. Nowadays it is being used in…","fields":{"slug":"/engineering/speed-up-python-code/"},"html":"<h1 id=\"a-few-ways-to-speed-up-your-python-code\" style=\"position:relative;\"><a href=\"#a-few-ways-to-speed-up-your-python-code\" aria-label=\"a few ways to speed up your python code permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>A Few Ways to Speed Up Your Python Code</h1>\n<p>Python is one of the most popular languages all over the world. Nowadays it is being used in competitive programming also because of its simple syntax and rich libraries. Most of us probably started coding with python. At first, everything goes simple and easy. But while solving a hard algorithmic problem, most of us suffer from <code>Time Limit Exceeded</code>. However, it is not a problem of python; it is the programmer's problem. I am not saying that language is not slow, but if a programmer writes an efficient programme, it will get <code>Accepted</code> for sure. Here are some tips to speed up your python programme.</p>\n<h2 id=\"use-proper-data-structure\" style=\"position:relative;\"><a href=\"#use-proper-data-structure\" aria-label=\"use proper data structure permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use proper data structure</h2>\n<p>Use of proper data structure has a significant effect on runtime. Python has list, tuple, set and dictionary as the built-in data structures. However, most of the people use the list in all cases. But it is not a right choice. Use proper data structures depending on your task. Especially use a tuple instead of a list. Because iterating over tuple is easier than iterating over a list.</p>\n<h2 id=\"decrease-the-use-of-for-loop\" style=\"position:relative;\"><a href=\"#decrease-the-use-of-for-loop\" aria-label=\"decrease the use of for loop permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Decrease the use of for loop</h2>\n<p>As for loop is dynamic in python, it takes more time than while loop. So, use while loop instead of for loop.</p>\n<h2 id=\"use-list-comprehension\" style=\"position:relative;\"><a href=\"#use-list-comprehension\" aria-label=\"use list comprehension permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use list comprehension</h2>\n<p>Do not use any other technique if you can use list comprehension. For example, here is a code to list all the numbers between 1 and 1000 that is the multiplier of 3:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">L = []</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\"> i </span><span class=\"mtk4\">in</span><span class=\"mtk1\"> </span><span class=\"mtk11\">range</span><span class=\"mtk1\"> (</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1000</span><span class=\"mtk1\">):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> i%</span><span class=\"mtk7\">3</span><span class=\"mtk1\"> == </span><span class=\"mtk7\">0</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        L.append (i)</span></span></code></pre>\n<p>Using list comprehension, it would be:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">L = [i </span><span class=\"mtk15\">for</span><span class=\"mtk1\"> i </span><span class=\"mtk4\">in</span><span class=\"mtk1\"> </span><span class=\"mtk11\">range</span><span class=\"mtk1\"> (</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1000</span><span class=\"mtk1\">) </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> i%</span><span class=\"mtk7\">3</span><span class=\"mtk1\"> == </span><span class=\"mtk7\">0</span><span class=\"mtk1\">]</span></span></code></pre>\n<p>List comprehension works faster than using the append method.</p>\n<h2 id=\"use-multiple-assignments\" style=\"position:relative;\"><a href=\"#use-multiple-assignments\" aria-label=\"use multiple assignments permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use multiple assignments</h2>\n<p>Do not assaign variables like this:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">a = </span><span class=\"mtk7\">2</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">b = </span><span class=\"mtk7\">3</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">c = </span><span class=\"mtk7\">5</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">d = </span><span class=\"mtk7\">7</span></span></code></pre>\n<p>Instead, assign variables like this:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">a, b, c, d = </span><span class=\"mtk7\">2</span><span class=\"mtk1\">, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">, </span><span class=\"mtk7\">5</span><span class=\"mtk1\">, </span><span class=\"mtk7\">7</span></span></code></pre>\n<h2 id=\"do-not-use-global-variables\" style=\"position:relative;\"><a href=\"#do-not-use-global-variables\" aria-label=\"do not use global variables permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Do not use global variables</h2>\n<p>Python has <code>global</code> keyword to declare global variables. But global variables take higher time during operation than a local variable. So, do not use global variables if it is not necessary.</p>\n<h2 id=\"use-library-function\" style=\"position:relative;\"><a href=\"#use-library-function\" aria-label=\"use library function permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use library function</h2>\n<p>Do not write your function (manually) if it is already in the library. Library functions are highly efficient, and you will probably won't be able to code with that efficiency.</p>\n<h2 id=\"concatenate-strings-with-join\" style=\"position:relative;\"><a href=\"#concatenate-strings-with-join\" aria-label=\"concatenate strings with join permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Concatenate strings with join</h2>\n<p>In python, you can concatenate strings with <code>+</code> operation.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">concatenatedString = </span><span class=\"mtk8\">&quot;Programming &quot;</span><span class=\"mtk1\"> + </span><span class=\"mtk8\">&quot;is &quot;</span><span class=\"mtk1\"> + </span><span class=\"mtk8\">&quot;fun.&quot;</span></span></code></pre>\n<p>It can also be done with <code>join()</code> method.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">concatenatedString = </span><span class=\"mtk8\">&quot; &quot;</span><span class=\"mtk1\">.join ([</span><span class=\"mtk8\">&quot;Programming&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;is&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;fun.&quot;</span><span class=\"mtk1\">])</span></span></code></pre>\n<p><code>join()</code> concatenates strings faster than <code>+</code> operation because <code>+</code> operators create a new string and then copies the old content at each step. But <code>join()</code> doesn't work that way.</p>\n<h2 id=\"use-generators\" style=\"position:relative;\"><a href=\"#use-generators\" aria-label=\"use generators permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use generators</h2>\n<p>If you have a large amount of data in your list and you need to use one data at a time and for once then use <code>generator</code>s. It will save you time.</p>\n<h2 id=\"it-may-seem-efficient-but-its-not\" style=\"position:relative;\"><a href=\"#it-may-seem-efficient-but-its-not\" aria-label=\"it may seem efficient but its not permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>It may seem efficient, but it's not</h2>\n<p>See the below code:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">L = []</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\"> element </span><span class=\"mtk4\">in</span><span class=\"mtk1\"> </span><span class=\"mtk10\">set</span><span class=\"mtk1\">(L):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    ...</span></span></code></pre>\n<p>The above code may seem efficient because it used set to delete duplicate data. But the reality is that the code is not efficient. Do not forget that converting a list into set takes time. So this code will work better than the previous:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\"> element </span><span class=\"mtk4\">in</span><span class=\"mtk1\"> L:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    ...</span></span></code></pre>\n<h2 id=\"do-not-use-dot-operation\" style=\"position:relative;\"><a href=\"#do-not-use-dot-operation\" aria-label=\"do not use dot operation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Do not use dot operation</h2>\n<p>Try to avoid dot operation. See the below programme.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> math</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">val = math.sqrt(</span><span class=\"mtk7\">60</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>Instead of the above style write code like this:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">from</span><span class=\"mtk1\"> math </span><span class=\"mtk15\">import</span><span class=\"mtk1\"> sqrt</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">val = sqrt(</span><span class=\"mtk7\">60</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>Because when you call a function using <code>.</code> (dot) it first calls <code>__getattribute()__</code> or <code>__getattr()__</code> which then use dictionary operation which costs time. So, try using <code>from module import function</code>.</p>\n<h2 id=\"use-1-for-infinity-loops\" style=\"position:relative;\"><a href=\"#use-1-for-infinity-loops\" aria-label=\"use 1 for infinity loops permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use 1 for infinity loops</h2>\n<p>Use <code>while 1</code> instead of <code>while True</code>. It will reduce some runtime.</p>\n<h2 id=\"try-a-different-approach\" style=\"position:relative;\"><a href=\"#try-a-different-approach\" aria-label=\"try a different approach permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Try a different approach</h2>\n<p>Try new ways to write your code efficiently. See the below code.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"10\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">if</span><span class=\"mtk1\"> a_condition:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> another_condition:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        do_something</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">else</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">raise</span><span class=\"mtk1\"> exception</span></span></code></pre>\n<p>Instead of the above code you can write:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"11\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk4\">not</span><span class=\"mtk1\"> a_condition) </span><span class=\"mtk4\">or</span><span class=\"mtk1\"> (</span><span class=\"mtk4\">not</span><span class=\"mtk1\"> another_condition):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">raise</span><span class=\"mtk1\"> exception</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">do_something</span></span></code></pre>\n<h2 id=\"use-speed-up-applications\" style=\"position:relative;\"><a href=\"#use-speed-up-applications\" aria-label=\"use speed up applications permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use speed up applications</h2>\n<p>For python's slow speed, some projects have been taken to decrease runtime. Pypy and Numba two of them. In most of the programming contests, you will see pypy if it allows python. These applications will reduce the runtime of your programme.</p>\n<h2 id=\"use-special-libraries-to-process-large-datasets\" style=\"position:relative;\"><a href=\"#use-special-libraries-to-process-large-datasets\" aria-label=\"use special libraries to process large datasets permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use special libraries to process large datasets</h2>\n<p>C/C++ is faster than python. So, many packages and modules have been written in C/C++ that you can use in your python programme. <code>Numpy</code>, <code>Scipy</code> and <code>Pandas</code> are three of them and are popular for processing large datasets.</p>\n<h2 id=\"use-the-latest-release-of-python\" style=\"position:relative;\"><a href=\"#use-the-latest-release-of-python\" aria-label=\"use the latest release of python permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use the latest release of python</h2>\n<p>Python is updated and upgraded regularly, and every release is faster and more optimized. So always use the latest version of python.</p>\n<p>These were some of the tips to decrease the runtime of python code. There are a few more techniques that you can use. Use a search engine to find those and write efficient code!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n</style>","frontmatter":{"date":"October 15, 2020","updated_date":null,"description":"Learn a few ways to speed up your python code.","title":"Speed Up Python Code","tags":["Python","Performance"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/65558b9da57861b919205b297c81828b/58556/speed-up-python-code-1.webp","srcSet":"/static/65558b9da57861b919205b297c81828b/61e93/speed-up-python-code-1.webp 200w,\n/static/65558b9da57861b919205b297c81828b/1f5c5/speed-up-python-code-1.webp 400w,\n/static/65558b9da57861b919205b297c81828b/58556/speed-up-python-code-1.webp 800w,\n/static/65558b9da57861b919205b297c81828b/99238/speed-up-python-code-1.webp 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Md. Tahmid Hossain","github":"tahmid02016","avatar":null}}}}]},"markdownRemark":{"excerpt":"Identity is evolving, and developers are at the forefront of this transformation. Every day brings a new learning—adapting to new standards…","fields":{"slug":"/identity/developer-first-identity-provider-loginradius/"},"html":"<p>Identity is evolving, and developers are at the forefront of this transformation. Every day brings a new learning—adapting to new standards and refining approaches to building secure, seamless experiences.</p>\n<p>We’re here to support developers on that journey. We know how important simplicity, efficiency, and well-structured documentation are when working with identity and access management solutions. That’s why we’ve redesigned the <a href=\"https://www.loginradius.com/\">LoginRadius website</a>—to be faster, more intuitive, and developer-first in every way.</p>\n<p>The goal? Having them spend less time searching and more time building.</p>\n<h2 id=\"whats-new-and-improved-on-the-loginradius-website\" style=\"position:relative;\"><a href=\"#whats-new-and-improved-on-the-loginradius-website\" aria-label=\"whats new and improved on the loginradius website permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What’s New and Improved on the LoginRadius Website?</h2>\n<p>LoginRadius’ vision is to give developers a product that simplifies identity management so they can focus on building, deploying, and scaling their applications. To enhance this experience, we’ve spent the last few months redesigning our interface— making navigation more intuitive and reassuring that essential resources are easily accessible.</p>\n<p>Here’s a closer look at what’s new and why it’s important:</p>\n<h3 id=\"a-developer-friendly-dark-theme\" style=\"position:relative;\"><a href=\"#a-developer-friendly-dark-theme\" aria-label=\"a developer friendly dark theme permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>A Developer-Friendly Dark Theme</h3>\n<p><img src=\"/f46881583c7518a93bb24e94c32320de/a-developer-friendly-dark-theme.webp\" alt=\"This image shows how LoginRadius offers several authentication methods like traditional login, social login, passwordless login, passkeys and more in a dark mode.\">    </p>\n<p>Developers spend long hours working in dark-themed IDEs and terminals, so we’ve designed the LoginRadius experience to be developer-friendly and align with that preference.</p>\n<p>The new dark mode reduces eye strain, enhances readability, and provides a seamless transition between a coding environment and our platform. Our new design features a clean, modern aesthetic with a consistent color scheme and Barlow typography, ensuring better readability. High-quality graphics and icons are thoughtfully placed to enhance the content without adding visual clutter.</p>\n<p>So, whether you’re navigating our API docs or configuring authentication into your system, our improved interface will make those extended development hours more comfortable and efficient.</p>\n<h3 id=\"clear-categorization-for-loginradius-capabilities\" style=\"position:relative;\"><a href=\"#clear-categorization-for-loginradius-capabilities\" aria-label=\"clear categorization for loginradius capabilities permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Clear Categorization for LoginRadius Capabilities</h3>\n<p><img src=\"/e5358b82be414940f3fb146013845933/capabilities.webp\" alt=\"This image shows a breakdown of all the LoginRadius CIAM capabilities, including authentication, security, UX, scalability and multi-brand management.\"></p>\n<p>We’ve restructured our website to provide a straightforward breakdown of our customer identity and access management platform capabilities, helping you quickly find what you need:</p>\n<ul>\n<li>Authentication: Easily understand <a href=\"https://www.loginradius.com/blog/identity/authentication-option-for-your-product/\">how to choose the right login method</a>, from traditional passwords and OTPs to social login, federated SSO, and passkeys with few lines of code.</li>\n<li>Security: Implement no-code security features like bot detection, IP throttling, breached password alerts, DDoS protection, and adaptive MFA to safeguard user accounts.</li>\n<li>User Experience: Leverage AI builder, hosted pages, and drag-and-drop workflows to create smooth, branded sign-up and login experiences.</li>\n<li>High Performance &#x26; Scalability: Confidently scale with sub-100ms API response times, 100% uptime, 240K+ RPS, and 28+ global data center regions.</li>\n<li>Multi-Brand Management: Efficiently manage multiple identity apps, choosing isolated or shared data stores based on your brand’s unique needs.</li>\n</ul>\n<p>This structured layout ensures you can quickly understand each capability and how it integrates into your identity ecosystem.</p>\n<h3 id=\"developer-first-navigation\" style=\"position:relative;\"><a href=\"#developer-first-navigation\" aria-label=\"developer first navigation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Developer-First Navigation</h3>\n<p><img src=\"/a8c155c2b6faf3d5f4b4de4e2b14d763/developers-menu.webp\" alt=\"This image shows the LoginRadius menu bar, highlighting the developer dropdown.\">   </p>\n<p>We’ve been analyzing developer workflows to identify how you access key resources. That’s why we redesigned our navigation with one goal in mind: to reduce clicks and make essential resources readily available.</p>\n<p>The new LoginRadius structure puts APIs, SDKs, and integration guides right at the menu bar under the Developers dropdown so you can get started faster. Our Products, Solutions, and Customer Services are also clearly categorized, helping development teams quickly find the right tools and make informed decisions.</p>\n<h3 id=\"quick-understanding-of-integration-benefits\" style=\"position:relative;\"><a href=\"#quick-understanding-of-integration-benefits\" aria-label=\"quick understanding of integration benefits permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Quick Understanding of Integration Benefits</h3>\n<p><img src=\"/b2f9a964a2da0ea83e2f8596b833bba7/we-support-your-tech-stack.webp\" alt=\"This image shows a list of popular programming languages and frameworks offered by LoginRadius.\"></p>\n<p>Developers now have a clear view of the tech stack available with LoginRadius, designed to support diverse business needs.</p>\n<p>Our platform offers pre-built SDKs for Node.js, Python, Java, and more, making CIAM integration seamless across popular programming languages and frameworks.</p>\n<h2 id=\"over-to-you-now\" style=\"position:relative;\"><a href=\"#over-to-you-now\" aria-label=\"over to you now permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Over to You Now!</h2>\n<p>Check out our <a href=\"https://www.loginradius.com/\">revamped LoginRadius website</a> and see how the improved experience makes it easier to build, scale, and secure your applications.</p>\n<p>Do not forget to explore the improved navigation and API documentation, and get started with our free trial today. We’re excited to see what you’ll build with LoginRadius!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"date":"February 21, 2025","updated_date":null,"description":"LoginRadius’ vision is to give developers a product that simplifies identity management so they can focus on building, deploying, and scaling their applications. To enhance this experience, we’ve redesigned our website interface, making navigation more intuitive and reassuring that essential resources are easily accessible.","title":"Revamped & Ready: Introducing the New Developer-First LoginRadius Website","tags":["Developer tools","API","Identity Management","User Authentication"],"pinned":true,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.7857142857142858,"src":"/static/80b4e4fbe176a10a327d273504607f32/58556/hero-section.webp","srcSet":"/static/80b4e4fbe176a10a327d273504607f32/61e93/hero-section.webp 200w,\n/static/80b4e4fbe176a10a327d273504607f32/1f5c5/hero-section.webp 400w,\n/static/80b4e4fbe176a10a327d273504607f32/58556/hero-section.webp 800w,\n/static/80b4e4fbe176a10a327d273504607f32/99238/hero-section.webp 1200w,\n/static/80b4e4fbe176a10a327d273504607f32/7c22d/hero-section.webp 1600w,\n/static/80b4e4fbe176a10a327d273504607f32/1258b/hero-section.webp 2732w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Rakesh Soni","github":"oyesoni","avatar":"rakesh-soni.webp"}}}},"pageContext":{"limit":6,"skip":696,"currentPage":117,"type":"///","numPages":164,"pinned":"ee8a4479-3471-53b1-bf62-d0d8dc3faaeb"}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}