smart-arrays


Namesmart-arrays JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryA wrapper around python lists that implement type safety and element-wise operations like numpy. Additionally, if the uncertainties package is installed, arrays of ufloats can be used
upload_time2024-04-14 00:35:19
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords arrays numpy science typed
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Smart Arrays

I created this project for two reasons. For a college project I wanted to have the flexibility of numpy arrays (which I absolutely love), especialy their ability to do element-wise operations and type safety (in Python, when doing math, I hate it that if you use simple lists, any element can be of any type. I need type safety!), but didn't want to have to use a library so big. I also wanted to try to understand how would one come to implement something like numpy arrays' api. This library is the result.

Everything stems out of the class SmartArray, which is a simple wrapper around a list, that has static size and is type safe. There is also a SmartList, which is the same but its size is mutable. I'll provide a list below with all available objects

| Object name        | Fixed size? | Implements [collections.abc](https://docs.python.org/3/library/collections.abc.html) |
| ------------------ | ----------- | --------------------------- |
| SmartArray         | Yes         | Sequence[T]                 |
| SmartList          | No          | MutableSequence[T] (almost) |
| SmartArrayNumber   | Yes         | Set[C]                      |
| SmartListNumber    | No          | MutableSet[C]               |
| SmartArrayComplex  | Yes         | Set[complex]                |
| SmartListComplex   | No          | MutableSet[complex]         |
| SmartArrayFloat    | Yes         | Set[float]                  |
| SmartListFloat     | No          | MutableSet[float]           |
| SmartArrayInt      | Yes         | Set[int]                    |
| SmartListInt       | No          | MutableSet[int]             |
| SmartArrayBool     | Yes         | Set[bool]                   |
| SmartListBool      | No          | MutableSet[bool]            |
| UncertaintiesArray | Yes         | Set[ufloat] (almost)        |
| UncertaintiesList  | No          | MutableSet[ufloat] (almost) |

Where T is any type and C is bound to complex. That means complex, float, int or bool. Also, if you have installed the [uncertainties](https://pythonhosted.org/uncertainties/) package, you can also use the UncertaintiesArray and UncertaintiesList. These work like SmartArrayNumber and SmartListNumber (except for some boolean, logic and binary operations) but their type is ufloat. That means that any arithmetical operation propagates the error, element-wise!

In utils I wrote some utility functions for these Arrays/Lists, for example way to save and load arrays to and from disk.

In stats I wrote functions to do some statistical analysis. 

I'm very busy with college, but I'll try to keep updating this to make it more friendly for users. :)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "smart-arrays",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "arrays, numpy, science, typed",
    "author": null,
    "author_email": "Lautaro Silbergleit <lautisilbergleit@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3d/be/198dad353d04cc5ed3bed06e364056f9c838a89a3b02b8335e3ef879df00/smart_arrays-0.0.1.tar.gz",
    "platform": null,
    "description": "# Smart Arrays\n\nI created this project for two reasons. For a college project I wanted to have the flexibility of numpy arrays (which I absolutely love), especialy their ability to do element-wise operations and type safety (in Python, when doing math, I hate it that if you use simple lists, any element can be of any type. I need type safety!), but didn't want to have to use a library so big. I also wanted to try to understand how would one come to implement something like numpy arrays' api. This library is the result.\n\nEverything stems out of the class SmartArray, which is a simple wrapper around a list, that has static size and is type safe. There is also a SmartList, which is the same but its size is mutable. I'll provide a list below with all available objects\n\n| Object name        | Fixed size? | Implements [collections.abc](https://docs.python.org/3/library/collections.abc.html) |\n| ------------------ | ----------- | --------------------------- |\n| SmartArray         | Yes         | Sequence[T]                 |\n| SmartList          | No          | MutableSequence[T] (almost) |\n| SmartArrayNumber   | Yes         | Set[C]                      |\n| SmartListNumber    | No          | MutableSet[C]               |\n| SmartArrayComplex  | Yes         | Set[complex]                |\n| SmartListComplex   | No          | MutableSet[complex]         |\n| SmartArrayFloat    | Yes         | Set[float]                  |\n| SmartListFloat     | No          | MutableSet[float]           |\n| SmartArrayInt      | Yes         | Set[int]                    |\n| SmartListInt       | No          | MutableSet[int]             |\n| SmartArrayBool     | Yes         | Set[bool]                   |\n| SmartListBool      | No          | MutableSet[bool]            |\n| UncertaintiesArray | Yes         | Set[ufloat] (almost)        |\n| UncertaintiesList  | No          | MutableSet[ufloat] (almost) |\n\nWhere T is any type and C is bound to complex. That means complex, float, int or bool. Also, if you have installed the [uncertainties](https://pythonhosted.org/uncertainties/) package, you can also use the UncertaintiesArray and UncertaintiesList. These work like SmartArrayNumber and SmartListNumber (except for some boolean, logic and binary operations) but their type is ufloat. That means that any arithmetical operation propagates the error, element-wise!\n\nIn utils I wrote some utility functions for these Arrays/Lists, for example way to save and load arrays to and from disk.\n\nIn stats I wrote functions to do some statistical analysis. \n\nI'm very busy with college, but I'll try to keep updating this to make it more friendly for users. :)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A wrapper around python lists that implement type safety and element-wise operations like numpy. Additionally, if the uncertainties package is installed, arrays of ufloats can be used",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/lautisilber/smart_arrays",
        "Source": "https://github.com/lautisilber/smart_arrays"
    },
    "split_keywords": [
        "arrays",
        " numpy",
        " science",
        " typed"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5a6f4103423e31969c2e93cb5b78fbdb0b68a84ffcd5d2c11667d5e08cb6e8e2",
                "md5": "7d809b232199c4b8a31f8d4b76af3bae",
                "sha256": "1474ec30a0c637f75ac99ad0cc704c2b3d5ae679761c2fa7c7b7438f236fbe31"
            },
            "downloads": -1,
            "filename": "smart_arrays-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d809b232199c4b8a31f8d4b76af3bae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10556,
            "upload_time": "2024-04-14T00:35:18",
            "upload_time_iso_8601": "2024-04-14T00:35:18.250639Z",
            "url": "https://files.pythonhosted.org/packages/5a/6f/4103423e31969c2e93cb5b78fbdb0b68a84ffcd5d2c11667d5e08cb6e8e2/smart_arrays-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3dbe198dad353d04cc5ed3bed06e364056f9c838a89a3b02b8335e3ef879df00",
                "md5": "f8cd232e74ea9c4b9eceb5425ccf22a3",
                "sha256": "107bcf1cb8e3ac4fcc68a528992594f2c1603b7d4e75940ed67288755d8c7db0"
            },
            "downloads": -1,
            "filename": "smart_arrays-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f8cd232e74ea9c4b9eceb5425ccf22a3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9662,
            "upload_time": "2024-04-14T00:35:19",
            "upload_time_iso_8601": "2024-04-14T00:35:19.909104Z",
            "url": "https://files.pythonhosted.org/packages/3d/be/198dad353d04cc5ed3bed06e364056f9c838a89a3b02b8335e3ef879df00/smart_arrays-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-14 00:35:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lautisilber",
    "github_project": "smart_arrays",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "smart-arrays"
}
        
Elapsed time: 0.22482s