In this story, you will learn how to automatically generate documentation from Python modules with a bit of magic in our custom functions, the package
mkgendocs, pre-commit Git hooks, and MkDocs. We will touch upon the following elements
MkDocs is a static site generator for building project documentation and together with the Material framework, it simply looks gorgeous. First, we need to install a heap of packages in order to use all…
In this story, you will follow me along a journey to automatically generate Google-style docstrings from Python type-hints. We will be looking at the following elements.
Since Python 3.5+, we’ve seen the next generation of code documentation: hinting which variable’s types in function/class arguments and return statements. This enables formatters, linters, and IDE’s to provide runtime support for type-checking.
Do you dream of never having to worry about formatting your Python code? In this article, I will share with you how to automate clean coding principles.
Linting is the process of running a quality-control tool that performs a static analysis of source code to check for potential errors.
The style guide for Python is PEP-8. A popular linting tool that verifies adherence to the PEP-8 style guide is
flake8. It is pip-installable and can easily be run…
In this story, I will share what I use in my day-to-day work and what has helped me improve my code. Check the list below to see if there’s anything new for you!
[key]for dictionary iterations
Hallelujah! That is what I thought when I learned about the Python 3.6+ update that includes a new way of formatting strings: the Python formatted string literal. …
In this article, I’ll show you three scripting conventions and corresponding built-in modules to help better format your Python scripts. These modules are designed to adhere to the DRY (don’t repeat yourself) principle and are there to improve the quality of your code and scripts!
In short, we’ll go over the following three components:
logging()module instead of
ifmain refers to the last lines of code in a Python script that you often see:
if __name__ == "__main__":. When…
What happens when a user sends a request, but processing that request takes longer than the HTTP request-response cycle? What if you’re accessing multiple databases or want to return a document too large to process within the time window? What if you want to access an API, but the number of requests is throttled to a maximum of n requests per t time window?
These are part of the questions that were raised during the data collection process for my master’s thesis. For my research, microposts from Twitter were scraped via the Twitter API. …
We’ll cover the basics for creating and loading JSON files, file storage, and newline delimited JSON storage and take a look into a more specific use-case of working with textual data and JSON.
JSON is widely used in web applications as the preferred way to interchange data, especially to and from front-end to back-end middleware.
In this story, we’ll explore the Inter-Annotator Agreement (IAA), a measure of how well multiple annotators can make the same annotation decision for a certain category. Supervised Natural Language Processing algorithms use a labeled dataset, that is often annotated by humans. An example would be the annotation scheme for my master’s thesis, where tweets were labeled as either abusive or non-abusive.
IAA shows you how clear your annotation guidelines are, how uniformly your annotators understood it, and how reproducible the annotation task is. It is a vital part of both the validation and reproducibility of classification results.
Accuracy and F1…
I had learned the hard way that functional parts, such as database operations, log-ins, or registrations break without you noticing. Your users, however, will notice. Testing is a vital part of the production process of and in this story, we’ll briefly introduce how to test your Django application.
This story covers: