epythet.tools.published_docs

Elements for a tool to setup docs and check if docs are published, and if not, why.

>>> from epythet.tools.published_docs import published_doc_diagnosis_df
>>> published_doc_diagnosis_df('https://github.com/i2mint/epythet')  
                                 url                      doc_page_url  doc_page_exists  repo_has_docs_folder
0  https://github.com/i2mint/epythet  https://i2mint.github.io/epythet             True                  True
>>> published_doc_diagnosis_df([  
...     'https://github.com/i2mint/epythet', 'https://github.com/otosense/omisc',
... ])
                                 url                      doc_page_url  doc_page_exists  repo_has_docs_folder
0  https://github.com/i2mint/epythet  https://i2mint.github.io/epythet             True                  True
1  https://github.com/otosense/omisc  https://otosense.github.io/omisc            False                 False
epythet.tools.published_docs.branch_exists(repo_stub: str, branch: str, *, headers: dict | ~typing.Callable[[], dict] = <function dflt_headers>)[source]

Check if a branch exists in a repo.

Parameters:
  • repo_stub – A string of the form org/repo.

  • branch – The branch name to check for.

  • headers – A function that returns a dictionary of headers

epythet.tools.published_docs.configure_github_pages(repo_stub: str, *, target_branch='gh-pages', folder='/', headers: dict | ~typing.Callable[[], dict] = <function dflt_headers>)[source]

Configure or update GitHub Pages for a repo.

Example:

>>> configure_github_pages('i2mint/epythet')  
epythet.tools.published_docs.github_org_and_repo(github_url)[source]
>>> github_org_and_repo('https://github.com/i2mint/i2')
{'org': 'i2mint', 'repo': 'i2'}
epythet.tools.published_docs.published_doc_diagnosis_df(urls: str | Iterable[str] | Iterable[Iterable] = 'https://raw.githubusercontent.com/otosense/content/main/tables/projects.csv', url_column='url')[source]

The published_doc_diagnosis_df gets you a pandas dataframe (requires pandas to be installed!) that will tell you if given github org/repo url(s) have published documentation and if a docs folder even exists (in master branch).

Parameters:
  • urls – A list of urls, a table containing urls, or a single url pointing to a csv where this table can be downloaded from.

  • url_column – When urls is a table, what column name contains the urls.

Returns:

A dataframe with the diagnosis

epythet.tools.published_docs.repo_url_to_docs_url(repo_url)[source]
>>> repo_url_to_docs_url('https://github.com/i2mint/i2')
'https://i2mint.github.io/i2'
epythet.tools.published_docs.repo_url_to_repo_docs_url(repo_url)[source]
>>> repo_url_to_repo_docs_url('https://github.com/i2mint/i2')
'https://github.com/i2mint/i2/tree/master/docs'