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

Xenum offers a simple alternative to Python 3 enums that’s especially useful for (de)serialization. When you would like to model your enum values so that they survive jumps to and from JSON, databases, and other sources cleanly as strings, Xenum will allow you to do so extremely easily.

Installation

Installation is simple. With python3-pip, do the following:

$ sudo pip install -e .

Or, to install the latest version available on PyPI:

$ sudo pip install xenum

Usage

Just create a basic class with attributes and annotate it with the @xenum attribute. This will convert all of the class attributes into Xenum instances and allow you to easily convert them to strings via str(MyEnum.A) and from strings via MyEnum.by_name("MyEnum.A").

Example

from xenum import xenum, ctor

@xenum
class Actions:
  INSERT = ctor('insert')
  UPDATE = ctor('update')
  DELETE = ctor('delete')

  def __init__(self, name):
     self.name = name

assert Actions.INSERT == Actions.by_name('Actions.INSERT')
assert Actions.INSERT().name == 'insert'

Checkout test.py in the git repo for more usage examples.

Change Log

Version 1.4: September 5th, 2016

  • Add ‘xenum.sref()’ allowing enum values to be instances of the @xenum annotated class, whos *args is prepended with the Xenum instance itself for self-reference.

Version 1.3: September 4th, 2016

  • Add ‘xenum.ctor()’ allowing enum values to be instances of the @xenum annotated class.
  • Made Xenum instances callable, returning the enum’s internal value.

Version 1.2: September 4th, 2016

  • Add ‘values()’ method to @xenum annotated classes for fetching an ordered sequence of the Xenum entities created.

Version 1.1: August 31st, 2016

  • Made Xenum instances hashable, removed value() as a function.
Release History

Release History

1.4

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

1.3

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

1.2

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

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

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

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
xenum-1.4.tar.gz (4.3 kB) Copy SHA256 Checksum SHA256 Source Sep 6, 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