Alfie Mellor

Alfie Mellor


10 Steps to Set Up Your Python Project for Success

In this guide we’ll walk through adding tests and integrations to speed development and improve code quality and consistency. If don’t have a basic working Python package, check out my guide to building one and then meet right back here.

Cool. Here’s our ten-step plan for this article:

  1. Install Black
  2. Create .pycache
  3. Install pytest
  4. Create Tests
  5. Sign up for Travis CI and Configure
  6. Create .travis.yaml
  7. Test Travis CI
  8. Add Code Coverage
  9. Add Coveralls
  10. Add PyUp

This guide is for macOS with Python 3.7. Everything works as of early 2019, but things change fast.

We’ve got work to do. Let’s hop to it! 🐸

Step 1: Install Black

Your package code should follows common style conventions. Black is a Python package that automatically formats your code for you so that it meet PEP 8. Black is relatively new and already has over a million downloads. Using it has quickly become a best practice in Python coding. Here’s a good guide to Black.

I’m using Atom for my editor, so I added the Python-Black package to Atom _— _install info is here. Now Atom will reformat your code when you save your file.

While we’re at it, let’s add Black to the development environment for our collaborators. Eventually, anyone who works on the project will adhere to the same style guide, or else their pull request won’t be accepted. 😦

Add black==18.9b0 to the next empty line of requirements_dev.txt and run pip install -r requirements_dev.txt.

Black makes 88 characters the default max line length. Some guides and programs require 79 characters, e.g. Sphinx style guide. In the Black Atom, package you can set the max length.

Now that we’re set up to save time writing code, let’s save time pushing our app to PyPI.

Step 2: Create .pypirc

When we use twine to push our builds to TestPyPI and PyPI we need to enter our login info manually. See my previous article if you aren’t familiar with twine. Let’s automate that process.

Twine will look or a file named .pypirc in our home directory. It will grab our url, login, and password when uploading our file.

Create your .pypirc file in your home directory with:

touch ~/.pypirc

Add the following contents to your .pypirc file:

index-servers =

username = your_username
password = your_pypitest_password

username = your_username
password = your_pypi_password

Replace with your username and passwords. Make sure to save this file in your home directory and not your current working directory. If you want to make sure other users are on your machine can’t access this file, you can change its permissions from the command line:

chmod 600 ~/.pypirc

Now you can upload your package to TestPyPI with the following command:

