Skip to content

Commit

Permalink
Merge pull request #1 from d-chambers/gh-actions
Browse files Browse the repository at this point in the history
Gh actions
  • Loading branch information
d-chambers authored Apr 24, 2020
2 parents f2878d4 + b4a83ea commit 7581ef1
Show file tree
Hide file tree
Showing 8 changed files with 384 additions and 97 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*~
\#*
.#*
*.egg-info/
*.exp
*.lib
*.obj
*.pyc
*.pyd.manifest
*.pyo
.cache
.DS_Store
.idea
.project
.pydevproject
/.settings
build/
dist/
__pycache__
debian
# Temporary dir for the anaconda builds.
misc/installer/anaconda/conda_builds
.vscode/**
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# obspy_github_api
Helper routines to interact with obspy/obspy via GitHub API

## Quick start

The easiest way to use obspy_github_api is via its command line interface.

```shell script
# Use the magic strings found in issue 101's comments to create a config file
obshub make_config 101 --path obspy_config.json

# Read a specified option.
obshub read_config_value module_list --path obspy_config.json

# Use a value in the config in another command line utility.
export BUILDDOCS=`bshub read_config_value module_list --path obspy_config.json`
some-other-command --docs $BUILDDOCS
```

## Release Versions

Release versions are done from separate branches, see https://github.com/obspy/obspy_github_api/branches.
Expand Down
2 changes: 1 addition & 1 deletion obspy_github_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
from .obspy_github_api import *

__version__ = '0.0.0.dev'
__version__ = "0.0.0.dev"
52 changes: 52 additions & 0 deletions obspy_github_api/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
Command line Interface for obspy_github_api
"""
import json
from typing import Optional

import typer

from obspy_github_api.obspy_github_api import make_ci_json_config

app = typer.Typer()

DEFAULT_CONFIG_PATH = "obspy_config/conf.json"


@app.command()
def make_config(
issue_number: int, path: str = DEFAULT_CONFIG_PATH, token: Optional[str] = None
):
"""
Create ObsPy's configuration json file for a particular issue.
This command parses the comments in an issue's text looking for any magic
strings (defined in ObsPy's issue template) and stores the values assigned
to them to a json file for later use.
The following names are stored in the config file:
module_list - A string of requested modules separated by commas.
module_list_spaces - A string of requested modules separated by spaces.
docs - True if a doc build is requested.
"""
make_ci_json_config(issue_number, path=path, token=token)


@app.command()
def read_config_value(name: str, path: str = DEFAULT_CONFIG_PATH):
"""
Read a value from the configuration file.
"""
with open(path, "r") as fi:
params = json.load(fi)
value = params[name]
print(value)
return value


def main():
app()


if __name__ == "__main__":
main()
Loading

0 comments on commit 7581ef1

Please sign in to comment.