This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

pinliner - Python Inliner

This tool allows you to merge all files that comprise a Python package into a single file and be able to use this single file as if it were a package.

Not only will it behave as if it were the original package, but it will also show code in exceptions and debug sessions, and will display the right line number and file when logging.

Imports will work as usual so if you have a package structure like:

.
└── [my_package]
     ├── file_a.py
     ├── [sub_package]
     │    ├── file_b.py
     │    └── __init__.py
     ├── __init__.py

And with pinliner installed you execute:

$ mkdir test
$ pinliner my_package test/my_package.py
$ cd test
$ python

You’ll be able to use generated my_package.py file as if it were the real package:

>>> import my_package
>>> from my_package import file_a as a_file
>>> from my_package.sub_package import file_b

And __init__.py contents will be executed as expected when importing my_package package and you’ll be able to access its contents like you would with your normal package.

Modules will also behave as usual.

If your package is checking __name__ for __main__ it will also work as usual. Although given the fact that we only have 1 file we will no longer be able to call other packages/modules directly from the command line to trigger code conditioned to __name__ having __main__ as its value.

Loader code will automatically compile packages and modules to byte code, before running it. When a module is imported for the first time, or when the specific’s package/module source (not the whole inlined file) is more recent than the current compiled file, a .pyc file containing the compiled code will be created in the same directory as the pinlined .py file.

If the byte code is up to date then it will be used instead, thus avoiding a recompilation, exactly the same as python normally does, with the only exception that all .pyc files will be in the same directory and the filenames will include the full path to the original file.

Installation

You can install pinliner globally in your system or use a virtual environment, this is how it could be done using a virtual environment:

$ virtualenv .venv
$ source .venv/bin/activate
$ pip install pinliner

After that you can run the tool with pinliner.

History

0.2.0 (2016-04-03)

  • Add support for incompatible loaders to coexists.
  • Generate and use pyc files for modules.
  • Add support for the filename to be different than the package.
  • Now __main__ works directly from the package as expected.

0.1.1 (2016-03-29)

  • Fix missing template file when installing
  • Reduce memory footprint to keep the package structure and code.
  • Include tagging of beginning of files in the output.

0.1.0 (2016-03-27)

  • Show code when debugging and on tracebacks
  • Improve internal package and module names
  • Fix line numbers (off by 1)
  • Package’s root namespace is no longer polluted by pinliner
  • Original filename for package/modules is stored so it will be reported by exceptions and logging.

0.0.1 (2016-03-26)

  • Basic functionality.
Release History

Release History

0.2.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pinliner-0.2.0-py2.py3-none-any.whl (10.4 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Apr 3, 2016
pinliner-0.2.0.tar.gz (17.1 kB) Copy SHA256 Checksum SHA256 Source Apr 3, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting