Skip to content
This repository has been archived by the owner on Aug 4, 2024. It is now read-only.

Commit

Permalink
Finally loading Python
Browse files Browse the repository at this point in the history
  • Loading branch information
nhorton committed Jul 29, 2023
1 parent d804853 commit 0fb0d41
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- init:
- bin/setup
- pyenv uninstall 3.11.1
- env PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.10
- pyenv global 3.10
- pip install guidance


3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.tabSize": 2
}
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ gem "rubocop-minitest", "0.31.0"
gem "rubocop-packaging", "0.5.2"
gem "rubocop-performance", "1.18.0"
gem "rubocop-rake", "0.6.0"

gem "pycall", "~> 1.4"
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[![Gem Version](https://img.shields.io/gem/v/guidance)](https://rubygems.org/gems/guidance)
[![Gem Downloads](https://img.shields.io/gem/dt/guidance)](https://www.ruby-toolbox.com/projects/guidance)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Unsupervisedcom/guideance-rails/ci.yml)](https://github.com/Unsupervisedcom/guideance-rails/actions/workflows/ci.yml)
[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/Unsupervisedcom/guideance-rails)](https://codeclimate.com/github/Unsupervisedcom/guideance-rails)

TODO: Description of this gem goes here.
This Gem wraps https://github.com/microsoft/guidance for use in Ruby.
See documentation at in the Guidance repo for info on how to use it.

---

Expand All @@ -16,7 +16,22 @@ TODO: Description of this gem goes here.
- [Contribution guide](#contribution-guide)

## Quick start
This requires a version of python that includes the library version.
Development has been done using 3.10.9 which can be installed with the below.
You must also install Guidance.

```
env PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.10
pyenv global 3.10
pip install guidance
```

To install the gem using bundle:
```
bundle add guidance
```

Via Ruby gems directly:
```
$ gem install guidance
```
Expand Down
1 change: 1 addition & 0 deletions lib/guidance.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module Guidance
autoload :VERSION, "guidance/version"
autoload :Program, "guidance/program"
end
7 changes: 7 additions & 0 deletions lib/guidance/program.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "pycall"

class Guidance::Program
def initialize
@guidance_library = PyCall.import_module("math")
end
end
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
guidance
8 changes: 8 additions & 0 deletions test/guidance/program_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "test_helper"
require "guidance"

class ProgramTest < Minitest::Test
def test_python_library_loads
Guidance::Program.new
end
end

0 comments on commit 0fb0d41

Please sign in to comment.