Package: kedo-pex
PEXpex is a library for generating .pex (Python EXecutable) files which are
executable Python environments in the spirit ofvirtualenvs.
pex is an expansion upon the ideas outlined inPEP 441and makes the deployment of Python applications as simple ascp.  pex files may even
include multiple platform-specific Python distributions, meaning that a single pex file
can be portable across Linux and OS X.pex files can be built using thepextool.  Build systems such asPants,Buck, and{py}gradlealso
support building .pex files directly.Still unsure about what pex does or how it works?  Watch this quick lightning
talk:WTF is PEX?.pex is licensed under the Apache2 license.InstallationTo install pex, simply$pipinstallpexYou can also build pex in a git clone using tox:$tox-epy27-package$cpdist/pex~/binThis builds a pex binary indist/pexthat can be copied onto your$PATH.
The advantage to this approach is that it keeps your Python environment as empty as
possible and is more in-line with what pex does philosophically.Simple ExamplesLaunch an interpreter withrequests,flaskandpsutilin the environment:$pexrequestsflask'psutil>2,<3'Or instead freeze your current virtualenv via requirements.txt and execute it anywhere:$pex-r<(pipfreeze)-omy_virtualenv.pex$deactivate$./my_virtualenv.pexRun webserver.py in an environment containingflaskas a quick way to experiment:$pexflask--webserver.pyLaunch Sphinx in an ephemeral pex environment using the Sphinx entry pointsphinx:main:$pexsphinx-esphinx:main----helpBuild a standalone pex binary intopex.pexusing thepexconsole_scripts entry point:$pexpex-cpex-opex.pexYou can also build pex files that use a specific interpreter type:$pexpex-cpex--python=pypy-opypy-pex.pexMost pex options compose well with one another, so the above commands can be
mixed and matched.  For a full list of options, just typepex--help.Integrating pex into your workflowIf you use tox (and you should!), a simple way to integrate pex into your
workflow is to add a packaging test environment to yourtox.ini:[testenv:package]deps=pexcommands=pex . -o dist/app.pexThentox-epackagewill produce a relocateable copy of your application
that you can copy to staging or production environments.DocumentationMore documentation about pex, building .pex files, and how .pex files work
is available athttps://pex.readthedocs.io.Developmentpex usestoxfor test and development automation.  To run
the test suite, just invoke tox:$toxIf you don’t have tox, you can generate a pex of tox:$ pex tox -c tox -o ~/bin/toxContributingTo contribute, follow these instructions:http://pantsbuild.org/howto_contribute.htmlRelease Notes1.2.7Sort keys in PEX-INFO file so the output is deterministic. (#384)#384Pass platform for SourceTranslator (#386)#3861.2.6Fix for Ambiguous Resolvable bug in transitive dependency resolution (#367)#3671.2.5This release follows-up on 1.2.0 fixing bugs in the pre-release resolving code paths.Resolving pre-release when explicitly requested (#372)#374Pass allow_prerelease to other iterators (Static, Caching) (#373)#3731.2.4Fix bug in cached dependency resolution with exact resolvable. (#365)#365Treat .pth injected paths as extras. (#370)#3701.2.3Follow redirects on HTTP requests (#361)#361Fix corner case in cached dependency resolution (#362)#3621.2.2Fix CacheControl import. (#357)#3571.2.1This release is a quick fix for a bootstrapping bug that inadvertently went out in 1.2.0 (Issue
#354).Ensurepackagingdependency is self-contained. (#355)#355Fixes #3541.2.0This release changes pex requirement resolution behavior. Only stable requirements are resolved by
default now. The previous behavior that included pre-releases can be retained by passing–preon
the pex command line or passingallow_prereleases=Truevia the API.Upgrade dependencies to modern version ranges. (#352)#352Add support for controlling prerelease resolution. (#350)#350Fixes #281.1.20Add dummy flush method for clean interpreter exit with python3.6 (#343)#3431.1.19Implement –constraints in pex (#335)#335Make sure namespace packages (e.g. virtualenvwrapper) don’t break pex (#338)#3381.1.18Expose a PEX instance’s path. (#332)#332Check for scripts directory in get_script_from_egg (#328)#3281.1.17Make PEX_PATH unify pex sources, as well as requirements. (#329)#3291.1.16Adjust FileFinder import to work with Python 3.6. (#318)#318Kill zipmanifest monkeypatching. (#322)#322Bump setuptools range to latest. (#323)#3231.1.15Fix #309 by deduplicating output of the distribution finder. (#310)#310Update wheel dependency to >0.26.0. (#304)#3041.1.14Repair Executor error handling for other classes of IOError/OSError. (#292)#292Fix bdist_pex –pex-args. (#285)#285Inherit user site with –inherit-path. (#284)#2841.1.13Repair passing of stdio kwargs to PEX.run(). (#288)#2881.1.12Fix bdist_pex interpreter cache directory. (#286)#286Normalize and edify subprocess execution. (#255)#255Don’t ignore exit codes when using setuptools entry points. (#280)#280Fixes #1371.1.11Update cache dir when bdist_pex.run is called directly.#278Fixes #2741.1.10Improve failure modes for os.rename() as used in distribution caching.#271Fixes #2651.1.9Bugfix: Open setup.py in binary mode.#264Fixes #2631.1.8Bugfix: Repair a regression in–disable-cache.#261Fixes #2601.1.7Add README and supported python versions to PyPI description.#258Useopenwith utf-8 support.#231Add–pex-rootoption.#2061.1.6This release is a quick fix for a regression that inadvertently went out in 1.1.5 (Issue #243).Fix thebdist_pexsetuptoolscommand to work for python2.#246Fixes #243Upgrade pex dependencies onsetuptoolsandwheel.#244Fixes #2381.1.5FixPEXBuilder.cloneand thusbdist_pex--pex-argsfor--pythonand--python-shebang.#234Fixes #233Fix oldpkg_resourcesegg version normalization.#227Fixes #226Fix theinherit_pathhandling.#224Fix handling of bad distribution script names when used as the pex entrypoint.#221Fixes #2201.1.4This release is a quick fix for a regression that inadvertently went out in 1.1.3 (Issue #216).Add a test for the regression inFixedEggMetadata._zipinfo_nameand revert the breaking commit.Fixes #2161.1.3This release includes an initial body of work towards Windows support, ABI tag support for CPython 2.x and a fix for version number normalization.Add python 2.x abi tag support.#214Fixes #213Add .idea to .gitignore.#205Don’t normalize version numbers as names.#204More fixes for windows.#202Fixes to get pex to work on windows.#1981.1.2Bump setuptools & wheel version pinning.#194Unescape html in PageParser.href_match_to_url.#191Memoize calls to Crawler.crawl() for performance win in find-links based resolution.#1871.1.1Fix infinite recursion whenPEX_PYTHONpoints at a symlink.#182Add/etc/pexrcto the list of pexrc locations to check.#183Improve error messaging for platform constrained Untranslateable errors.#1791.1.0Add support for.pexrcfiles for influencing the pex environment. See the noteshere.#128.Bug fix: PEX_PROFILE_FILENAME and PEX_PROFILE_SORT were not respected.#154.Adds thebdist_pexcommand to setuptools.#99.Bug fix: We did not normalize package names inResolvableSet, so it was possible to depend onsphinxandSphinx-1.4a0.tar.gzand get two versions build and included into the pex.#147.Adds a pex-identifying User-Agent.#101.1.0.3Bug fix: Accommodate OSXPythonpython binaries.  Previously the OSX python distributions shipped
with OSX, XCode and available viahttps://www.python.org/downloads/could fail to be detected using
thePythonInterpreterclass.
Fixes#144.Bug fix: PEX_SCRIPT failed when the script was from a not-zip-safe egg.
Original PR#139.Bug fix:sys.exitcalled without arguments would causeNoneto be printed on stderr since pex 1.0.1.#143.1.0.2Bug fix: PEX-INFO values were overridden by environmentVariableswith default values that were
not explicitly set in the environment.
Fixes#135.Bug fix: Since69649c1we have been unpatching
the side-effects ofsys.modulesafterPEX.execute.  This takes all modules imported during
the PEX lifecycle and sets all their attributes toNone.  Unfortunately,sys.excepthook,atexitand__del__may still try to operate using these tainted modules, causing exceptions
on interpreter teardown.  This reverts just thesysunpatching so that the abovementioned
teardown hooks behave more predictably.
Fixes#141.1.0.1Allow PEXBuilder to optionally copy files into the PEX environment instead of hard-linking them.Allow PEXBuilder to optionally skip precompilation of .py files into .pyc files.Bug fix: PEXBuilder did not respect the target interpreter when compiling source to bytecode.
Fixes#127.Bug fix: Fix complex resolutions when using a cache.
Fixes:#120.1.0.0The 1.0.0 release of pex introduces a few breaking changes:pex-rnow takes requirements.txt files
instead of requirement specs,pex-shas now been removed since source specs are accepted as arguments,
andpex-phas been removed in favor of its aliaspex-o.The pexcommand line interfacenow adheres to semver insofar as backwards incompatible CLI
changes will invoke a major version change.  Any backwards incompatible changes to the PEX
environment variable semantics will also result in a major version change.  The pexAPIadheres
to semver insofar as backwards incompatible API changes will invoke minor version changes.For users of the PEX API, it is recommended to add minor version ranges, e.g.pex>=1.0,<1.1.
For users of the PEX CLI, major version ranges such aspex>=1,<2should be sufficient.BREAKING CHANGE: Removes the-soption in favor of specifying directories directly as
arguments to the pex command line.BREAKING CHANGE:pex-rnow takes requirements.txt filenames andnotrequirement
specs.  Requirement specs are now passed as arguments to the pex tool.  Use--to escape
command line arguments passed to interpreters spawned by pex.  Implements#5.Adds a number of flag aliases to be more compatible with pip command lines:--no-index,-f,--find-links,--index-url,--no-use-wheel.  Removes-pin favor of-oexclusively.Adds--python-shebangoption to the pex tool in order to set the#!shebang to an exact
path.#53.Adds support forPEX_PYTHONenvironment variable which will cause the pex file to reinvoke
itself using the interpreter specified, e.g.PEX_PYTHON=python3.4orPEX_PYTHON=/exact/path/to/interpreter.#27.Adds support forPEX_PATHenvironment variable which allows merging of PEX environments at
runtime.  This can be used to inject plugins or entry_points or modules from one PEX into
another without explicitly building them together.#30.Consolidates documentation ofPEX_environment variables and adds the--help-variablesoption
to the pex client.  Partially addresses#13.Adds helper method to dump a package subdirectory onto disk from within a zipped PEX file.  This
can be useful for applications that know they’re running within a PEX and would prefer some
static assets dumped to disk instead of running as an unzipped PEX file.#12.Now supports extras for static URLs and installable directories.#65.Adds-mand--entry-pointalias to the existing-eoption for entry points in
the pex tool to evoke the similarity topython-m.Adds console script support via-c/--script/--console-scriptandPEX_SCRIPT.  This allows
you to reference the named entry point instead of the exactmodule:namepair.  Also supports
scripts defined in thescriptssection of setup.py.#59.Adds more debugging information when encountering unresolvable requirements.#79.Bug fix:PEX_COVERAGEandPEX_PROFILEdid not function correctly when SystemExit was raised.
Fixes#81.Bug fix: Fixes caching in the PEX tool since we don’t cache the source distributions of installable
directories.#24.0.9.0This is the last release before the 1.0.0 development branch is started.Change the setuptools range to >=2.2,<16 by handling EntryPoint changes as well as
being flexible on whetherpkg_resourcesis a package or a module.  Fixes#55and#34.Adds option groups to the pex tool to make the help output slightly more readable.Bug fix: Makepip install pexwork better by removingextras_requireson theconsole_scriptentry point.  Fixes#48New feature: Adds an interpreter cache to thepextool.  If the user does not explicitly
disable the wheel feature and attempts to build a pex with wheels but does not have the wheel
package installed, pex will download it in order to make the feature work.
Implements#47in order to
fix#480.8.6Bug fix: Honor installed sys.excepthook in pex teardown.RB #1733Bug fix:UrllibContextusedreplaceas a keyword argument forbytes.decodebut this only works on Python 3.Pull Request #460.8.5Bug fix: Fixup string formatting in pex/bin/pex.py to support Python 2.6Pull Request #400.8.4Performance improvement: Speed up the best-case scenario of dependency resolution.RB #1685Bug fix: Change fromuuid4().get_hex()touuid4().hexto maintain Python3
compatibility of pex.common.Pull Request #39Bug fix: Actually cache the results of translation.  Previously bdist translations
would be created in a temporary directory even if a cache location was specified.RB #1666Bug fix: Support all potential abi tag permutations when determining platform
compatibility.Pull Request #330.8.3Performance improvement: Don’t always write packages to disk if they’ve already been
cached.  This can significantly speed up launching PEX files with a large
number of non-zip-safe dependencies.RB #16420.8.2Bug fix: Allow pex 0.8.x to parse pex files produced by earlier versions of
pex and twitter.common.python.Pin pex to setuptools prior to 9.x until we have a chance to make changes
related to PEP440 and the change of pkg_resources.py to a package.0.8.1Bug fix: Fix issue where it’d be possible toos.path.getmtimeon a remoteLinkobjectIssue #290.8.0API change: Decouple translation from package iteration.  This removes
the Obtainer construct entirely, which likely means if you’re using PEX as
a library, you will need to change your code if you were doing anything
nontrivial.  This adds a couple new options toresolvebut simplifies
the story around how to cache packages.RB #785Refactor http handling in pex to allow for alternate http implementations.  Adds support
forrequests,
improving both performance and security.   For more information, read the commit notes at91c7f32.RB #778Improvements to API documentation throughout.RenamedTracertoTraceLoggerto prevent nondeterministic isort ordering.Refactor tox.ini to increase the number of environment combinations and improve coverage.Adds HTTP retry support for the RequestsContext.RB #1303Make pex –version correct.Issue #19Bug fix: Fix over-aggressive sys.modules scrubbing for namespace packages.  Under
certain circumstances, namespace packages in site-packages could conflict with packages
within a PEX, causing them to fail importing.RB #1378Bug fix: Replace uses ofos.unsetenv(...)withdelos.environ[...]Pull Request #11Bug fix: Scrub sys.path and sys.modules based upon both supplied path and
realpath of files and directories.  Newer versions of virtualenv on Linux symlink site-packages
which caused those packages to not be removed from sys.path correctly.Issue #21Bug fix: The pex -s option was not correctly pulling in transitive dependencies.Issue #22Bug fix: Addscontentmethod to HTTP contexts that does HTML content decoding, fixing
an encoding issue only experienced when using Python 3.Issue #100.7.0Renametwitter.common.pythontopexand split out from thetwitter/commonsrepo.0.6.0Change the interpretation of-i(and of PyPIFetcher’s pypi_base)
to match pip’s-i.  This is useful for compatibility with devpi.0.5.10Ensures that .egg/.whl distributions on disk have their mtime updated
even though we no longer overwrite them. This gives them a new time
lease against their ttl.Without this change, once a distribution aged past the ttl it would
never be used again, and builds would re-create the same distributions
in tmpdirs over and over again.0.5.9Fixes an issue where SourceTranslator would overwrite .egg/.whl
distributions already on disk.  Instead it should always check to see if
a copy already exists and reuse if there.This ordinarily should not be a problem but the zipimporter caches
metadata by filename instead of stat/sha, so if the underlying contents
changed a runtime error would be thrown due to seemingly corrupt zip file
offsets.RB #6840.5.8Adds-i/--indexoption to the pex tool.0.5.7Addstwitter.common.python.pex_bootstrapbootstrap_pex_envfunction in
order to initialize a PEX environment from within a python interpreter.
(Patch contributed by @kwlzn)Adds stdin=,stdout=,stderr= keyword parameters to thePEX.runfunction.
(Patch from @benjy)0.5.6The crawler now defaults to not follow links for security reasons.
(Before the default behavior was to implicitly--follow-linksfor all
requirements.)RB #2930.5.5Improves scrubbing of site-packages from PEX environments.RB #2890.5.1 - 0.5.4Silences exceptions reported during interpreter teardown (the exceptions
resulting from incorrect atexit handler behavior) introduced by 0.4.3RB #253RB #249Adds__hash__toLinkso that Packages are hashed correctly intwitter.common.python.resolverresolve0.5.0Adds wheel support totwitter.common.pythonRB #94RB #154RB #1480.4.3Addstwitter.common.python.finderswhich are additional finders for
setuptools including:
- find eggs within a .zip
- find wheels within a directory
- find wheels within a .zipRB #86Adds a new Package abstraction by refactoring Link into Link and Package.RB #92Adds support for PEP425 tagging necessary for wheel support.RB #87Improves python environment isolation by correctly scrubbing namespace
packages injected into module__path__attributes by nspkg pth files.RB #116Addstwitter.common.python.resolverresolvemethod that handles
transitive dependency resolution better.  This means that if the
requirementfutures==2.1.2and an unqualifiedfutures>=2is pulled in
transitively, our resolver will correctly resolve futures 2.1.2 instead
of reporting a VersionConflict if any version newer than 2.1.2 is
available.RB #129Factors alltwitter.common.pythontest helpers intotwitter.common.python.testingRB #91Bug fix: FixOrderedSetatexit exceptionsRB #147Bug fix: Fix cross-device symlinking (patch from @benjy)Bug fix: Raise aRuntimeErrorif we fail to writepkg_resourcesinto a .pexRB #1150.4.2Upgrade tosetuptools>=10.4.1twitter.common.pythonis no longer a namespace package0.4.0Kill the egg distiller.  We now delegate .egg generation to bdist_egg.RB #550.3.1Short-circuit resolving a distribution if a local exact match is found.RB #47Correctly patch the globalpkg_resourcesWorkingSetfor the lifetime
of the Python interpreter.RB #52Fixes a performance regression in setuptoolsbuild_zipmanifestSetuptools Issue #154RB #530.3.0Plumb through the--zip-safe,--always-write-cache,--ignore-errorsand--inherit-pathflags to the pex tool.Delete the unusedPythonDirWrappercode.SplitPEXEnvironmentresolution intotwitter.common.python.environmentand deconflateWorkingSet/Environmentstate.Removes the monkeypatched zipimporter in favor of keeping all eggs
unzipped within PEX files.  Refactors the PEX dependency cache inutil.pyAdds interpreter detection for Jython and PyPy.Dependency translation errors should be made uniform.
(Patch from @johnsirois)AddsPEX_PROFILE_ENTRIESto limit the number of entries reported whenPEX_PROFILEis enabled. (Patch from @rgs_)Bug fix: Several fixes to error handling intwitter.common.python.http(From Marc Abramowitz)Bug fix: PEX should not always assume that$PATHwas available.
(Patch from @jamesbroadhead)Bug fix: Filename should be part of the .pex cache key or else multiple
identical versions will incorrectly resolve (Patch from @tc)Bug fix: Executed entry points shouldn’t be forced to run in an
environment with__future__imports enabled. (Patch from
@lawson_patrick)Bug fix: Detect versionless egg links and fail fast. (Patch from
@johnsirois.)Bug fix: Handle setuptools>=2.1 correctly in the zipimport monkeypatch
(Patch from @johnsirois.)0.2.3Bug fix: Fix handling of Fetchers withfile://urls.0.2.2Adds the pex tool as a standalone tool.0.2.1Bug fix: Bootstrappedtwitter.common.pythonshould declaretwitter.commonas a namespace package.0.2.0Maketwitter.common.pythonfully standalone by consolidating
external dependencies withintwitter.common.python.common.0.1.0Initial published version oftwitter.common.python.