Add API for working with data from a package repository.

Review Request #7693 — Created Oct. 11, 2015 and submitted

Information

rbpkg
master

Reviewers

This introduces a set of classes for serializing/deserializing package
data stored in a repository, and classes for interacting with the
repository. It can be used to query packages, the available versions,
installation instructions, and more.

Each entry in the repository is a PackageBundle, which bundles together
a list of channels (PackageChannel). Each of these manages state for a
range of versions (1.0.x, 1.5.x, 2.0.x, etc.), and may also be mapped to
one or more aliases (beta, stable, etc.).

Each channel lists all available releases (PackageChannel), and also
contains rules (PackageRules) on how to install any given version.

These objects are populated with data from the repository through
deserialization class methods that they provide. That data comes from a
PackageDataLoader subclass, which knows how to fetch and deserialize
JSON data from a backend (the main package repository, a testing
repository, etc.).

Currently, there's no data loader implemented to talk to any
HTTPS-backed repository, nor are there any classes for
managing/installing packages beyond fetching data on them. Those will
come in future changes.

Unit tests pass.

Implemented a test command locally, and used it to introspect package data.

Description From Last Updated

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Docstring?

daviddavid

How would you feel about making these arguments to __init__?

daviddavid

Some here?

daviddavid

And here?

daviddavid

And here?

daviddavid

Col: 1 W391 blank line at end of file

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbpkg/api/loaders.py
        rbpkg/api/package.py
        rbpkg/api/errors.py
        rbpkg/api/package_repo.py
        setup.py
        rbpkg/api/tests/test_package.py
    
    Ignored Files:
        rbpkg/api/__init__.py
        rbpkg/api/tests/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbpkg/api/loaders.py
        rbpkg/api/package.py
        rbpkg/api/errors.py
        rbpkg/api/package_repo.py
        setup.py
        rbpkg/api/tests/test_package.py
    
    Ignored Files:
        rbpkg/api/__init__.py
        rbpkg/api/tests/__init__.py
    
    
  2. rbpkg/api/errors.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  3. 
      
david
  1. 
      
  2. rbpkg/api/loaders.py (Diff revision 1)
     
     
    Show all issues

    Docstring?

    1. It's covered by the base class, and has nothing to add beyond that.

  3. rbpkg/api/package.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    How would you feel about making these arguments to __init__?

    1. Yeah, I'm fine with it. Initially, the design was a bit different and it didn't make sense to have __init__ take care of it (only tests would set the data outside of deserialization, and the objects were given a URL and were told to load() from it, but now we have deserialize class methods). That changed later in the development. That's why these are set up how they are.

  4. rbpkg/api/package.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Some here?

  5. rbpkg/api/package.py (Diff revision 1)
     
     
     
     
     
     
     
    Show all issues

    And here?

  6. rbpkg/api/package.py (Diff revision 1)
     
     
     
     
     
     
     
    Show all issues

    And here?

  7. 
      
chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        rbpkg/api/loaders.py
        rbpkg/api/tests/test_package_channel.py
        rbpkg/api/tests/testcases.py
        rbpkg/api/tests/test_package_rules.py
        rbpkg/api/package_bundle.py
        rbpkg/api/package_channel.py
        rbpkg/api/errors.py
        rbpkg/api/package_rules.py
        rbpkg/api/tests/test_package_release.py
        rbpkg/api/package_release.py
        rbpkg/api/package_repo.py
        setup.py
        rbpkg/api/tests/test_package_bundle.py
    
    Ignored Files:
        rbpkg/api/__init__.py
        rbpkg/api/tests/__init__.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        rbpkg/api/loaders.py
        rbpkg/api/tests/test_package_channel.py
        rbpkg/api/tests/testcases.py
        rbpkg/api/tests/test_package_rules.py
        rbpkg/api/package_bundle.py
        rbpkg/api/package_channel.py
        rbpkg/api/errors.py
        rbpkg/api/package_rules.py
        rbpkg/api/tests/test_package_release.py
        rbpkg/api/package_release.py
        rbpkg/api/package_repo.py
        setup.py
        rbpkg/api/tests/test_package_bundle.py
    
    Ignored Files:
        rbpkg/api/__init__.py
        rbpkg/api/tests/__init__.py
    
    
  2. rbpkg/api/package_rules.py (Diff revision 2)
     
     
    Show all issues
    Col: 1
     W391 blank line at end of file
    
  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbpkg/api/loaders.py
        rbpkg/api/tests/test_package_channel.py
        rbpkg/api/tests/testcases.py
        rbpkg/api/tests/test_package_rules.py
        rbpkg/api/package_bundle.py
        rbpkg/api/package_channel.py
        rbpkg/api/errors.py
        rbpkg/api/package_rules.py
        rbpkg/api/tests/test_package_release.py
        rbpkg/api/package_release.py
        rbpkg/api/package_repo.py
        setup.py
        rbpkg/api/tests/test_package_bundle.py
    
    Ignored Files:
        rbpkg/api/__init__.py
        rbpkg/api/tests/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbpkg/api/loaders.py
        rbpkg/api/tests/test_package_channel.py
        rbpkg/api/tests/testcases.py
        rbpkg/api/tests/test_package_rules.py
        rbpkg/api/package_bundle.py
        rbpkg/api/package_channel.py
        rbpkg/api/errors.py
        rbpkg/api/package_rules.py
        rbpkg/api/tests/test_package_release.py
        rbpkg/api/package_release.py
        rbpkg/api/package_repo.py
        setup.py
        rbpkg/api/tests/test_package_bundle.py
    
    Ignored Files:
        rbpkg/api/__init__.py
        rbpkg/api/tests/__init__.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed