Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins #552

Closed
4 tasks done
pombredanne opened this issue Mar 10, 2017 · 2 comments
Closed
4 tasks done

Plugins #552

pombredanne opened this issue Mar 10, 2017 · 2 comments

Comments

@pombredanne
Copy link
Member

pombredanne commented Mar 10, 2017

We need a plugin architecture such that it is easier to add new scanners, new formats and other features in a decoupled way.

At a high level, this is similar to Firefox, Chromium or Eclipse plugins.

The goal is to create a decoupled architecture such that output formatters and scanners (and in the future deduction tools) can:

  1. be their own project/library and be plugged in ScanCode at installation time

  2. for scanners and scan "pipeline processors" , they can possibly be coded in any language beside Python with Python being a special privileged language in any case. And accept an ABC data doc in and spit an ABC data out.

See for ABCD:
https://github.com/nexB/aboutcode/blob/a84e207bbe579dd9b419cc52bbfd00239f5beeb9/aboutcode-data/README.rst

For instance for packages scanners, a plugin approach such that new package manifests parsers are implemented as external libraries, eventually using different languages than Python to reuse the many parsers natively available (Ruby, Js, Java, etc) would make a lot of sense. .

Formatter/output should be the first to be implemented as plugins for a start, then eventually all scanners and more should be implemented as plugins. See #381 for format plugins.

There stages where we can plugin things are, in this order of implementation priority:

Other points:

  • A plugin should be able to add new command line options even if minimally.

  • The ability to have plugins in other languages than Python would be great: they would be spawned in their process and receive a path to scan and/or an ABC data packet and return an ABC data packet after having done their stuff.

  • Some Python tools on Pypi such as pluggy, yapsy, stevedore and the likes as well as possible click extensions may be candidate for this.

pombredanne added a commit that referenced this issue Jul 19, 2017
Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Jul 19, 2017
 * Use a shared function fro both JSON plugins. Also rename functions
   and add some documentation.
 * Create a separate test module with its own independent test files. 

Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Jul 19, 2017
pombredanne added a commit that referenced this issue Jul 19, 2017
 * merge html and html-app in one module
 * rename functions and entry points
 * create a separate test module for these
 * rename format to temaplted for utilities shared with html and
   custom templates

Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Jul 19, 2017
 * Rename entry points
 * Refactor tests in separate modules
 * Ensure all tests pass
 * cli.py: ensure output file is opened 'wb' as unicodecsv chokes
   otherwise. Clean up imports nd refine code formatting

Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Jul 20, 2017
pombredanne added a commit that referenced this issue Jul 20, 2017
 * also move cli.py code that creates a custom output to this module
   and use a common function with the html plugin

Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Jul 20, 2017
 * rename the output module, hookspecs and entrypoint
 * expose a get_format_plugins() function as the man API for cli.py
   to use
 * remove the unused scan_proper* code
 * move all output plugin initialization code to plugincode instead of
   globals in cli.py
 * refine the --format CLI option help text 
 
Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Jul 20, 2017
pombredanne added a commit that referenced this issue Jul 20, 2017
 * otherwise there is a circular import and conflicts between imports
   and setuptools entrypoints loading

Signed-off-by: Philippe Ombredanne <[email protected]>
@pombredanne
Copy link
Member Author

with #639 we now have support for pluggable output formats. This ticket should be used to track the high level feature completion. @yashdsaraf please create separate ticket for each pluggable features (e.g. pre-scan, scan, post-scan)

pombredanne added a commit that referenced this issue Jan 17, 2018
 * A scan plugin handles the scan of one resource at a time
 * Existing scans have been reworked as plugins

Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit that referenced this issue Jan 17, 2018
This is a major update of the code scancode processing. 
The scancode CLI has been reworked such that:

   * each plugin can have as many options as needed
   * plugins are organizaed by stages. New stages have been added
     for output_filter, scan and housekeeping
   * plugins work on a Codebase or a Resource which is an in-memory
     representation of a scanned filesystem

Signed-off-by: Philippe Ombredanne <[email protected]>
@pombredanne
Copy link
Member Author

With the latest merge of #885 this concludes the creation of plugins! Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants