Developing Python Packages

Start Free Preview

Buying via our links supports this free directory · Affiliate disclosure.
Course facts
  • Payment: Free Preview (Paid Upgrade)
  • Learning style: Self-paced, start anytime
  • Format: Text & Interactive
  • Video access: Streaming Only
  • Before you start: Introduction to Shell; Writing Functions in Python
DataCamp details
  • Chapters: 4
Created byDataCamp
Available onDataCamp

Course Details
Learning Style

Start Anytime

Level

Intermediate

Study Mode

100% Online

Duration

Short (< 10 Hours)

Languages
Audio Language

English

Outcomes
Certificate

Certificate of Completion

Price & Terms
Pricing Model

Free Preview (Paid Upgrade)

Technical
Content Medium

Text & Interactive

Video Access

Streaming Only

Specification
Access

Subscription

SKU: developing-python-packages Category: Tags: , Brand:

Turn existing Python scripts into a documented package, check it with pytest, tox and flake8, and publish it on PyPI for others.

At a glance
Duration4 hrs
LevelIntermediate
CertificateCertificate of Completion
LanguageEnglish
Taught byJames Fulton
AccessSubscription
Add your review
Add to wishlistAdded to wishlistRemoved from wishlist 0
Add to compare

Python code kept in loose scripts tends to get copied between files, which makes it awkward to reuse and harder to share. Wrapping that code into a proper package solves the problem. You organize modules and subpackages, document functions, write a setup script, sort out dependencies and publish a distribution on PyPI. Then you add tests, style checks and project templates so that later releases take less effort.

What You Will Achieve

  • Reorganize existing scripts into a Python package whose functions users can import directly
  • Document each function and module so others can understand how to use your code
  • Install your package on any machine and publish it on PyPI with setuptools and twine
  • Catch errors with automated tests, confirm support for several Python versions and keep a consistent code style


Program Overview

Building a Local Package from Scripts

Converts code you already have into a simple package that works on your own computer, then documents it and settles how its parts import each other.

  • Modules, packages and subpackages
  • Function documentation with pyment
  • Package and module documentation
  • Sibling and parent imports, exposing functions to users

Installing and Publishing to PyPI

Makes the package installable for you and for others, and walks through each step of putting it on PyPI.

  • Setup script, local installs and editable installs
  • User and development dependencies
  • Licenses, READMEs and MANIFEST extra files
  • Building and uploading distributions

Package Quality and Rapid Development

Raises the package to a professional standard with automated checks, then speeds up new projects and releases with templates and release tools.

  • Test directory and basic tests with pytest, multiple environments with tox
  • flake8 configuration and ignoring specific errors
  • Package templates with cookiecutter
  • bumpversion, history files, CONTRIBUTING.md, Makefiles and PyPI classifiers

Certificate Awarded (Paid)


Job Outlook

Packaging skills are used wherever Python code is shared and reused, such as internal libraries kept by development teams, open-source projects published on PyPI, and utilities that several projects depend on.


Our take

Good for: Python users who keep reusing the same functions across projects and want to install, test and share them as a proper package.

Keep in mind: The workflow is tied to specific tools, setuptools and twine for publishing and bumpversion with Makefiles for releases, and the final chapter only introduces the files that attract contributors.

Bottom line: A tool-by-tool walk through packaging Python code that ends with a tested, consistently styled package published on PyPI.

Frequently Asked Questions

What is cookiecutter used for in the lessons?

Cookiecutter generates a package skeleton from a template, creating the supporting files a package needs so you do not have to write each one by hand when starting a new project.

What does tox add to testing with pytest?

pytest runs the tests you write in the package's test directory. tox sets up separate environments so the same tests run against more than one version of Python, showing whether the package works with each.

Which supporting files does a finished package include?

Beyond the code itself, the lessons add a setup script, a README, a license, a MANIFEST for extra files, a test directory, flake8 configuration, a CONTRIBUTING.md file, a history file and PyPI classifiers.

How are package dependencies handled?

The lessons treat two kinds separately: the user dependencies people need to run your package, and the development dependencies you rely on while building and checking it.

User Reviews

0.0 out of 5
★★★★★
0
★★★★★
0
★★★★★
0
★★★★★
0
★★★★★
0

No reviews yet. Be the first to review this course.

There are no reviews yet.

Write your review

Reviews can only be posted by registered learners. Log in, then you will return here to post.

×

    Report this page
    Developing Python Packages
    Developing Python Packages
    LiveTalent
    Logo
    Compare items
    • Total (0)
    Compare
    0