Sign in

Python Developer, AWS certified solutions architect associate | CSM | Django | Flask | www.linkedin.com/in/dineshkumarkb

Resolve file not found errors in pyinstaller

Photo by Maksym Kaharlytskyi on Unsplash

Note: For non-members, this article is also available at https://dineshkumarkb.com/tech/package-data-files-to-pyinstaller-binaries/

I am sure most of you would have used pyinstaller for generating executables. This article does not cover what a pyinstaller is. However, the focus of the article will be on how to add external data files to your pyinstaller binaries and their use cases.

Usually, we generate a one file executable in pyinstaller using the following command.

$pyinstaller --onefile --clean <file_name.py>

Let’s say you have a help file for your application which needs to be packed along with your executable. …


Know the vulnerabilities in your code

Photo by Liam Tucker on Unsplash

Note: For non-members, this article is also available at https://dineshkumarkb.com/tech/meet-ochrona-an-application-to-validate-your-dependencies/

Security in your code is considered to be of paramount importance today, especially when we work remotely. We do a lot of proof-of-concepts, implement business logic with multiple libraries. Though most of them are open source, there could be vulnerabilities, license issues when we productize the code for commercial use. It is almost impossible to keep an eye on every single library and their possibility for commercial use. That’s why we have vulnerability scanners to make lives easier.

Ochrona security provides solution for validating dependencies of your python project.

Ochrona…


Dump the plain text help in your command line interfaces today

Photo by Brett Jordan on Unsplash

Note: For non-members, this article is also available at https://dineshkumarkb.com/tech/display-markdown-text-in-command-line-using-python/

Recently, I was given a task of refactoring our legacy command line application. I was thinking what more could we do to improvise a legacy command line application that’s working just fine.

Remembering the commands and their respective flags, optional parameters etc is bit hectic. Of course you could copy all the commands in a notepad and use ’em as needed. But that’s still annoying if you ask me.

So what did I do?

I came across this library called PyInquirer and rich with which we could make colorful command…


Build rich command lines using rich

https://www.pexels.com/photo/blur-bright-business-codes-207580/

Note: For non-members, this article is also available at https://dineshkumarkb.com/tech/build-command-line-applications-in-python-using-rich/

Do you want to get over the regular monochrome command line? Interested in building visually appealing clis? …Or want to showcase your cli with cool enhancements? If you have any of these on your mind, then you should definitely try using python’s rich library.

Rich works on OSX, linux and windows platforms

Python:

≥ Python 3.6.1

pip install rich

Rich is a Python library for writing rich text (with color and style) to the terminal, and for displaying advanced content such as tables, markdown, and syntax highlighted code.

Without further…


DataStructures & Algorithms in Python

image source: dineshkumarkb

Note: For non-members, story is available here .

Introduction:

This article explains how to delete the nth node of a linked list from the end provided the head of the linked list. This is similar to getting the nth node from the end of the linked list. This is one of the problems in .

  1. Create a Linked List.
  2. Get the nth node from the end of the linked list.
  3. Delete the nth node from the end of the linked list.

Create a linked list

We will create a linked list and insert nodes at the head. If you wish to insert the elements from…


Python Interview question: Get the nth node from the end of a linked list

Introduction

This article explains how to get the nth node of a linked list from the end provided the head of the linked list. So why from the end and not the head? Finding the nth node from the beginning is pretty straightforward.Isn’t it? This could be asked in interviews and this is also available in cracking the coding interview.

So, Let’s cut to the chase.

  1. Create a Linked List
  2. Get the nth node of the linked list

Create a linked list

We will create a linked list and insert nodes at the head. …


Designpatterns in python — LoggerFactory

Note : For non-members, this story is available here.

Introduction:

Any code is readable only when it is written with proper comments. Do you agree?Having said that a developer’s task does not end with just writing code. The maintainability factor kicks in immediately after the code gets into production. Your code is maintainable if it answers the following questions.

  • Is your code scalable?
  • Is your code readable?
  • Is your code debuggable?

For obvious reasons, the author of the code shouldn’t answer these questions. Your peer should answer them for you. Or if you don’t wanna be your own judge the best…


How to implement a sliding window using python

Photo by Daniel Alentà on Unsplash

Introduction

This article describes how to implement a sliding window using python. A sliding window is a subset of a data structure at a given point of time. The window size decides the number of elements in the subset.

Sliding window:

Let’s take an example of a list with 8 elements as below.


Specify private repository dependencies in the requirements file in Python.

Note: This article was originally published on my personal blog

Introduction:

As a Pythonista, we all know where to specify our project dependencies. The requirements.txt file traditionally contains all the project dependencies. The specified libraries from this file will be installed from the PyPI repository.

A typical requirements.txt looks like this.

boto3
warrant-lite
requests
PyInquirer

When you say pip install -r requirements.txt, pip by default looks into the PyPI repository for the libraries mentioned in requirements.txt.

So now comes the question.

What if you want to install a library that is hosted on a repository other than PyPI. This could be…

Dinesh Kumar K B

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store