Skip to main content

Create the file and folder structure for a Python package

Project description

Code style: black

create-python-package

Initialize a new package using best practices as described by the Python Packaging Authority (PyPA). Perfect for beginners and experts alike. No more guesswork!

Read more on the blog post.

Overview

This package ships with four CLI entrypoints:

- build-python-package
- create-python-package
- create-venv
- publish-python-package

To use create-python-package:

create-python-package mypackage
cd mypackage
source activate

To publish (which automatically builds first), run

publish-python-package path_to_package

To build without publishing

build-python-package path_to_package

To create a virtual environment

create-venv path  # creates venv at path/venv and symlink to activate at path/activate
# then run `source activate` to activate the virtual environment

Virtualenv ready to go!

Inside the directory you can run

source activate

to activate an isolated Python environment that was created specifically for that package. To deactivate it, type

deactivate

To learn more about virtual environments, see Creating Virtual Environments.

Installation

pipx is a new package that allows you to run or install Python binaries from packages

pipx install create-python-package

pipx install create-python-package installed package create-python-package, 0.0.0.5 These binaries are now globally available - build-python-package - create-python-package - create-venv - publish-python-package done! ✨ 🌟 ✨

If you do not wish to use pipx, you can install as follows.

python3 -m venv cpp  # create a virtual environment
source cpp/bin/activate  # activate the virtual environment
pip install -U pip  # upgrade pip
pip install create-python-package

Requires Python 3.6+.

Example Session

> create-python-package /tmp/fake
Creating a new Python package in /private/tmp/fake

Creating a virtual environment at /private/tmp/fake/venv
Upgrading pip in the virtual environment.

Initialized a git repository.

Success! Created fake at /private/tmp/fake
Inside that directory, you can run several commands

  source activate
     Activates this package's isolated Python environment

  pip install PACKAGE
    Installs a package to current environment

  pip install -e .
    Installs this package in editable mode to the current environment

We suggest that you being by typing:

  cd fake
  source activate

To deactivate the virtual environment, type `deactivate`.

Questions? Create an issue at https://github.com/cs01/create-python-package

Happy hacking!

Credits

Created and published using create-python-package 😄

Inspired by create-react-app

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

create-python-package-0.0.0.6.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

create_python_package-0.0.0.6-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file create-python-package-0.0.0.6.tar.gz.

File metadata

  • Download URL: create-python-package-0.0.0.6.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for create-python-package-0.0.0.6.tar.gz
Algorithm Hash digest
SHA256 bb22f9d7709bf12cd932be3b45cb189c0b901011fca2296963c9000b0624c4d0
MD5 7886063d1cc8591f95a1e798ee78646d
BLAKE2b-256 ffd06c5db069a089a45b03e298feda341f3ecb36a99f81a482a161035ccab034

See more details on using hashes here.

File details

Details for the file create_python_package-0.0.0.6-py3-none-any.whl.

File metadata

  • Download URL: create_python_package-0.0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for create_python_package-0.0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a6c3dd75d8c7840313be2ef21301d5f4788dc64ad8f062f4811d0ccd75635246
MD5 8d5577d0cb7e1c8f1ca4e2402a3f4a12
BLAKE2b-256 a7d7a7e9db9de30177f1081d2b17744366bdbf4aa7f4d0ad7849ad463258bf04

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page