normalize

A toolkit for wrapping network data in Python objects

https://github.com/hearsaycorp/normalize

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

A toolkit for wrapping network data in Python objects

Basic Info
  • Host: GitHub
  • Owner: hearsaycorp
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 835 KB
Statistics
  • Stars: 14
  • Watchers: 11
  • Forks: 37
  • Open Issues: 0
  • Releases: 12
Created over 12 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License Authors

README.rst

Normalize
=========

The normalize package is a class builder and toolkit most useful for
writing "plain old data structures" to wrap data from network sources
in python objects.

It is called "normalize", because it is focused on the first normal
form of relational database modelling.
This is the simplest and most straightforward level which defines what
are normally called "records" (or *rows*).
A record is a defined collection of properties/attributes (*columns*),
where you know roughly what to expect in each property/attribute, and
can access them by some kind of descriptor (i.e., the attribute name).
You can also use it as a general purpose declarative meta-programming
framework, as it ships with an official meta-object-protocol (MOP) API
to describe this information, built on top of python's notion of
classes/types and descriptors and extended where necessary.

Put simply, you write python classes to describe your assumptions
about the data structures you're dealing with, feed in input data and
you get regular python objects back which have attributes which you
can use naturally.
Or, you get an error and find you have to revisit your assumptions.
You can then perform basic operations with the objects, such as make
changes to them and convert them back, or compare them to another
version using the rich comparison API.
You can also construct the objects 'natively' using regular python
keyword/value constructors or by passing a ``dict`` as the first
argument.

It is very similar in scope to the ``remoteobjects`` and
``schematics`` packages on PyPI, and may in time evolve to include all
the features of those packages.

While there is some notion of primary keys in the module, mainly for
the purposes of recognizing objects in collections for comparison,
higher levels of normalization are an exercise left to the
implementer.


Features
--------

* declarative API, which may optionally contain direct marshaling
  hints:

  ::

      class Star(Record):
          id = Property(isa=int, required=True)
          name = Property(isa=str)
          other_names = Property(json_name="otherNames")

  Type descriptions (``isa=``) are completely optional, but if given
  will be use for type checking and coercion.

* rich descriptor API (in ``normalize.property``), including the
  notions of not just 'required' and 'isa' type hints as shown above
  but also default functions, custom-type check functions, and
  coercion functions.

  It also sports an extensible attribute trait system, which adds more
  features via optional Property sub-classes, selected automatically,
  enabling:

  * lazy attributes which short-cut at the python core level once
    calculated (a somewhat underused python feature)

  * read-only attributes

  * type-safe attributes (i.e., that type-check on assign)

  * collection attributes (see below)

* coercion from regular python dictionaries or ``key=value``
  (*kwargs*) constructor arguments

* conversion to and from JSON for all classes, regardless of whether
  they derive ``normalize.record.json.JsonRecord``.  Support for custom
  functions for JSON marshal in and out.

* conversion to primitive python types via the pickle API
  (``__getnewargs__``)

* **New in 0.5**: generic mechanism for marshalling to and from other
  other forms.  See the documentation for the new
  ``normalize.visitor.VisitorPattern`` API.

* typed collections with item coercion (currently lists and dicts only):

  ::

      class StarSystem(Record):
          components = ListProperty(Star)

      alpha_centauri = StarSystem(
          components=[{id=70890, name="Proxima Centauri"},
                      {id=71683, name="Alpha Centauri A"},
                      {id=71681, name="Alpha Centauri B"}]
      )

* "field selector" API which allows for specification of properties
  deep into nested data structures;

  ::

      name_selector = FieldSelector("components", 0, "name")
      print name_selector.get(alpha_centauri)  # "Proxima Centauri"

* comparison API which returns differences between two Records of
  matching types.  Ability to mark properties as "extraneous" to skip
  comparison (this also affects the ``==`` operator)

* ...and much more!


============
Contributing
============

#. Fork the repo from `GitHub `_.
#. Make your changes.
#. Add unittests for your changes.
#. Run `pep8 `_, `pyflakes `_, and `pylint `_ to make sure your changes follow the Python style guide and doesn't have any errors.
#. Commit.  Please write a commit message which explains the use case; see the commit log for examples.
#. Add yourself to the AUTHORS file (in alphabetical order).
#. Send a pull request from your fork to the main repo.

Owner

  • Name: Hearsay Systems
  • Login: hearsaycorp
  • Kind: organization
  • Location: San Francisco, CA

GitHub Events

Total
  • Issues event: 4
  • Watch event: 1
  • Delete event: 1
  • Issue comment event: 4
  • Member event: 1
  • Push event: 1
  • Pull request review comment event: 2
  • Pull request event: 2
  • Pull request review event: 3
Last Year
  • Issues event: 4
  • Watch event: 1
  • Delete event: 1
  • Issue comment event: 4
  • Member event: 1
  • Push event: 1
  • Pull request review comment event: 2
  • Pull request event: 2
  • Pull request review event: 3

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 391
  • Total Committers: 17
  • Avg Commits per committer: 23.0
  • Development Distribution Score (DDS): 0.146
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Sam Vilain s****m@v****t 334
Sam Vilain s****n@h****m 25
Ofer Goldstein o****n@h****m 5
Bradford Toney b****y@h****m 5
Mason Blalock m****k@h****m 3
Robert MacCloy r****y@h****m 3
Dale Hui d****i 2
John Lynn j****n@h****m 2
Adam DePue a****e@h****m 2
Krisztian Kocsis k****s@h****m 2
Sameer Patel s****l@h****m 2
Tomo Otsuka t****a@h****m 1
Kyland Holmes k****s@h****m 1
Saranya Dhakshinamurthy s****y@i****l 1
Akshay Shah a****h@h****m 1
Wyatt w****l@h****m 1
Dale Hui d****e@m****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 10
  • Total pull requests: 69
  • Average time to close issues: about 2 years
  • Average time to close pull requests: 22 days
  • Total issue authors: 7
  • Total pull request authors: 19
  • Average comments per issue: 2.3
  • Average comments per pull request: 1.52
  • Merged pull requests: 54
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: about 21 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • asherf (3)
  • samv (2)
  • johnklee (1)
  • dhui (1)
  • rogerhu (1)
  • agiledata (1)
  • pcockwell (1)
Pull Request Authors
  • samv (42)
  • saraducks (3)
  • bluemoon (3)
  • KyKoPho (2)
  • tulioz (2)
  • rbm (2)
  • jlynn (2)
  • dhui (2)
  • blalockma (2)
  • sgalhs (2)
  • ibiternas (1)
  • adepue (1)
  • kkocsis (1)
  • tamasszanto-hs (1)
  • tomo-otsuka (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 5,176 last-month
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 21
    (may contain duplicates)
  • Total versions: 45
  • Total maintainers: 4
proxy.golang.org: github.com/hearsaycorp/normalize
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.2%
Average: 5.4%
Dependent repos count: 5.6%
Last synced: 11 months ago
pypi.org: normalize

Declarative Python meta-model system and visitor utilities

  • Versions: 43
  • Dependent Packages: 1
  • Dependent Repositories: 21
  • Downloads: 5,176 Last month
Rankings
Dependent repos count: 3.2%
Downloads: 3.6%
Dependent packages count: 4.7%
Forks count: 6.8%
Average: 6.8%
Stargazers count: 15.6%
Last synced: 11 months ago

Dependencies

setup.py pypi
  • future *
  • richenum >=1.0.0
  • six *