rse.main package — The Research Software Encyclopedia 11 documentation

# rse.main package

## Subpackages

- rse.main.config package
  - Module contents
- rse.main.database package
  - Submodules
  - rse.main.database.base module
  - rse.main.database.filesystem module
  - rse.main.database.models module
  - rse.main.database.relational module
  - rse.main.database.sqlite module
  - Module contents
- rse.main.parsers package
  - Submodules
  - rse.main.parsers.base module
  - rse.main.parsers.github module
  - Module contents

## Submodules

## rse.main.criteria module

Copyright (C) 2020 Vanessa Sochat.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

rse.main.criteria.get_criteria()

  Get criteria from the default endpoint.

## rse.main.taxonomy module

Copyright (C) 2020 Vanessa Sochat.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

rse.main.taxonomy.get_taxonomy()

  Get taxonomy from the default endpoint.

## Module contents

Copyright (C) 2020 Vanessa Sochat.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

class rse.main.Encyclopedia(config_file=None, database=None, generate=False)

  Bases: `object`

  An encyclopedia is one or more namespaces to store research software. By default, we create a structure on the filesystem, however an sqlite database (or other) can be used.

  add(uid, quiet=False)

    A wrapper to add a repository to the software database.

  analyze(repo, cthresh=0.5, tthresh=1, taxonomy_uids=None, criteria_uids=None)

    analyze takes a repository and calculates a “final answer” based on user provided thresholds

  analyze_bulk(cthresh=0.5, tthresh=1, taxonomy_uids=None, criteria_uids=None, include_empty=False)

    analyze takes a repository and calculates a “final answer” based on user provided thresholds

  annotate(username, atype, unseen_only=True, repo=None, save=False)

    Annotate the encyclopedia, either for criteria or taxonomy. A username is required for the namespace.

    Arguments:

      - username (str) : the user’s GitHub username

      - atype (str) : the annotation type

      - unseen_only (bool): annotate only items not seen by username

      - repo (str) : annotate a particular software repository

  annotate_criteria(username, unseen_only=True, repo=None, save=False)

    Annotate criteria, meaning we iterate over repos and criteria that match the user request, namely to annotate unseen only, or just a particular repository. If the repository is specified, unseen_only is assumed False.

  annotate_taxonomy(username, unseen_only=True, repo=None, save=False)

    Annotate taxonomy, meaning we iterate over repos and criteria that match the user request, namely to annotate unseen only, or just a particular repository. If the repository is specified, unseen_only is assumed False.

  bulk_add(filename)

    Given a filename with a single list of repos, add each

  bulk_update(filename, rewrite=False)

    Given a filename with a single list of repos, add each

  clear(target=None, noprompt=False)

    clear takes a target, and that can be a uid, parser, or none We ask the user for confirmation.

  exists(uid)

    based on a parser type and unique identifier, determine if software exists in the database

  get(uid=None)

    A wrapper to get a repo id from the database. If an id is not provided, will return the last updated repo based on timestamp of file or database.

  get_or_create(uid)
  import_criteria_annotation(input_file, username)

    Given a text file that has a bullet list of (some checked) criteria as might be generated in a GitHub issue, read in the file and the username to do an annotation. If a user has already done an annotation, his or her record is updated.

  import_taxonomy_annotation(input_file, username)

    Given a text file that has a bullet list of (some checked) criteria as might be generated in a GitHub issue, read in the file and the username to do an annotation. If a user has already done an annotation, his or her record is updated.

  initdb(database)

    setup the rse home (where the config directory is stored) and the database specification. If a database string is required (and not provided) alert the user and exit on error).

    Arguments:

      - config_dir (str) : the configuration directory (home for rse)

      - database (str) : a string to specify the database setup

  label(uid, key, value, force=False)

    Update an existing software repository with a specific label.

  list(name=None)

    A wrapper to the database list_repos function. Optionally take a whole parser name (e.g., github) or just a specific uid. No parser indicates that we list everything.

  list_criteria()

    Get a listing of criteria from the rse API

  list_taxonomy()

    Get a listing of a flattened taxonomy from the rse API

  repos_by_topics(topics)

    return a list of unique topics, optionally matching a pattern

  save_criteria(repo)

    Given a repository that can be a handle to a filesystem entry or database, save the criteria

  save_taxonomy(repo, username, uids)

    Given a repository that can be a handle to a filesystem entry or database, save the criteria

  search(query, taxonomy=None, criteria=None)

    Search across commands and general metadata for a string of interest. We use regular expressions (re.search) so they are supported. Search is only available for non-filesystem databases.

  summary(repo=None)

    Summarize metrics for the entire database if uid is not defined, or one specific repository.

  topics(pattern=None)

    return a list of unique topics, optionally matching a pattern

  update(uid, rewrite=False)

    Update an existing software repository.

  yield_criteria_annotation_repos(username, unseen_only=True, repo=None)

    Given a username, repository, and preference for seen / unseen, yield a repository to annotate.

  yield_taxonomy_annotation_repos(username, unseen_only=True, repo=None)

    Given a username, repository, and preference for seen / unseen, yield a repository to annotate.