Giter Site home page Giter Site logo

python-cli-example's Introduction

Coursera Course

Python CLI Example

A small Python CLI example you can use to build on. With an emphasis on Linux and creating automation tools that solve a problem for you. THis is the basis for DevOps principles that you can apply in your own environment as well as production environments.

๐Ÿ’ก Are you just looking for a ๐Ÿ‘‰ Rust template to get started easily with a Rust project? The template has everything you need!

This repository is part of the Python and Rust CLI tools course:

Practice Lab

Use the included practice lab to apply the content you've learned in this week. Follow the steps to create your own repository and apply the requirements to complete the lab.

Setting up the environment

Python development will require you to have Python installed on your system. For Linux systems, you should prefer the Python that comes available through the package manager. For example, on Ubuntu, you can install Python with the following command:

sudo apt-get update && sudo apt-get install python3

The update part is required if this is a fresh install of the system. Any Python version above 3.6 should work well for this repository, its examples, and most of the work shown in the video course.

The course uses Visual Studio Code exclusively, but you can use any other text editor as well.

These are all the tools and editor extensions recommended for Python development:

Working with Modules

Adding modules (Python files) is as easy as adding more files. But you can also add a directory and add an __init__.py file to it. This will allow you to import the modules from the directory as if they were part of the same file. There are some caveats and things to keep in mind when working with modules, and what strategies you can use to make your code more maintainable and easier to understand for you as well as other developers.

  1. Use the ceph-volume command-line tool as an example to explore module organizing
  2. Add imports to __init__.py as a shorthand for making modules available, but be aware of side effects
  3. Use relative imports to avoid circular imports and understand absolute

Dependencies and libraries

Using dependencies can be tricky, but you can use the well known requirements.txt file to keep track of the dependencies for your projects which is something that works with the pip installer tool. Here are some things to be aware of when working with dependencies:

  1. Create a requirements.txt file, optionally read it in for the setup.py file
  2. Use separate files for development and testing like dev-requirements.txt and test-requirements.txt when needed
  3. Use pip to install dependencies and use pip freeze to pin dependencies. Be aware of the caveats and positive aspects of pinning.
  4. Understand how relaxed dependencies can be instead of pinning

Resources

Explore additional content that you can use to learn more about the topics covered in this course.

Coursera Courses

O'Reilly Courses and Books

python-cli-example's People

Contributors

alfredodeza avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.