spyce 1.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new64

Spyce #

Pub

Overview #

Spyce is a data collection framework for general purpose. The framework implements high-performance asynchronous pipeline scheduling and exposes an easy-to-use interface. It can be used for a wide range of purposes, from data mining to monitoring and automated testing.

The name "Spyce" originates from Japanese anime television series "Release the Spyce".

1.0.0 #

  • Initial version

1.1.0 #

  • Add experimental distributed computing support

example/spyce_example.dart

import 'dart:convert';

import 'package:http/http.dart' as http;
import 'package:spyce/spyce.dart';

class Languages extends Job {
  final type = 'Languages';
  static const decoder = JsonDecoder();
  String owner, repo;

  Languages(this.owner, this.repo)
      : super('https://api.github.com/repos/$owner/$repo/languages');

  @override
  Stream<Pipeline> exec(Service service) async* {
    var languages = decoder.convert((await service['http'].get(name)).body);
    print(languages);
  }

  @override
  Map<String, dynamic> toJson() {
    return {'name': name, 'owner': owner, 'repo': repo};
  }

  Languages.fromJson(Map<String, dynamic> obj)
      : owner = obj['owner'],
        repo = obj['repo'],
        super(
          'https://api.github.com/repos/${obj['owner']}/${obj['repo']}/languages');
}

class NewPipeline extends Pipeline {
  final type = 'NewPipeline';
  final owner, repos;

  NewPipeline(String name, this.owner, this.repos)
      : super.fromJobs(name, () sync* {
    for (var repo in repos) {
      yield Languages(owner, repo['name']);
    }
  }());

  @override
  Map<String, dynamic> toJson() {
    return {'name': name, 'owner': owner, 'repos': repos};
  }

  NewPipeline.fromJson(Map<String, dynamic> obj)
      : owner = obj['owner'],
        repos = obj['repos'],
        super.fromJobs(obj['name'], () sync* {
        for (var repo in obj['repos']) {
          yield Languages(obj['owner'], repo['name']);
        }
      }());
}

class Repos extends Job {
  final type = 'Repos';
  static const decoder = JsonDecoder();
  String owner;

  Repos(this.owner) : super('https://api.github.com/users/$owner/repos');

  @override
  Stream<Pipeline> exec(Service service) async* {
    var repos = decoder.convert((await service['http'].get(name)).body);
    yield NewPipeline(name, owner, repos);
  }

  @override
  Map<String, dynamic> toJson() {
    return {'name': name, 'owner': owner};
  }

  Repos.fromJson(Map<String, dynamic> obj)
      : owner = obj['owner'],
        super('https://api.github.com/users/${obj['owner']}/repos');
}

Future<void> main(List<String> args) async {
  if (args.isEmpty && args[0] != 'server' && args[1] != 'client') {
    print('server or client');
    return;
  }
  if (args[0] == 'server') {
    var spyce = Spyce('spyce');
    var runner = RemoteRunner('localhost:8080', 2, '127.0.0.1', 8080);
    runner.addPipeline('NewPipeline', NewPipeline);
    spyce.addRunner(runner);
    spyce.dumpStream.listen(print);
    spyce.logStream.listen(print);
    spyce.addPipeline(Pipeline.fromJob(Repos('github')));
  } else {
    var service = Service();
    service['http'] = http.Client();
    var runner = Runner('runner', service, 2);
    var spyce = RemoteSpyce(runner);
    spyce.addJob('Repos', Repos);
    spyce.addJob('Languages', Languages);
    await spyce.start(8080);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  spyce: ^1.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:spyce/spyce.dart';
  
Version Uploaded Documentation Archive
1.1.0 Apr 11, 2019 Go to the documentation of spyce 1.1.0 Download spyce 1.1.0 archive
1.0.2 Apr 9, 2019 Go to the documentation of spyce 1.0.2 Download spyce 1.0.2 archive
1.0.1 Apr 8, 2019 Go to the documentation of spyce 1.0.1 Download spyce 1.0.1 archive
1.0.0+1 Apr 7, 2019 Go to the documentation of spyce 1.0.0+1 Download spyce 1.0.0+1 archive
1.0.0 Apr 6, 2019 Go to the documentation of spyce 1.0.0 Download spyce 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
28
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Apr 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: other

Primary library: package:spyce/spyce.dart with components: io, mirrors.

Health issues and suggestions

Document public APIs. (-0.50 points)

58 out of 59 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/src/runner.dart.

Run dartfmt to format lib/src/runner.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
grpc ^1.0.2 1.0.2
protobuf ^0.13.9 0.13.11
Transitive dependencies
async 2.2.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
fixnum 0.10.9
googleapis_auth 0.2.7
http2 1.0.0
http_parser 3.1.3
meta 1.1.7
path 1.6.2
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
http ^0.12.0+2 0.12.0+2
pedantic ^1.0.0 1.5.0
test ^1.0.0