diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 0000000..31c04fd --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,57 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize] + # Optional: Only run on specific file changes + # paths: + # - "src/**/*.ts" + # - "src/**/*.tsx" + # - "src/**/*.js" + # - "src/**/*.jsx" + +jobs: + claude-review: + # Optional: Filter by PR author + # if: | + # github.event.pull_request.user.login == 'external-contributor' || + # github.event.pull_request.user.login == 'new-developer' || + # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' + + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code Review + id: claude-review + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + + Please review this pull request and provide feedback on: + - Code quality and best practices + - Potential bugs or issues + - Performance considerations + - Security concerns + - Test coverage + + Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback. + + Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR. + + # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md + # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options + claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' + diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..b1a3201 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,50 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + actions: read # Required for Claude to read CI results on PRs + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # This is an optional setting that allows Claude to read CI results on PRs + additional_permissions: | + actions: read + + # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. + # prompt: 'Update the pull request description to include a summary of changes.' + + # Optional: Add claude_args to customize behavior and configuration + # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md + # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options + # claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)' + diff --git a/README.rst b/README.rst index b857efd..e69de29 100644 --- a/README.rst +++ b/README.rst @@ -1,91 +0,0 @@ -bashplotlib -=========== - -*plotting in the terminal* - -what is it? ------------ - -bashplotlib is a python package and command line tool for making basic -plots in the terminal. It's a quick way to visualize data when you don't -have a GUI. It's written in pure python and can quickly be installed -anywhere using pip. - -installation ------------- - -install with pip -~~~~~~~~~~~~~~~~ - -:: - - $ pip install bashplotlib - -install from source -~~~~~~~~~~~~~~~~~~~ - -:: - - $ git clone git@github.com:glamp/bashplotlib.git - $ cd bashplotlib - $ python setup.py install - -Either method will install the bashplotlib python package and will also -add hist and scatter to your python scripts folder. This folder should -be on your path (add it if it's not). - -features --------- - -- quick plotting from the command line -- customize the color, size, title, and shape of plots -- pipe data into plots with stdin - -usage ------ - -command line -~~~~~~~~~~~~ - -hist takes input from either stdin or specified using the -f parameter. -Input should be a single column of numbers. scatter takes x and y -coordinates as input form either a comma delimited file using -f or from -2 different files using -x and -y. - -in python -~~~~~~~~~ - -If you want to use bashplotlib from python, just import histogram and -scatterplot. - -:: - - from bashplotlib.scatterplot import plot_scatter - -:: - - from bashplotlib.histogram import plot_hist - -examples --------- - -:: - - $ scatter --file data/texas.txt --pch . - -:: - - $ hist --file data/exp.txt - -:: - - $ scatter -x data/x_test.txt -y data/y_test.txt - -todo ----- - -- sideways numbers for x-axis of histograms -- colors for individual points -- line charts -- trendlines - diff --git a/bashplotlib/scatterplot.py b/bashplotlib/scatterplot.py index 69cab9d..9261833 100644 --- a/bashplotlib/scatterplot.py +++ b/bashplotlib/scatterplot.py @@ -34,7 +34,7 @@ def _plot_scatter(xs, ys, size, pch, colour, title, cs): if title: print(box_text(title, 2 * (len(get_scale(xs, False, size)) + 1))) - print("-" * (2 * (len(get_scale(xs, False, size)) + 2))) + print("+" + ("-" * (2 * (len(get_scale(xs, False, size)) + 1))) + "+") for y in get_scale(ys, True, size): print("|", end=' ') for x in get_scale(xs, False, size): @@ -47,7 +47,7 @@ def _plot_scatter(xs, ys, size, pch, colour, title, cs): colour = cs[i] printcolour(point + " ", True, colour) print(" |") - print("-" * (2 * (len(get_scale(xs, False, size)) + 2))) + print("+" + ("-" * (2 * (len(get_scale(xs, False, size)) + 1))) + "+") def plot_scatter(f, xs, ys, size, pch, colour, title): """ diff --git a/bashplotlib/utils/helpers.py b/bashplotlib/utils/helpers.py index cf209ee..9e6492b 100644 --- a/bashplotlib/utils/helpers.py +++ b/bashplotlib/utils/helpers.py @@ -80,7 +80,7 @@ def box_text(text, width, offset=0): """ Return text inside an ascii textbox """ - box = " " * offset + "-" * (width+2) + "\n" + box = " " * offset + "+" + "-" * (width) + "+" + "\n" box += " " * offset + "|" + text.center(width) + "|" + "\n" - box += " " * offset + "-" * (width+2) + box += " " * offset + "+" + "-" * (width) + "+" return box diff --git a/scratch.py b/scratch.py new file mode 100644 index 0000000..b671c71 --- /dev/null +++ b/scratch.py @@ -0,0 +1,18 @@ +# scratch.py +from bashplotlib.scatterplot import plot_scatter + +x_coords = [-10,20,30] +y_coords = [-10,20,30] +width = 10 +char = 'x' +color = 'default' +title = 'My Test Graph' + +plot_scatter( + None, + x_coords, + y_coords, + width, + char, + color, + title)