<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Python &#8211; Sumanas Tech</title>
	<atom:link href="https://www.sumanastech.com/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sumanastech.com</link>
	<description></description>
	<lastBuildDate>Sat, 08 Dec 2018 09:08:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.sumanastech.com/wp-content/uploads/2025/03/sumanas-logo-square.png</url>
	<title>Python &#8211; Sumanas Tech</title>
	<link>https://www.sumanastech.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Enhance your Python and Django Code Performance with these Ideal Tips</title>
		<link>https://www.sumanastech.com/enhance-your-python-and-django-code-performance-with-these-ideal-tips/</link>
					<comments>https://www.sumanastech.com/enhance-your-python-and-django-code-performance-with-these-ideal-tips/#respond</comments>
		
		<dc:creator><![CDATA[sumanasweb]]></dc:creator>
		<pubDate>Sat, 08 Dec 2018 09:08:28 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://www.sumanastech.com/?p=1309</guid>

					<description><![CDATA[We are in the world of App Development, where performance optimization has become a never-ending task. But for truth, we need to accept them as well. Moreover, Python and Django have become the most preferred framework and languages in recent years. Here we have attached a quick recap of how you need to optimize your [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span style="font-weight: 400;">We are in the world of App Development, where performance optimization has become a never-ending task. But for truth, we need to accept them as well. </span></p>
<p><span style="font-weight: 400;">Moreover, Python and Django have become the most preferred framework and languages in recent years.</span></p>
<p><span style="font-weight: 400;">Here we have attached a quick recap of how you need to optimize your python and Django code for a high-end performance!</span></p>
<p><b>Database Optimization</b></p>
<p><span style="font-weight: 400;">There are a few things which you need to focus on if you need a high performance from your database. Within the SQL servers, you need to have an eye on:</span></p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Database triggers </span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Stored views</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Functions and</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Stored procedures.</span></li>
</ul>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-1312" src="https://sumanastech.com/wp-content/uploads/2018/12/11-2.jpg" alt="Database Optimization - Sumanastech" width="700" height="350" srcset="https://www.sumanastech.com/wp-content/uploads/2018/12/11-2.jpg 700w, https://www.sumanastech.com/wp-content/uploads/2018/12/11-2-300x150.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p><span style="font-weight: 400;">In order to avoid creating requests for each time, the app needs to address the database. </span></p>
<p><b>Code Optimization</b></p>
<p><span style="font-weight: 400;">In the python code, if you need to find out which part of your code needs to be optimized, you need to make use of certain tools. The profiling module will allow you to check the performance of your code and function.</span></p>
<p><span style="font-weight: 400;">There are a lot of Python profilers you can pick from (like cProfile or line_profiler), and also some additional tools you may want to leverage later on for visualising the results (like SnakeViz or KCachegrind).</span></p>
<p><img decoding="async" class="alignnone size-full wp-image-1310" src="https://sumanastech.com/wp-content/uploads/2018/12/22-2.jpg" alt="Code Optimization - Sumanastech" width="700" height="350" srcset="https://www.sumanastech.com/wp-content/uploads/2018/12/22-2.jpg 700w, https://www.sumanastech.com/wp-content/uploads/2018/12/22-2-300x150.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p><b>Cached Template Loading</b></p>
<p><span style="font-weight: 400;">Here is an important point where you need to enable the Django’s cached template loader. The major reason behind is that it will allow you to store the template content in memory which means that you can avoid searching for a match in the file system every time the template is requested. </span></p>
<p><span style="font-weight: 400;">Added, you should also have in mind that all static content should be served by an HTTP cache server.</span></p>
<p><img decoding="async" class="alignnone size-full wp-image-1311" src="https://www.sumanastech.com/wp-content/uploads/2018/12/33-1.jpg" alt="Cached Template Loading - Sumanastech" width="700" height="350" srcset="https://www.sumanastech.com/wp-content/uploads/2018/12/33-1.jpg 700w, https://www.sumanastech.com/wp-content/uploads/2018/12/33-1-300x150.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p><b>Cached Sessions</b></p>
<p><span style="font-weight: 400;">You need to optimize Django sessions to process everything faster. Instead of storing users sessions in a slow database, which is the default mode in Django, you could go for storing the data in the memory.</span></p>
<p><b>Newer Versions of Python/Django</b></p>
<p><span style="font-weight: 400;">Although this is not a fully guaranteed method, every release comes up with a new feature and making the framework or the programming to work really well and efficient. You need to try the latest available Python package or Django release, but never forget not to base your expectations on the above assumption. Each case is distinct, so measure and test rather than guess. And remember, you should proceed with brand-new versions only if you already have a pretty well-optimized Python/Django app.</span></p>
<p><b>To Close</b></p>
<p><span style="font-weight: 400;">If you are struggling to optimize your code particularly in Python and Django this would have definitely helped you! There are a lot more ways available but in order to make it simple, we have given the simple ways!</span></p>
<p><span style="font-weight: 400;">Hope this helps!</span></p>
<p><span style="font-weight: 400;">Thanks for reading!</span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sumanastech.com/enhance-your-python-and-django-code-performance-with-these-ideal-tips/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Boost your code using these 7 Python Libraries!</title>
		<link>https://www.sumanastech.com/boost-your-code-using-these-7-python-libraries/</link>
					<comments>https://www.sumanastech.com/boost-your-code-using-these-7-python-libraries/#respond</comments>
		
		<dc:creator><![CDATA[sumanasweb]]></dc:creator>
		<pubDate>Fri, 30 Nov 2018 07:08:51 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[7]]></category>
		<category><![CDATA[Boost]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Libraries]]></category>
		<guid isPermaLink="false">https://www.sumanastech.com/?p=1284</guid>

					<description><![CDATA[Nowadays most of the organizations as well as applications come up with maintainable Python codes. But anyways codes need to be maintaining a consistent style and testing standards. Since this is going to be the essential part of decreasing the maintenance burden, ensuring that future developers are able to quickly grok what&#8217;s happening in a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span style="font-weight: 400;">Nowadays most of the organizations as well as applications come up with maintainable Python codes. But anyways codes need to be maintaining a consistent style and testing standards. Since this is going to be the essential part of decreasing the maintenance burden, ensuring that future developers are able to quickly grok what&#8217;s happening in a new-to-them project and securing the health of the app over time.</span></p>
<p><span style="font-weight: 400;">One of the best ways to safeguard your future maintainability of a project is to use external libraries to check your code health for you. These are a few of libraries for linting code, enforcing a consistent style, and ensuring acceptable test coverage as a project reaches maturity. </span></p>
<p><b>Coding Style makes a great impact!</b></p>
<p><span style="font-weight: 400;">PEP 8 is a Python code style guide, and it helps with things like line length, indentation, multi-line expressions, and naming conventions. The major objective of any code style guide is to reinforce consistent standards across a codebase to make it more readable, and thus more maintainable. Here are three libraries to further prettify your code.</span></p>
<ul>
<li><b>Pylint</b></li>
</ul>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1286" src="https://www.sumanastech.com/wp-content/uploads/2018/11/11-3.jpg" alt="Pylint - Sumanastech" width="700" height="350" srcset="https://www.sumanastech.com/wp-content/uploads/2018/11/11-3.jpg 700w, https://www.sumanastech.com/wp-content/uploads/2018/11/11-3-300x150.jpg 300w" sizes="auto, (max-width: 700px) 100vw, 700px" /></p>
<p><span style="font-weight: 400;">Pylint is one of the Python libraries which checks for common errors similar to PEP 8 style. This app integrates with most of the modest editors and IDE’s. Moreover, it can also run through the Command line.</span></p>
<p><span style="font-weight: 400;">You can install by using the command, run </span><b>pip install pylint</b><span style="font-weight: 400;">.</span></p>
<p><span style="font-weight: 400;">If you need to use Pylint with Command line, follow run pylint [options] path/to/dir or pylint [options] path/to/module.py. Pylint will output warnings on style violations and other errors to the console.</span></p>
<p><span style="font-weight: 400;">You can use pylintrc to configure your errors with the inbuilt configuration file.</span></p>
<ul>
<li><b>Flake 8</b></li>
</ul>
<p><span style="font-weight: 400;">Flake 8 is a Python tool which brings together  PEP8, Pyflakes (which is similar to Pylint), McCabe (code complexity checker), and third-party plugins to check the style and quality of some Python code.</span></p>
<p><span style="font-weight: 400;">To make use of Flake8, run </span><b>pip install flake8.</b><span style="font-weight: 400;">  Then run</span><b> flake8 [options] path/to/dir or flake8 [options] path/to/module.py</b><span style="font-weight: 400;"> to view the errors and warnings.</span></p>
<p><span style="font-weight: 400;">Similar to Pylint, Flake8 too permits customization using the configuration file. It comes up with a clear docs, which also includes some useful commit hooks to automatically check your code as part of your development workflow.</span></p>
<p><span style="font-weight: 400;">In addition to Pylint, Flake also integrates with all types of Editors and IDE’s out there. In order to integrate Flake with your favourite editor, you can search for plugins online.</span></p>
<ul>
<li><b>Isort</b></li>
</ul>
<p><span style="font-weight: 400;">Isort is a library which sorts alphabetically and breaks them into various sections. For example, standard library imports, third-party library imports, imports from your own project, etc. This, in turn, increases the readability and makes it simpler to locate imports if you have a lot of them in your module.</span></p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1285" src="https://sumanastech.com/wp-content/uploads/2018/11/22-1.jpg" alt="Isort - Sumanastech" width="700" height="350" srcset="https://www.sumanastech.com/wp-content/uploads/2018/11/22-1.jpg 700w, https://www.sumanastech.com/wp-content/uploads/2018/11/22-1-300x150.jpg 300w" sizes="auto, (max-width: 700px) 100vw, 700px" /></p>
<p><span style="font-weight: 400;">To install Isort, use the command </span><b>pip install isort</b><span style="font-weight: 400;">, and run it with</span><b> isort path/to/module.py.</b><span style="font-weight: 400;"> You can find a list of options in Documentation. Consider, you need to configure how isort handles multi-line imports from one library using the command .isort.cfg file.</span></p>
<p><b>Outsource your code</b></p>
<p><span style="font-weight: 400;">Here are three libraries which reformat your code into something that passes PEP 8 for you. The following libraries have different levels of customization and different defaults for how they format code. While, some of these are more opinionated than others, as like with Pylint and Flake8, you will want to test these out to see which offers the customizations.</span></p>
<ul>
<li><b>Auto Pep 8</b></li>
</ul>
<p><span style="font-weight: 400;">Auto Pep 8 formats the module in the format which you specify. It will help you in re-indenting lines, fix indentation, remove extraneous whitespace, and refactor common comparison mistakes. You can go through the corrections in the documentation.</span></p>
<p><span style="font-weight: 400;">To install Auto pep 8,  run </span><b>pip install &#8211;upgrade autopep8.</b><span style="font-weight: 400;"> To reformat your code in place, run </span><b>autopep8 &#8211;in-place &#8211;aggressive &#8211;aggressive &lt;filename&gt;.</b><span style="font-weight: 400;"> The aggressive flags (and the number of them) indicate how much control you need to give autopep8 over your code style. </span></p>
<ul>
<li><b>Yapf</b></li>
</ul>
<p><span style="font-weight: 400;"> This is yet another optional library meant for formatting the code which comes with the list of Configuration options. The major difference between yapf and Auto Pep is that Yapf doesn&#8217;t just address PEP 8 violations. Added, it also reformats the code which does not violate PEP 8 specifically but isn&#8217;t styled consistently or could be formatted properly for readability.</span></p>
<p><span style="font-weight: 400;">Install Yapf using the command </span><b>pip install yapf</b><span style="font-weight: 400;">. To reformat your code, run, </span><b>yapf [options] path/to/dir or yapf [options] path/to/module.py.</b></p>
<ul>
<li><b>Black</b></li>
</ul>
<p><span style="font-weight: 400;">Black is one of the python libraries which allows the block for linters that reformat code in place. It is similar to autopep8 and Yapf, but way more opinionated. It has very few options for customization. The point is that you shouldn&#8217;t have to make decisions about code style. </span></p>
<p><span style="font-weight: 400;">Black is a new library which requires Python 3.6+ but can format Python 2 code. To use, run </span><b>pip install black</b><span style="font-weight: 400;">. To modify your code, run: </span><b>black path/to/dir or black path/to/module.py.</b></p>
<p><b>Check your test coverage</b></p>
<p><span style="font-weight: 400;">In order to test your coverage, there is a python library called Coverage.</span></p>
<ul>
<li><b>Coverage</b></li>
</ul>
<p><span style="font-weight: 400;">Coverage comes up with several options as a way it reports the coverage to the user which includes outputting results to the console or to an HTML page and indicating which line numbers are missing test coverage. </span></p>
<p><span style="font-weight: 400;">To install, run </span><b>pip install coverage</b><span style="font-weight: 400;">. To run a program and view its output, run coverage run </span><b>[path/to/module.py] [args]</b><span style="font-weight: 400;">, and you will see your program&#8217;s output. To view the report of which lines of code are missing coverage, run </span><b>coverage report -m.</b></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sumanastech.com/boost-your-code-using-these-7-python-libraries/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