twine upload -r testpypi dist/*

Upload to the real PyPI with this command:

twine upload dist/*

No more usernames and passwords to enter. Isn’t that nice? 😄

Now let’s add some tests to make sure our package works.

Step 3: Install and Configure pytest

Pytest is the most popular easy-to-use library for testing your Python code. In this example, we’ll add simple tests to our project. Here’s a nice pytest intro tutorial, if you want to go deeper.

Add pytest to your requirements_dev.txt file with


Run pip install requirements_dev.txt

Then run the following so that pytest can find your package:

pip install -e .

If you deactivate your virtual environment, you’ll need to run both pip commands again to run your tests.

Step 4: Create Tests

Add a tests folder in the top level of your project. Add a file inside it My file is named Starting the file with test_ makes it automatically discoverable by pytest.

In I added the following test to check whether the correct name prints as part of the function output. Modify to fit your own file and function names.

"""Tests for `notebookc` package."""
import pytest
from notebookc import notebookc

def test_convert(capsys):
    """Correct my_name argument prints"""
    captured = capsys.readouterr()
    assert "Jall" in captured.out

What’s going on here?

We first import our module. Then we create a function with test_my_function_name. This naming convention is helpful for other people and the code coverage package we’ll add soon.

Then we call our function, convert, with “Jill” as the argument. Then we capture the output. As a reminder, our convert function is extremely basic — it takes the parameter my_name and outputs a line:

print(f”I’ll convert a notebook for you some day, {my_name}.”)

Pytest checks to see if the string “Jall” is in the output. It shouldn’t be present, because we passed in “Jill”. See the pytest documentation on capturing output here.

Run your test by entering pytest on the command line. Your test should fail with red text.

It’s good practice to make sure your tests fail when they should. Don’t just write them so they are green right away. Otherwise, your tests might not be testing what you think they are. 😉

After we have a failing test we can change our expected output from Jall to Jill, and our tests should pass in green.

Yep, all good. Now we have a test that ensures that when someone passes a string value to our function, that string is printed.

Let’s add a test to check that only a string has been passed to our function. If anything other than a string is passed, then a TypeError should be raised. Here’s a good guide on exceptions and error handling in Python.

When we write the test before we write the code that makes the test pass, we’re doing test-driven development (TDD). TDD is a proven method to write code with fewer errors. Here’s a nice article on TDD.

Let’s try something different this time. As an exercise, add your own test and code to ensure only a string can be passed as the argument to convert(). Hint: integers, lists, and dicts get type-converted to strings. Follow me on Twitter @discdiver and I’ll post the solution there.

After we have passing tests we are ready to integrate our package with a CI service.

Step 5: Sign up for Travis CI and Configure

Travis CI is a “hosted, distributed continuous integration service used to build and test software projects”. It was recently acquired by Idera. There are other CI options, but Travis CI is popular, free for open-source, and well-documented.

Travis CI makes it easier to ensure that only code that passes your tests and standards is integrated into your project. Learn more about Travis CI here and more about continuous integration here.

Sign up for an account at Click on the Review and add your authorized organizations link from your Travis CI profile page. You’ll be prompted for your GitHub password. Click Grant next to your organization access.

I had to sync my account for notebooktoall to show as an organization and for the notebookc repository to appear. It often takes a minute or more for data to start flowing. Then toggle your repo to on.

Click on settings. You can choose whether you want Travis to build on pushed pull requests and/or on pushed branches.

Now we need to configure a file locally so that Travis will build for each pull request.

Step 6: Create .travis.yml

In the top level of your project folder, add a .travis.yml file with these contents:

dist: xenial
language: python
python: 3.7.2
  - pip install -r requirements_dev.txt
  - pip install -e .
  - pytest

dist: xenial is needed to specify that Travis should use Ubuntu Xenial 16.04 for its virtual environment. Xenial must be specified for testing Python 3.7 code. More info here.

Different versions of Python can be specified for testing. We’ll get into that topic in a future article. Follow me to make sure you don’t miss it!

The install section ensures our packages for development are installed. pip install -e . installs your package as a wheel into Travis’s virtual environment. Then Travis will find your package when it runs pytest.

Step 7: Test Travis CI

Commit your changes, push to GitHub, make a PR. Travis should start to run automatically within a few seconds.

Here’s what Travis is doing.

Travis will tell you if your PR fails.

Note that if a pull request fails, you can push to the same branch and Travis automatically reruns.

Go to your repo’s page on Travis and have a look around. There’s lots of info on Travis about your builds. You’ll probably be visiting this site a good bit in the future trying to figure out why your build didn’t pass. 😄

Assuming everything is green, you’re good to go!

If you don’t see any red or green, click on the More options menu and select Requests from the dropdown. If you see red, have a look at the error messages. If you see the error Build config file is required, then Travis isn’t finding your .travis.yml file on GitHub. Make sure it’s in your GitHub repo. 😉

Travis sends you emails to let you know when a build fails and when a failed build has been fixed.

Remember that you can keep pushing your commits to an open PR and Travis will rerun automatically.

Let’s see just how much of our code has test coverage.

Step 8: Add Code Coverage

A code coverage report shows you what percentage of your code has at least some test coverage. We’ll add the pytest-cov package to create a report.

Add the following line to requirements_dev.txt:


Run with pytest --cov=my_project_name

My output of pytest --cov=notebookc looks like this:

Sweet, all our code is covered! When you only have a few lines that’s not a high bar. 😄 But we don’t need to tell the world that — let’s show them that we’ve got coverage!

Step 9: Add Coveralls

Coveralls provides a history of your code coverage for all the world to see.

Head over to and signup for an account using your GitHub credentials. Add your organization and toggle on your repo when it appears.

In requirements_dev.txt add coveralls==1.6.0. Your requirements_dev.txt should now look like this:


Alter your .travis.yml file so it looks like the following (substituting your package name):

dist: xenial
language: python
python: 3.7.2
  — pip install -r requirements_dev.txt
  — pip install -e .
  — pytest --cov=my_package_name
  — coveralls

Now when Travis builds your project, it will install the necessary packages, run your tests, and create a coverage report. Then it sends the coverage report to coveralls.

Commit, push to GitHub, and watch the magic happen. It can take a few minutes for your coverage report to flow, so be patient.

Now coveralls shows in your PR checks. Cool!

Over on the Coveralls webpage, we should show 100% coverage.

Alright, let’s add one more tool to our belt.

Step 10: Add PyUp lets you know when package dependencies are out of date or have security vulnerabilities. It automatically makes a pull request to update the package on GitHub.

Go to, register through GitHub, and connect your organization.

When you add your repo, I suggest you toggle your update schedule to every week. Then you won’t get lots of pull requests if you have a bunch of package dependencies.

Here’s an example of a repository on PyUp that shows some out of date packages.

Now you’ll know when a package is updated — and knowing is half the battle. Automated pull requests must be the other half, right? 😏


In this article you’ve learned how to add and configure Black, pytest, Travis CI, Coveralls, and PyUp. We’ve set the stage for more secure code with more consistent style. That’s pretty sweet!

In a future article we’ll look at how to configure and build your docs with Read The Docs, add badges, manage releases, and more. Follow me to make sure you don’t miss it.

I hope you found this guide useful. If you did, please share it on your favorite social media channels so others can find it too. 👏

Learn More

Learn Programming with Python Step by Step

Complete Python: Go from zero to hero in Python

An A-Z of useful Python tricks

A Complete Machine Learning Project Walk-Through in Python

Learning Python: From Zero to Hero

Introduction to PyTorch and Machine Learning

Python Tutorial for Beginners (2019) - Learn Python for Machine Learning and Web Development

Build Your First Open Source Python Project

Master Python through building real-world applications

Complete Python Bootcamp: Go from zero to hero in Python 3

Machine Learning A-Z™: Hands-On Python & R In Data Science

Complete Python Masterclass

Python and Django Full Stack Web Developer Bootcamp

Thanks for reading!


What is GEEK

Buddha Community

10 Steps to Set Up Your Python Project for Success
Ray  Patel

Ray Patel


top 30 Python Tips and Tricks for Beginners

Welcome to my Blog , In this article, you are going to learn the top 10 python tips and tricks.

1) swap two numbers.

2) Reversing a string in Python.

3) Create a single string from all the elements in list.

4) Chaining Of Comparison Operators.

5) Print The File Path Of Imported Modules.

6) Return Multiple Values From Functions.

7) Find The Most Frequent Value In A List.

8) Check The Memory Usage Of An Object.

#python #python hacks tricks #python learning tips #python programming tricks #python tips #python tips and tricks #python tips and tricks advanced #python tips and tricks for beginners #python tips tricks and techniques #python tutorial #tips and tricks in python #tips to learn python #top 30 python tips and tricks for beginners

Ray  Patel

Ray Patel


42 Exciting Python Project Ideas & Topics for Beginners [2021]

Python Project Ideas

Python is one of the most popular programming languages currently. It looks like this trend is about to continue in 2021 and beyond. So, if you are a Python beginner, the best thing you can do is work on some real-time Python project ideas.

We, here at upGrad, believe in a practical approach as theoretical knowledge alone won’t be of help in a real-time work environment. In this article, we will be exploring some interesting Python project ideas which beginners can work on to put their Python knowledge to test. In this article, you will find 42 top python project ideas for beginners to get hands-on experience on Python

Moreover, project-based learning helps improve student knowledge. That’s why all of the upGrad courses cover case studies and assignments based on real-life problems. This technique is ideally for, but not limited to, beginners in programming skills.

But first, let’s address the more pertinent question that must be lurking in your mind:

#data science #python project #python project ideas #python project ideas for beginners #python project topics #python projects #python projects for beginners

Ray  Patel

Ray Patel


Lambda, Map, Filter functions in python

Welcome to my Blog, In this article, we will learn python lambda function, Map function, and filter function.

Lambda function in python: Lambda is a one line anonymous function and lambda takes any number of arguments but can only have one expression and python lambda syntax is

Syntax: x = lambda arguments : expression

Now i will show you some python lambda function examples:

#python #anonymous function python #filter function in python #lambda #lambda python 3 #map python #python filter #python filter lambda #python lambda #python lambda examples #python map

Autumn  Blick

Autumn Blick


Top Android Projects with Source Code

Android Projects with Source Code – Your entry pass into the world of Android

Hello Everyone, welcome to this article, which is going to be really important to all those who’re in dilemma for their projects and the project submissions. This article is also going to help you if you’re an enthusiast looking forward to explore and enhance your Android skills. The reason is that we’re here to provide you the best ideas of Android Project with source code that you can choose as per your choice.

These project ideas are simple suggestions to help you deal with the difficulty of choosing the correct projects. In this article, we’ll see the project ideas from beginners level and later we’ll move on to intermediate to advance.

top android projects with source code

Android Projects with Source Code

Before working on real-time projects, it is recommended to create a sample hello world project in android studio and get a flavor of project creation as well as execution: Create your first android project

Android Projects for beginners

1. Calculator

build a simple calculator app in android studio source code

Android Project: A calculator will be an easy application if you have just learned Android and coding for Java. This Application will simply take the input values and the operation to be performed from the users. After taking the input it’ll return the results to them on the screen. This is a really easy application and doesn’t need use of any particular package.

To make a calculator you’d need Android IDE, Kotlin/Java for coding, and for layout of your application, you’d need XML or JSON. For this, coding would be the same as that in any language, but in the form of an application. Not to forget creating a calculator initially will increase your logical thinking.

Once the user installs the calculator, they’re ready to use it even without the internet. They’ll enter the values, and the application will show them the value after performing the given operations on the entered operands.

Source Code: Simple Calculator Project

2. A Reminder App

Android Project: This is a good project for beginners. A Reminder App can help you set reminders for different events that you have throughout the day. It’ll help you stay updated with all your tasks for the day. It can be useful for all those who are not so good at organizing their plans and forget easily. This would be a simple application just whose task would be just to remind you of something at a particular time.

To make a Reminder App you need to code in Kotlin/Java and design the layout using XML or JSON. For the functionality of the app, you’d need to make use of AlarmManager Class and Notifications in Android.

In this, the user would be able to set reminders and time in the application. Users can schedule reminders that would remind them to drink water again and again throughout the day. Or to remind them of their medications.

3. Quiz Application

Android Project: Another beginner’s level project Idea can be a Quiz Application in android. Here you can provide the users with Quiz on various general knowledge topics. These practices will ensure that you’re able to set the layouts properly and slowly increase your pace of learning the Android application development. In this you’ll learn to use various Layout components at the same time understanding them better.

To make a quiz application you’ll need to code in Java and set layouts using xml or java whichever you prefer. You can also use JSON for the layouts whichever preferable.

In the app, questions would be asked and answers would be shown as multiple choices. The user selects the answer and gets shown on the screen if the answers are correct. In the end the final marks would be shown to the users.

4. Simple Tic-Tac-Toe

android project tic tac toe game app

Android Project: Tic-Tac-Toe is a nice game, I guess most of you all are well aware of it. This will be a game for two players. In this android game, users would be putting X and O in the given 9 parts of a box one by one. The first player to arrange X or O in an adjacent line of three wins.

To build this game, you’d need Java and XML for Android Studio. And simply apply the logic on that. This game will have a set of three matches. So, it’ll also have a scoreboard. This scoreboard will show the final result at the end of one complete set.

Upon entering the game they’ll enter their names. And that’s when the game begins. They’ll touch one of the empty boxes present there and get their turn one by one. At the end of the game, there would be a winner declared.

Source Code: Tic Tac Toe Game Project

5. Stopwatch

Android Project: A stopwatch is another simple android project idea that will work the same as a normal handheld timepiece that measures the time elapsed between its activation and deactivation. This application will have three buttons that are: start, stop, and hold.

This application would need to use Java and XML. For this application, we need to set the timer properly as it is initially set to milliseconds, and that should be converted to minutes and then hours properly. The users can use this application and all they’d need to do is, start the stopwatch and then stop it when they are done. They can also pause the timer and continue it again when they like.

6. To Do App

Android Project: This is another very simple project idea for you as a beginner. This application as the name suggests will be a To-Do list holding app. It’ll store the users schedules and their upcoming meetings or events. In this application, users will be enabled to write their important notes as well. To make it safe, provide a login page before the user can access it.

So, this app will have a login page, sign-up page, logout system, and the area to write their tasks, events, or important notes. You can build it in android studio using Java and XML at ease. Using XML you can build the user interface as user-friendly as you can. And to store the users’ data, you can use SQLite enabling the users to even delete the data permanently.

Now for users, they will sign up and get access to the write section. Here the users can note down the things and store them permanently. Users can also alter the data or delete them. Finally, they can logout and also, login again and again whenever they like.

7. Roman to decimal converter

Android Project: This app is aimed at the conversion of Roman numbers to their significant decimal number. It’ll help to check the meaning of the roman numbers. Moreover, it will be easy to develop and will help you get your hands on coding and Android.

You need to use Android Studio, Java for coding and XML for interface. The application will take input from the users and convert them to decimal. Once it converts the Roman no. into decimal, it will show the results on the screen.

The users are supposed to just enter the Roman Number and they’ll get the decimal values on the screen. This can be a good android project for final year students.

8. Virtual Dice Roller

Android Project: Well, coming to this part that is Virtual Dice or a random no. generator. It is another simple but interesting app for computer science students. The only task that it would need to do would be to generate a number randomly. This can help people who’re often confused between two or more things.

Using a simple random number generator you can actually create something as good as this. All you’d need to do is get you hands-on OnClick listeners. And a good layout would be cherry on the cake.

The user’s task would be to set the range of the numbers and then click on the roll button. And the app will show them a randomly generated number. Isn’t it interesting ? Try soon!

9. A Scientific Calculator App

Android Project: This application is very important for you as a beginner as it will let you use your logical thinking and improve your programming skills. This is a scientific calculator that will help the users to do various calculations at ease.

To make this application you’d need to use Android Studio. Here you’d need to use arithmetic logics for the calculations. The user would need to give input to the application that will be in terms of numbers. After that, the user will give the operator as an input. Then the Application will calculate and generate the result on the user screen.

10. SMS App

Android Project: An SMS app is another easy but effective idea. It will let you send the SMS to various no. just in the same way as you use the default messaging application in your phone. This project will help you with better understanding of SMSManager in Android.

For this application, you would need to implement Java class SMSManager in Android. For the Layout you can use XML or JSON. Implementing SMSManager into the app is an easy task, so you would love this.

The user would be provided with the facility to text to whichever number they wish also, they’d be able to choose the numbers from the contact list. Another thing would be the Textbox, where they’ll enter their message. Once the message is entered they can happily click on the send button.

#android tutorials #android application final year project #android mini projects #android project for beginners #android project ideas #android project ideas for beginners #android projects #android projects for students #android projects with source code #android topics list #intermediate android projects #real-time android projects

Shawn  Durgan

Shawn Durgan


10 Writing steps to create a good project brief - Mobile app development

Developing a mobile application can often be more challenging than it seems at first glance. Whether you’re a developer, UI designer, project lead or CEO of a mobile-based startup, writing good project briefs prior to development is pivotal. According to Tech Jury, 87% of smartphone users spend time exclusively on mobile apps, with 18-24-year-olds spending 66% of total digital time on mobile apps. Of that, 89% of the time is spent on just 18 apps depending on individual users’ preferences, making proper app planning crucial for success.

Today’s audiences know what they want and don’t want in their mobile apps, encouraging teams to carefully write their project plans before they approach development. But how do you properly write a mobile app development brief without sacrificing your vision and staying within the initial budget? Why should you do so in the first place? Let’s discuss that and more in greater detail.

Why a Good Mobile App Project Brief Matters?


It’s worth discussing the significance of mobile app project briefs before we tackle the writing process itself. In practice, a project brief is used as a reference tool for developers to remain focused on the client’s deliverables. Approaching the development process without written and approved documentation can lead to drastic, last-minute changes, misunderstanding, as well as a loss of resources and brand reputation.

For example, developing a mobile app that filters restaurants based on food type, such as Happy Cow, means that developers should stay focused on it. Knowing that such and such features, UI elements, and API are necessary will help team members collaborate better in order to meet certain expectations. Whether you develop an app under your brand’s banner or outsource coding and design services to would-be clients, briefs can provide you with several benefits:

  • Clarity on what your mobile app project “is” and “isn’t” early in development
  • Point of reference for developers, project leads, and clients throughout the cycle
  • Smart allocation of available time and resources based on objective development criteria
  • Streamlined project data storage for further app updates and iterations

Writing Steps to Create a Good Mobile App Project Brief


1. Establish the “You” Behind the App

Depending on how “open” your project is to the public, you will want to write a detailed section about who the developers are. Elements such as company name, address, project lead, project title, as well as contact information, should be included in this introductory segment. Regardless of whether you build an in-house app or outsource developers to a client, this section is used for easy document storage and access.

#android app #ios app #minimum viable product (mvp) #mobile app development #web development #how do you write a project design #how to write a brief #how to write a project summary #how to write project summary #program brief example #project brief #project brief example #project brief template #project proposal brief #simple project brief template