While reading top-shelf Python books, you probably might have bumped into the sentence "be pythonic". But what exactly does it mean and how to use it in real life examples? This article presents some practical cases where pythonic approach should be used and shows you some code snippets, where this approach was implemented.
Machine learning is widely and successfully used nowadays. We think that computers know, but actually, they do not know - they compute. All they do is just operating on numbers. We teach them how to know by telling them what to compute.
In today buzzword-oriented world, you don’t spend all of your precious time following all of the latest technologies. When creating APIs, you rarely think twice - obviously REST is your best friend. But have you ever heard about companies like Google or Dropbox? I bet you did. They’ve considered this problem in a different way. So did we, in our last project for a Berlin startup. We decided to use gRPC instead of REST and I would like to tell you why.
Python has many powerful and useful constructs. Depending on their design, they help us to write code safer, more readable, often faster and with lower memory usage. This article covers Iterables and Iterators, Generators, Context Managers, Comprehensions and Decorators and explains their usage and usability.
Grafana is a data visualization and monitoring tool allowing you to show metrics stored for example in InfluxDB as charts. It gives you possibility to create dashboards to link charts or histograms into connected groups. Thanks to built-in InfluxDB support it automatically handles provided aggregation functions. Query editor supports also tag or field completion.
Mocking is just pretending to be and simulating specific behavior, we can replace our code’s parts with fake objects and verify how system behaves. At some point our system’s code starts to be complicated and have so many dependencies what makes it impossible to test without mocks. To cover all corner cases or to freely control our test scenario flow we have to simulate part of functionality – we have to force it to behave in exact way we want. For this purpose python uses unitest.mock library which is a standard library starting from Python 3.3 (for older versions installation is required).
JMeter is an open-source JAVA-based load testing tool for measuring and analyzing performance of services and applications. It simulates user behavior by sending requests to server. It can be used for testing variety of protocols and services like HTTP, HTTPS, SOAP / REST Webservices, FTP, JDBC, LDAP, SMTP, POP3, IMAP and many others.
InfluxDB it is a database oriented on time series. It was designed to accept large number of queries and write requests. It is perfect for storing timestamped data – data we would like to query by timestamp rather than index. It supports SQL-like language to easily pull data off as well as JSON requests through HTTP API. Influx uses tags and fields - tags to easily index series of data (you can query by it after where clause) and fields for keeping values (select field_1, field_2 from … )
In my professional career I used to write tests with both frameworks: unittest and pytest. Both are great tools with certain pros and cons, but pytest is significantly more popular these days. In this short blogpost I am going to share with you a couple of pytest’s features, that in my opinion, provide the answer for the heading question.