Home / Companies / Pybites / Blog / June 2017

June 2017 Summaries

19 posts from Pybites

Filter
Month: Year:
Post Summaries Back to Blog
A Python coding challenge encourages developers to create a notification service for movies or TV shows, focusing on current and upcoming releases. The challenge offers varying levels of complexity, starting with a basic task of using resources like Fandango or IMDb to track movie releases and notify users, potentially via email or a bot. Intermediate tasks involve adding command line filters for customization, while the advanced level suggests developing a subscription-based web app with user-specific preferences. Participants are encouraged to utilize APIs such as The Movie DB or TheTVDB.com and to contribute their solutions via a Pull Request to the community branch, with featured reviews at the end of the week. The challenge emphasizes continuous learning and creativity without a single best solution, fostering a community of Python enthusiasts.
Jun 26, 2017 366 words in the original blog post.
The article reviews a recent code challenge focused on enriching a class using dunder (special) methods, reflecting on lessons learned, such as the proper implementation of the `__reversed__` method to reverse normal iteration order. Although there were no additional pull request submissions, the authors shared their experience creating a Developer class for a Karma Bot, noting that it was implemented without dunder methods, highlighting that these methods, while powerful, should be used judiciously to avoid making code difficult to understand. The article ends with an invitation to participate in the next coding challenge, which involves creating a weekly digest email for movies or series, emphasizing that there are no deadlines and participants can join at any time.
Jun 26, 2017 282 words in the original blog post.
Karma Bot is a custom Slack bot created as a personal learning project that enhances Slack interactions by allowing users to easily give or deduct karma points from each other using specific commands. Developed using Slack’s Real Time Messaging API, the bot processes karma changes by parsing messages with regex to identify actions, converting user IDs to usernames, and updating karma scores, which are stored using Python's Counter object and serialized with pickle for persistence. The bot is designed to remain operational even after crashes by using a run.sh wrapper to respawn it, and although initially built as a monolithic script, it was later refactored into modular components for better organization, with plans to open-source the project in the future.
Jun 25, 2017 732 words in the original blog post.
The text is a compilation of tweets highlighting various Python-related tools, tutorials, and resources shared by different users and organizations. It includes links to articles and guides on topics such as Python plotting for exploratory analysis, the Peewee object-relational mapper, generating audio signals, and dunder methods for making classes more Pythonic. Other mentions include authorship attribution with scikit-learn, socket-based network servers, a comparison of Django versus Flask from a practitioner's perspective, and Python variable assignment explanations. Additionally, there are resources for building an IoT Grow-box with Raspberry Pi, static type checking in Python 3.6, the new location for the Python development guide, the launch of the Dash framework for creating reactive web apps, an introduction to geospatial data, and a gradient-free optimization framework called Solid. The tweets also promote cheat sheets for machine learning and deep learning, and a post about creating a Pokémon app on Code Studio.
Jun 25, 2017 352 words in the original blog post.
Pendulum is a Python package designed to simplify the manipulation of datetime objects, offering an intuitive alternative to Python's built-in datetime module. It allows for straightforward creation and formatting of dates and times, making it easier to perform operations such as getting the current, past, or future date, and specifying time zones. The package offers user-friendly functions like `.now()`, `.today()`, `.tomorrow()`, and `.yesterday()`, which enhance readability and usability. Pendulum also features advanced capabilities for date comparisons, calculations, and timezone conversions, allowing users to add or subtract time units with ease. Its array of formatting options eliminates the need for complex strftime formatting, providing a more accessible and efficient approach to handling datetime operations. The author appreciates Pendulum for its clarity and thanks its creator, Sébastien Eustace, for developing such a valuable tool for Python users.
Jun 24, 2017 434 words in the original blog post.
In a Python coding challenge post, the authors introduce the concept of dunder methods, which are predefined methods in Python that start and end with double underscores, such as __init__ or __str__, and enhance class functionalities through features like sequences, iteration, and operator overloading. The challenge encourages participants to enrich their Python classes by implementing dunder methods for basic tasks such as construction and object representation, and suggests more advanced tasks like operator overloading and context management for those seeking a greater challenge. The post also provides guidance on forking the challenges repository and submitting code via a Pull Request for community review, emphasizing that the goal is to learn and improve Python skills rather than finding a single "best" solution.
Jun 20, 2017 366 words in the original blog post.
The article details the implementation of a challenge using GitHub's platform and API, highlighting the use of GitHub's PR template to streamline the process of gathering data from participants. The authors utilized the PyGithub package to interact with the API, parsing submissions to gather metrics without relying on PR titles, instead extracting information from file paths. A defaultdict is used to store user responses per challenge number, allowing for easy aggregation of data. The article also discusses a community-contributed project called PyTrack, a time-tracking tool for Python projects that uses a SQLite database for storing logs and incorporates libraries like click, maya, and peewee. The authors express appreciation for community contributions and encourage participation in coding challenges, emphasizing the growth and collaboration within the PyBites community.
Jun 18, 2017 625 words in the original blog post.
A series of tweets and retweets from various Python-related accounts highlights a range of topics and resources for developers, including the release of Python 3.6.2 RC1, tutorials on working with time in PostgreSQL, converting JSON data in Python, and building microservices with Docker, Flask, and React. Other topics include coding education through gamified platforms, Instagram's transition to Python 3, and an invitation to join NASA's Datanauts program. The tweets also promote resources on creating REST APIs, overlaying charts in Python, generating placeholder data with Faker, and performing exploratory data analysis. Additionally, there are discussions related to writing effective README files for GitHub projects and using Python, Flask, and Twilio for sending birth announcements, showcasing the vibrant and collaborative nature of the Python community.
Jun 18, 2017 371 words in the original blog post.
The article explores the concept of Python subclasses and inheritance, building upon previous discussions on Python classes. It uses the analogy of vehicles to explain how subclasses work, illustrating that a subclass like "Car" can inherit attributes from a parent class like "Vehicle." The text provides a practical example with a "Boss" class in a game setting, where different types of bosses, such as "GoodBoss" and "BadBoss," are subclasses that inherit characteristics from the main "Boss" class. The article highlights how these subclasses can have unique methods, such as nurturing talent or encouraging employees, demonstrating inheritance in action. Through these examples, the article emphasizes the usefulness of classes and subclasses in organizing and planning code effectively and acknowledges their widespread application in complex systems like video games. It concludes by offering a template for creating classes and subclasses, encouraging readers to explore the potential of these programming constructs.
Jun 17, 2017 1,101 words in the original blog post.
Bob from PyBites created a script called "whotweeted" to determine whether he or Julian tweeted from their shared Twitter account by parsing tweet location data using the Tweepy library. This script evolved into a learning exercise on how to unittest an API. Bob implemented a caching decorator to store API outputs and used the `unittest.mock` library to patch and mock the Tweepy API calls, allowing for effective testing without repeatedly hitting the live API, thus avoiding potential rate limits and reducing test execution time. The script raises exceptions for invalid input data, enhancing its robustness. Bob plans to explore mocking further in future articles, emphasizing the educational value of extending simple exercises into more complex explorations in coding.
Jun 17, 2017 485 words in the original blog post.
The latest Python coding challenge invites participants to enhance the challenge platform by developing a simple API to track the time taken to complete coding challenges, potentially including other metadata like difficulty level and ratings. This initiative arose from participant feedback requesting more insight into the time required for challenges, similar to suggested reading times in articles, to help them improve coding efficiency. The task is divided into three levels of complexity: creating a basic API for tracking time, adding features for storing additional challenge attributes, and integrating authentication with the GitHub API for data validation. Participants are free to use any tools, such as Flask or Django, and are encouraged to explore additional functionalities like a dedicated Slack channel for metadata entry. The best solutions will be featured in the weekly review and on the challenges page, contributing to the platform's evolution by offering more informative insights to its users.
Jun 13, 2017 679 words in the original blog post.
The article details a project undertaken to address the challenge of downloading free ebooks from Packt, which included creating a notification service and an ebook download manager. The authors initially faced difficulties with automating the process due to a captcha requirement but devised solutions such as a daily notification email for the free ebook and a script to manage downloaded ebooks using requests session and BeautifulSoup for login and parsing. They also implemented a PacktScraper, contributed by a community member, that scrapes the site and offers email and tweet notifications. The project reflects a collaborative effort within the PyBites community, encouraging participation and contribution to their open-source challenges.
Jun 12, 2017 733 words in the original blog post.
A collection of tweets from various Python enthusiasts and experts highlights a variety of topics and resources related to Python programming. These include tutorials on generating mock data, free access to Python programming books, guidance on exploratory data analysis, and tips for using Python's plain old data objects effectively. Other tweets discuss the porting of sentiment analysis tools from Python to C#, advice for teaching Python, comparisons between Python and R in machine learning, and practical command line tips. Additionally, there are resources on building APIs with Django, creating static sites with Pelican and Jinja2, and features of Python 3, including the fast asyncio server Uvicorn. The tweets reflect a vibrant community sharing educational content, tools, and opinions on the learning process and programming humor.
Jun 11, 2017 336 words in the original blog post.
Accessing web pages behind a login can be achieved using the Python requests module by automating the process of entering credentials, a task that requires some HTML knowledge. The author demonstrates this by explaining how to log into freecycle.org, which involves inspecting the HTML form on the login page to identify the necessary POST method and input fields for username and password. By noting the action URL and input field names, users can create a script that uses requests to POST login details and subsequently GET data from the desired page. The process is detailed with an example Python script, emphasizing the importance of preparation and HTML exploration, and concludes by noting that while this method works for simple text login systems, handling CAPTCHAs remains a challenge.
Jun 09, 2017 938 words in the original blog post.
The author reflects on their experience parsing HTML tables for an Electricity Cost Calculation App challenge, initially using BeautifulSoup and regex, which proved cumbersome, before discovering the more efficient Pandas library. While BeautifulSoup was helpful, it still required significant effort, leading the author to explore Pandas' read_html() function, which simplified the process of extracting tabular data from HTML pages. Although Pandas provided a more extensible framework with its DataFrame capabilities, allowing for various data manipulations, the author still faced challenges with data conversion due to duplicated column names and necessary manual cleaning of values. The author emphasizes the importance of using specialized libraries to handle common tasks, while acknowledging the unavoidable aspect of manual data manipulation and cleaning. The narrative concludes with an invitation for readers to share their own data parsing stories or to propose a code challenge based on these experiences.
Jun 08, 2017 354 words in the original blog post.
The challenge invites Python enthusiasts to develop a web scraping script that automatically retrieves and shares information about Packt's daily free ebook offer, with the additional benefit of contributing to a Python-related charity through each ebook download. Participants are encouraged to use tools like Beautiful Soup or Scrapy for scraping tasks, and integrate their scripts with platforms for sharing, such as email or social media. For those seeking an extra challenge, automating the ebook claiming process by overcoming CAPTCHA is suggested. The initiative, in collaboration with Pybonacci, promotes community engagement and supports learning and enhancement of Python skills, with participants encouraged to share their solutions via a community repository for feedback and learning.
Jun 05, 2017 459 words in the original blog post.
This week's code challenge #21 saw diverse and creative submissions from participants, who utilized various technologies to deliver unique solutions. Four pull requests (PRs) were merged into the Community branch, showcasing the versatility of the participants: Martin developed an iPhone app using Pythonista 3, Dante crafted a Flask app named wattapp with features like energy consumption history, and Wonderfulboyx created a Django energy app that allows users to add devices and calculate energy usage. Additionally, the PyBites team contributed a command-line interface app that processes real-world energy data, revealing insights such as the high cost of energy in Spain. The organizers expressed gratitude and encouragement to participants for their efforts, emphasizing the ongoing nature of the challenge, and inviting coders to continue contributing by following the submission guidelines.
Jun 05, 2017 319 words in the original blog post.
The text is a compilation of tweets from various Python-related accounts, highlighting a range of resources, tips, and updates for Python enthusiasts. These include tutorials on Python package management, video processing, and algorithmic trading, as well as recommendations for Python libraries in data science and podcasts. It also features practical tips like using Python's CLI tool for pretty-printing JSON text, fixing certificate failures on Mac OS, and handling file paths with the pathlib module. Additionally, it includes links to interviews, programming puzzles, and a conference video archive, reflecting a vibrant community sharing knowledge and insights about Python programming.
Jun 04, 2017 321 words in the original blog post.
Flask Session Objects are special variables that persist for the duration of a browser session connected to a Flask app, allowing data to be accessible across different web pages without requiring repeated user input. These objects are similar to cookies but include a secret key for added security, although the data remains visible. They are particularly useful for applications requiring temporary data storage, such as a pay calculator app where a user’s hourly wage can be stored in a session and accessed by different web pages within the app. The implementation is straightforward, as session objects function like regular variables in code, following standard global and local variable rules. They offer versatile use cases, including personalizing user experiences, maintaining to-do lists, or managing online orders, by retaining data only for the session's duration. While the concept is simple, implementing session objects may require some experimentation to ensure code functionality.
Jun 02, 2017 887 words in the original blog post.