howfairis package
- class howfairis.Checker(repo: Repo, user_config_filename: Optional[str] = None, repo_config_filename: str = '.howfairis.yml', ignore_repo_config: bool = False, is_quiet: bool = False)
Bases:
RepositoryMixin
,LicenseMixin
,RegistryMixin
,CitationMixin
,ChecklistMixin
Check the repo against the five FAIR software recommendations using supplied config.
- Parameters
repo – Repository to check
user_config_filename – Filename of configuration file on users local filesystem.
repo_config_filename – Filename of configuration file on the repository. Default is “.howfairis.yml”.
ignore_repo_config – If True then the configuration file on the repository is not loaded. Default is False.
is_quiet – If True then less verbose output is printed. Default is False.
Example
The registry compliance of the
https://github.com/fair-software/howfairis
repository can be checked with:>>> from howfairis import Repo, Checker >>> url = "https://github.com/fair-software/howfairis" >>> repo = Repo(url) >>> checker = Checker(repo, is_quiet=True) ... >>> compliance = checker.check_five_recommendations() >>> compliance.registry True
- repo
Object describing the properties of the target repository.
- Type
.repo.Repo
- readme
Retrieved README from the repository.
- Type
.readme.Readme
The
skip_*_checks_reason
andChecker.ignore_commented_badges
properties are set based on merger ofthe default configuration (see
howfairis/data/.howfairis.yml
),config file from repo and
config file from users local filesystem.
- check_five_recommendations() Compliance
Check the repo against the five FAIR software recommendations
Returns: compliance result
- property ignore_commented_badges: bool
If True then any commented out badges in the README of the repository are ignored.
- Type
- property skip_checklist_checks_reason: bool
If True then checks for the checklist recommendation are skipped and the recommendation is marked as compliant
- Type
- property skip_citation_checks_reason: bool
If True then checks for the citation recommendation are skipped and the recommendation is marked as compliant
- Type
- property skip_license_checks_reason: bool
If True then checks for the license recommendation are skipped and the recommendation is marked as compliant
- Type
- class howfairis.Compliance(repository: bool = False, license_: bool = False, registry: bool = False, citation: bool = False, checklist: bool = False)
Bases:
object
Compliance of a repo against the 5 FAIR software recommendations
- Parameters
repository – Whether repository is publicly accessible with version control
license – Whether repository has a license
registry – Whether code is in a registry
citation – Whether software is citable
checklist – Whether a software quality checklist is used
- COMPLIANT_SYMBOL = '●'
- NONCOMPLIANT_SYMBOL = '○'
- as_unicode() str
String representation of each 5 recommendations. Where a full dot means compliant with the recommendation and a open dot means not-compliant.
Returns: A string
- calc_badge(readme_file_format: ReadmeFormat) Optional[str]
Calculate FAIR software badge image URL and URL in format of README.
- Parameters
readme_file_format – Format of README.
- Returns
Badge image link or None when format of README is unsupported.
- color() str
Traffic light color for badge based on compliance count
- Returns
CSS friendly color name
- class howfairis.Platform(value)
Bases:
Enum
Type of code repository platform
- GITHUB = 1
- GITLAB = 2
- class howfairis.Readme(filename: Optional[str] = None, text: Optional[str] = None, file_format: Optional[ReadmeFormat] = None, ignore_commented_badges: bool = True)
Bases:
object
Container for the README of a repository
- Parameters
filename – Name of README
text – Content of README
file_format – Format of README. It is used to ignore commented out badges.
ignore_commented_badges – If False commented out badges will be considered.
- file_format
Format of README
- Type
ReadmeFormat, None
- COMPLIANT_SYMBOL = '%E2%97%8F'
this is a compliant symbol used in
get_compliance()
- NONCOMPLIANT_SYMBOL = '%E2%97%8B'
this is a non-compliant symbol used in
get_compliance()
- SEPARATOR = '%20%20'
this is a separator symbol used in
get_compliance()
- get_compliance() Optional[Compliance]
Retrieve compliance from README based on presence of the FAIR Software badge.
- Returns
Compliance object when badge is found otherwise None.
- class howfairis.Repo(url: str, branch: Optional[str] = None, path: Optional[str] = None)
Bases:
object
Representation of a source code repository.
- Parameters
url – URL of a code repository such as https://github.com/fair-software/howfairis
branch – Branch to checkout. Defaults to default branch of the repository. Can also be a commit SHA-1 hash or tag.
path – Path inside repository. Defaults to root.
- branch
Branch to checkout. If None then
Repo.default_branch
will be used.- Type
str, None
- platform
Detected code repository platform of repo.
- Type
.code_repository_platforms.Platform
Subpackages
- howfairis.cli package
- howfairis.exceptions package
- howfairis.mixins package
- howfairis.requesting package
- Submodules
- howfairis.requesting.get_from_github module
- howfairis.requesting.get_from_github_no_auth module
- howfairis.requesting.get_from_github_no_auth_api module
- howfairis.requesting.get_from_github_no_auth_frontend module
- howfairis.requesting.get_from_github_no_auth_raw module
- howfairis.requesting.get_from_github_with_auth module
- howfairis.requesting.get_from_github_with_auth_api module
- howfairis.requesting.get_from_github_with_auth_frontend module
- howfairis.requesting.get_from_github_with_auth_raw module
- howfairis.requesting.get_from_gitlab module
- howfairis.requesting.get_from_gitlab_no_auth module
- howfairis.requesting.get_from_gitlab_no_auth_api module
- howfairis.requesting.get_from_gitlab_no_auth_frontend module
- howfairis.requesting.get_from_gitlab_no_auth_raw module
- howfairis.requesting.get_from_gitlab_with_auth module
- howfairis.requesting.get_from_gitlab_with_auth_api module
- howfairis.requesting.get_from_gitlab_with_auth_frontend module
- howfairis.requesting.get_from_gitlab_with_auth_raw module
- howfairis.requesting.get_from_platform module
- Submodules
- howfairis.workarounds package