Skip to content

Commit

Permalink
Merge pull request #4 from cloudify-cosmo/add-installation-validation
Browse files Browse the repository at this point in the history
moved from wheelr to wagon and added installation and creation valida…
  • Loading branch information
nir0s committed Sep 24, 2015
2 parents e2bf0b3 + 673b72e commit 5fd3336
Show file tree
Hide file tree
Showing 15 changed files with 193 additions and 94 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
35f3b2d (HEAD, origin/master, origin/HEAD, master) docs update
e2bf0b3 (HEAD, origin/master, origin/HEAD, master, add-installation-validation) added more metadata info
35f3b2d docs update
ed8c6b9 docs update
8303ae1 First release
8303ae1 (tag: 0.1) First release
ad48881 more fixes
9fc7bc3 test fixes
f6119a7 more tests
Expand Down
56 changes: 36 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,107 @@
# Wheelr (Wheel aRchiver)
# Wagon

John Archibald Wheeler (July 9, 1911 – April 13, 2008) was an American theoretical physicist. He was largely responsible for reviving interest in general relativity in the United States after World War II. Wheeler also worked with Niels Bohr in explaining the basic principles behind nuclear fission. Together with Gregory Breit, Wheeler developed the concept of Breit–Wheeler process. He is also known for popularizing the term "black hole", for coining the terms "neutron moderator", "quantum foam", "wormhole", and "it from bit", and for hypothesizing the "one-electron universe".
A wagon (also spelt waggon in British and Commonwealth English) is a heavy four-wheeled vehicle pulled by draught animals, used for transporting goods, commodities, agricultural materials, supplies, and sometimes people. Wagons are distinguished from carts, which have two wheels, and from lighter four-wheeled vehicles primarily for carrying people, such as carriages.

