Skip to main content

Containers for the python sages 🏺✨📦

Project description

Pyxides

Containers for the python sages 🏺✨📦

pyxides is a python library for working with array-like object containers.

The name "pyxides" is the plural form of the Greek word "pyxis" (πυξίς), the name for the decorated cylindrical containers from antiquity. The name felt appropriate for a python library involving containers!

Install

pip install pyxides

Use

Basic usage

The containers module contains some ready-made container classes that can be used directly:

from pyxides.containers import ArrayLike1D


a = ArrayLike1D([1, 2, 3])
# it has the usual list-like methods for editing, and expanding
three = a.pop(-1)
a.append(id)
a.extend(['some', 'other', object])
# multi-indexing works
a[[0, 3, 5]]
[1, <function id(obj, /)>, 'other']

Type Enforcement

To construct a container that only allows certain types of objects:

from pyxides.type_check import OfType

class Twinkie:
    """Yum!"""

class Box(list, OfType(Twinkie)):
    """So much YUM!"""

twinkies = Box()
twinkies.append(Twinkie()) # OK!

Object other than Twinkies, are not allowed in the container:

twinkies.append(0)
TypeError: Items in container class 'Box' must derive from  <class '__main__.Twinkie'>. Item 1  is of type <class 'int'>.

Vectorization

TODO

Grouping containers

TODO

Contribute

Contributions are welcome!

  1. Fork it!
  2. Create your feature branch
    git checkout -b feature/rad
  3. Commit your changes
    git commit -am 'Add some cool feature 😎'
  4. Push to the branch
    git push origin feature/rad
  5. Create a new Pull Request

Contact

License

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

pyxides-0.1.0.tar.gz (17.5 kB view hashes)

Uploaded Source

Built Distribution

pyxides-0.1.0-py3-none-any.whl (16.0 kB view hashes)

Uploaded Python 3

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