osos.osos.Osos
- class Osos(git_owner, git_repo, pypi_name=None, conda_org=None, conda_name=None)[source]
Bases:
object
Base class to handle open source ops and statistics (osos) for a given repo/package.
- Parameters:
git_owner (str) – Github repository owner, e.g. https://github.com/{owner}/{repo}. Case insensitive.
git_repo (str) – Github repository name, e.g. https://github.com/{owner}/{repo}. Case insensitive.
pypi_name (str | None) – pypi package name. Note that this should include the prefix for nrel packages e.g. reV -> nrel-rev. This can be None if there is no pypi package. Case insensitive.
conda_org (str) – Conda organization name, for example: https://anaconda.org/{org}/{name}. Case insensitive.
conda_name (str) – Conda package name, for example: https://anaconda.org/{org}/{name}. Case insensitive.
Methods
clean_table
(table)Fill nan values and make sure the timeseries index has 14 days.
Make the usage and statistics table for the last two weeks.
run_config
(config)Run multiple osos jobs from a csv config.
update
(fpath_out)Update and save the fpath_out file.
- clean_table(table)[source]
Fill nan values and make sure the timeseries index has 14 days.
- Parameters:
table (pd.DataFrame) – Repository usage and statistics table with datetime.date index for the last two weeks including today and columns for various github and pypi usage metrics.
- Returns:
table (pd.DataFrame) – Repository usage and statistics table with datetime.date index for the last two weeks including today and columns for various github and pypi usage metrics.
- make_table()[source]
Make the usage and statistics table for the last two weeks.
- Returns:
table (pd.DataFrame) – Repository usage and statistics table with datetime.date index for the last two weeks including today and columns for various github and pypi usage metrics.
- update(fpath_out)[source]
Update and save the fpath_out file. The current update data will be used if there are duplicates.
- Parameters:
fpath_out (str) – Output file to save the osos output table. If the file exists, it will be updated with the latest data. This path can include the keywords “DATA_DIR” and “NAME” which will get replaced by the system location of the /osos/data/ directory and the github repo name, respectively.
- Returns:
table (pd.DataFrame) – osos table including the original data from fpath_out (if exists) updated with the currently available data from github and pypi. This is also saved to fpath_out.