Coder Social home page Coder Social logo

configuring-python-08-2022's Introduction

Configuring Python Applications

Learning Goals

  • Configure an application with modules that can import from one another.
  • Find and install packages using PyPI and pip.
  • Control dependencies in virtual environments with pipenv.

Key Vocab

  • Interpreter: a program installed on your computer that looks at and runs Python code. It can be used to open interactive shells and execute code.
  • Python 2: an old version of Python. Some thought it would never end! Many environment setups interpret python to mean "Python 2", so be explicit with python3 when possible.
  • Python 3: the current version of Python. Our environment setup instructions should direct all python commands to Python 3, but it is still always wise to use python3 in your scripts.
  • Shebang: #!/usr/bin/env python3 should be included at the top of any modules that you intend to give executable permissions to. This tells the command line to execute the program using the python3 interpreter so you don't need to type python3 from the command line.
  • __init__.py: a file required in Python 2 to create a Python package. No longer required in Python 3, but useful for backward compatibility and setting up environments within packages.
  • Relative Import: an import that navigates through the application's directory structure with dots (.), much like you would from the command line. Relative imports are rarely the best option, and explicitly suggested against in PEP-8.
  • Absolute Import: an import that uses the application structure to determine a base directory and any Python packages beneath it.
  • PYPI: the Python Package Index. Contains most Python packages that can be retrieved with pip. Its search function is notoriously unhelpful.
  • Google: a much better tool for finding Python packages by desired functionality.
  • pip: the package installer from Python. Comes with any installation of Python.
  • pipenv: a combination of pip and a virtual environment. Manages pip dependencies and saves them in Pipfiles that can be shared with teammates.

Introduction

Welcome to Python PD!

We're starting today with a topic that's often a pain-point for Python beginners: application structure. In time, Python's insistence on explicit structure will save you time and frustration. That usually takes a while.

This is going to be structured as a demo / Q & A, with three sections of material and three opportunities for questions. The curriculum team will keep track of the chat throughout, and we will address the questions when each section is complete. The first will be a bit longer than the other three.

While this is intended to be a demo rather than a code-along, a GitHub repo will be shared in the chat in just a moment. Make sure to fetch all branches, as they represent the endpoints of each section.


Resources

configuring-python-08-2022's People

Contributors

professor-ben avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.