* Master Branch [![Build Status](https://travis-ci.org/cloudify-cosmo/wheelr.svg?branch=master)](https://travis-ci.org/cloudify-cosmo/wheelr)
* PyPI [![PyPI](http://img.shields.io/pypi/dm/wheelr.svg)](http://img.shields.io/pypi/dm/wheelr.svg)
* Version [![PypI](http://img.shields.io/pypi/v/wheelr.svg)](http://img.shields.io/pypi/v/wheelr.svg)
* Master Branch [![Build Status](https://travis-ci.org/cloudify-cosmo/wagon.svg?branch=master)](https://travis-ci.org/cloudify-cosmo/wagon)
* PyPI [![PyPI](http://img.shields.io/pypi/dm/wagon.svg)](http://img.shields.io/pypi/dm/wagon.svg)
* Version [![PypI](http://img.shields.io/pypi/v/wagon.svg)](http://img.shields.io/pypi/v/wagon.svg)


This tool creates tar.gz based Python Wheel archives for single modules and allows to install them.
Wagon creates tar.gz based archives containing sets of Python Wheels for a single module with its dependencies and allows to install them.

(NOTE: Currently, only tested on Linux).

Cloudify Plugins are packaged as sets of Python [Wheels](https://packaging.python.org/en/latest/distributing.html#wheels) in tar.gz files and so we needed a tool to create such archives. Hence, Wheelr.
Cloudify Plugins are packaged as sets of Python [Wheels](https://packaging.python.org/en/latest/distributing.html#wheels) in tar.gz files and so we needed a tool to create such archives. Hence, Wagon.


## Installation

```shell
pip install wheelr
pip install wagon
```


## Usage

### Create Packages

```shell
wheelr create --help
wagon create --help
```

#### Examples

```shell
# create an archive by retrieving the source from PyPI and keep the downloaded wheels (kept under <cwd>/plugin)
wheelr create -s cloudify-script-plugin==1.2 --keep-wheels -v
wagon create -s cloudify-script-plugin==1.2 --keep-wheels -v
# create an archive package by retrieving the source from a URL and creates wheels from requirement files found within the archive.
wheelr create -s http://github.com/cloudify-cosmo/cloudify-script-plugin/archive/1.2.tar.gz -r .
wagon create -s http://github.com/cloudify-cosmo/cloudify-script-plugin/archive/1.2.tar.gz -r .
# create an archive package by retrieving the source from a local path and output the tar.gz file to /tmp/<MODULE>.tar.gz (defaults to <cwd>/<MODULE>.tar.gz)
wheelr create -s ~/modules/cloudify-script-plugin/ -o /tmp/
wagon create -s ~/modules/cloudify-script-plugin/ -o /tmp/
```

The output package of the three commands should be something like `cloudify_script_plugin-1.2-py27-none-any.tar.gz` if running under Python 2.7.x.

### Install Packages

```shell
wheelr install --help
wagon install --help
```

#### Examples

```shell
# install a packaged module from a local package tar file and upgrade if already installed
wheelr install -s ~/tars/cloudify_script_plugin-1.2-py27-none-any.tar.gz --upgrade
wagon install -s ~/tars/cloudify_script_plugin-1.2-py27-none-any.tar.gz --upgrade
# install a packaged module from a url into an existing virtualenv
wheelr install -s http://me.com/cloudify_script_plugin-1.2-py27-none-any.tar.gz --virtualenv my_venv -v
wagon install -s http://me.com/cloudify_script_plugin-1.2-py27-none-any.tar.gz --virtualenv my_venv -v
```

### Validate Packages

```sheel
wheelr validate --help
wagon validate --help
```

#### Examples

```shell
# validate that a package is a wheelr compatible package
wheelr validate ~/tars/cloudify_script_plugin-1.2-py27-none-any.tar.gz
# validate that a package is a wagon compatible package
wagon validate -s ~/tars/cloudify_script_plugin-1.2-py27-none-any.tar.gz
# validate from a url
wagon validate -s http://me.com/cloudify_script_plugin-1.2-py27-none-any.tar.gz
```


## Naming and Versioning

### Source: PyPI
When providing a PyPI source, it must be supplied as MODULE_NAME==MODULE_VERSION. Wheelr then applies the correct name and version to the archive according to the two parameters.
When providing a PyPI source, it must be supplied as MODULE_NAME==MODULE_VERSION. wagon then applies the correct name and version to the archive according to the two parameters.

### Source: Else
For local path and URL sources, the name and version are automatically extracted from the setup.py file.

NOTE: This means that when supplying a local path, you must supply a path to the root of where your setup.py file resides.

NOTE: If using a URL, it must be a URL to a tar.gz file structured like a GitHub tar.gz archive (e.g. https://github.com/cloudify-cosmo/cloudify-script-plugin/archive/master.tar.gz)


## Metadata File and Wheels

A Metadata file is generated for the archive and looks somewhat like this:

```
{
"archive_name": "cloudify_script_plugin-1.2-py27-none-any.tar.gz",
"supported_platform": "any",
"build_server_os_properties": {
"distribution": "ubuntu",
"distribution_release": "trusty",
"distribution_version": "14.04"
},
"module_name": "cloudify-script-plugin",
"module_source": "cloudify-script-plugin==1.2",
"module_version": "1.2",
"supported_platform": "any",
"wheels": [
"proxy_tools-0.1.0-py2-none-any.whl",
"bottle-0.12.7-py2-none-any.whl",
Expand All @@ -104,6 +118,8 @@ A Metadata file is generated for the archive and looks somewhat like this:
* The wheels to be installed reside in the tar.gz file under 'wheels/*.whl'.
* The Metadata file resides in the tar.gz file under 'module.json'.
* The installer uses the metadata file to check that the platform fits the machine the module is being installed on.
* The OS properties are specifically helpful to identify Linux distributions and their releases as compiled Wheels may vary between them.


## Archive naming convention and Platform
The tar.gz archive is named according to the Wheel naming convention described in [PEP0427](https://www.python.org/dev/peps/pep-0427/#file-name-convention) aside from two fields:
Expand Down
82 changes: 68 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
Wheelr
======
Wagon
=====

This tool creates tar.gz based Python Wheel archives for single modules
and allows to install them.
A wagon (also spelt waggon in British and Commonwealth English) is a
heavy four-wheeled vehicle pulled by draught animals, used for
transporting goods, commodities, agricultural materials, supplies, and
sometimes people. Wagons are distinguished from carts, which have two
wheels, and from lighter four-wheeled vehicles primarily for carrying
people, such as carriages.

- Master Branch |Build Status|
- PyPI |PyPI|
- Version |PypI|

Wagon creates tar.gz based archives containing sets of Python Wheels for
a single module with its dependencies and allows to install them.

(NOTE: Currently, only tested on Linux).

Cloudify Plugins are packaged as sets of Python
`Wheels <https://packaging.python.org/en/latest/distributing.html#wheels>`__
in tar.gz files and so we needed a tool to create such archives. Hence,
Wheelr.
Wagon.

Installation
------------

.. code:: shell
pip install wagon
Usage
-----
Expand All @@ -19,19 +37,19 @@ Create Packages

.. code:: shell
wheelr create --help
wagon create --help
Examples
^^^^^^^^

.. code:: shell
# create an archive by retrieving the source from PyPI and keep the downloaded wheels (kept under <cwd>/plugin)
wheelr create -s cloudify-script-plugin==1.2 --keep-wheels -v
wagon create -s cloudify-script-plugin==1.2 --keep-wheels -v
# create an archive package by retrieving the source from a URL and creates wheels from requirement files found within the archive.
wheelr create -s http://github.com/cloudify-cosmo/cloudify-script-plugin/archive/1.2.tar.gz -r .
wagon create -s http://github.com/cloudify-cosmo/cloudify-script-plugin/archive/1.2.tar.gz -r .
# create an archive package by retrieving the source from a local path and output the tar.gz file to /tmp/<MODULE>.tar.gz (defaults to <cwd>/<MODULE>.tar.gz)
wheelr create -s ~/modules/cloudify-script-plugin/ -o /tmp/
wagon create -s ~/modules/cloudify-script-plugin/ -o /tmp/
The output package of the three commands should be something like
``cloudify_script_plugin-1.2-py27-none-any.tar.gz`` if running under
Expand All @@ -42,17 +60,34 @@ Install Packages

.. code:: shell
wheelr install --help
wagon install --help
Examples
^^^^^^^^

.. code:: shell
# install a packaged module from a local package tar file and upgrade if already installed
wheelr install -s ~/tars/cloudify_script_plugin-1.2-py27-none-any.tar.gz --upgrade
wagon install -s ~/tars/cloudify_script_plugin-1.2-py27-none-any.tar.gz --upgrade
# install a packaged module from a url into an existing virtualenv
wheelr install -s http://me.com/cloudify_script_plugin-1.2-py27-none-any.tar.gz --virtualenv my_venv -v
wagon install -s http://me.com/cloudify_script_plugin-1.2-py27-none-any.tar.gz --virtualenv my_venv -v
Validate Packages
~~~~~~~~~~~~~~~~~

.. code:: sheel
wagon validate --help
Examples
^^^^^^^^

.. code:: shell
# validate that a package is a wagon compatible package
wagon validate -s ~/tars/cloudify_script_plugin-1.2-py27-none-any.tar.gz
# validate from a url
wagon validate -s http://me.com/cloudify_script_plugin-1.2-py27-none-any.tar.gz
Naming and Versioning
---------------------
Expand All @@ -61,7 +96,7 @@ Source: PyPI
~~~~~~~~~~~~

When providing a PyPI source, it must be supplied as
MODULE\_NAME==MODULE\_VERSION. Wheelr then applies the correct name and
MODULE\_NAME==MODULE\_VERSION. wagon then applies the correct name and
version to the archive according to the two parameters.

Source: Else
Expand All @@ -73,6 +108,10 @@ extracted from the setup.py file.
NOTE: This means that when supplying a local path, you must supply a
path to the root of where your setup.py file resides.

NOTE: If using a URL, it must be a URL to a tar.gz file structured like
a GitHub tar.gz archive (e.g.
https://github.com/cloudify-cosmo/cloudify-script-plugin/archive/master.tar.gz)

Metadata File and Wheels
------------------------

Expand All @@ -83,10 +122,15 @@ this:

{
"archive_name": "cloudify_script_plugin-1.2-py27-none-any.tar.gz",
"supported_platform": "any",
"build_server_os_properties": {
"distribution": "ubuntu",
"distribution_release": "trusty",
"distribution_version": "14.04"
},
"module_name": "cloudify-script-plugin",
"module_source": "cloudify-script-plugin==1.2",
"module_version": "1.2",
"supported_platform": "any",
"wheels": [
"proxy_tools-0.1.0-py2-none-any.whl",
"bottle-0.12.7-py2-none-any.whl",
Expand All @@ -104,6 +148,9 @@ this:
- The Metadata file resides in the tar.gz file under 'module.json'.
- The installer uses the metadata file to check that the platform fits
the machine the module is being installed on.
- The OS properties are specifically helpful to identify Linux
distributions and their releases as compiled Wheels may vary between
them.

Archive naming convention and Platform
--------------------------------------
Expand All @@ -128,3 +175,10 @@ Example: ``cloudify_fabric_plugin-1.2.1-py27-none-linux_x86_64.tar.gz``
the platform of the package. Of course, we assume that there can't be
wheels downloaded or created on a specific machine platform that
belongs to two different platforms.

.. |Build Status| image:: https://travis-ci.org/cloudify-cosmo/wagon.svg?branch=master
:target: https://travis-ci.org/cloudify-cosmo/wagon
.. |PyPI| image:: http://img.shields.io/pypi/dm/wagon.svg
:target: http://img.shields.io/pypi/dm/wagon.svg
.. |PypI| image:: http://img.shields.io/pypi/v/wagon.svg
:target: http://img.shields.io/pypi/v/wagon.svg
14 changes: 7 additions & 7 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- wheelr/logger.py:60: # TODO: (IMPRV) only perform file related actions if file handler is
- wheelr/logger.py:61: # TODO: (IMPRV) defined.
- wheelr/wheelr.py:229: # TODO: maybe we don't want to be that explicit and allow using >=
- wheelr/wheelr.py:230: # TODO: or just a module name...
- wheelr/wheelr.py:297: # TODO: Let the user provide supported Python versions.
- wheelr/wheelr.py:298: # TODO: Let the user provide supported Architectures.
- wheelr/utils.py:46: # TODO: implement using sh
- wagon/wagon.py:244: # TODO: maybe we don't want to be that explicit and allow using >=
- wagon/wagon.py:245: # TODO: or just a module name...
- wagon/wagon.py:314: # TODO: Let the user provide supported Python versions.
- wagon/wagon.py:315: # TODO: Let the user provide supported Architectures.
- wagon/logger.py:60: # TODO: (IMPRV) only perform file related actions if file handler is
- wagon/logger.py:61: # TODO: (IMPRV) defined.
- wagon/utils.py:46: # TODO: implement using sh
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ def read(*parts):


setup(
name='wheelr',
version='0.1.1',
url='https://github.com/cloudify-cosmo/wheelr',
name='wagon',
version='0.1.2',
url='https://github.com/cloudify-cosmo/wagon',
author='Gigaspaces',
author_email='[email protected]',
license='LICENSE',
platforms='All',
description='Creates Python Wheel Archives.',
description='Creates Python Wheel based archives.',
long_description=read('README.rst'),
packages=['wheelr'],
packages=['wagon'],
include_package_data=True,
entry_points={
'console_scripts': [
'wheelr = wheelr.wheelr:main',
'wagon = wagon.wagon:main',
]
},
install_requires=[
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ envlist=flake8,py27,py26
[testenv]
deps =
-rdev-requirements.txt
commands=nosetests --with-cov --cov-report term-missing --cov wheelr wheelr/tests -v
commands=nosetests --with-cov --cov-report term-missing --cov wagon wagon/tests -v

[testenv:flake8]
deps =
flake8
-rdev-requirements.txt
commands=flake8 wheelr
commands=flake8 wagon
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion wheelr/logger.py → wagon/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"class": "logging.handlers.RotatingFileHandler",
"formatter": "file",
"level": "DEBUG",
"filename": os.path.expanduser("~/.cfyap/cfyap.log"),
"filename": os.path.expanduser("~/.wagon/wagon.log"),
"maxBytes": "5000000",
"backupCount": "20"
},
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5fd3336

Please sign in to comment.