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

Commit 0fb0d41

Browse files
committed
Finally loading Python
1 parent d804853 commit 0fb0d41

File tree

8 files changed

+54
-2
lines changed

8 files changed

+54
-2
lines changed

.gitpod.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
6+
7+
tasks:
8+
- init:
9+
- bin/setup
10+
- pyenv uninstall 3.11.1
11+
- env PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.10
12+
- pyenv global 3.10
13+
- pip install guidance
14+
15+

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.tabSize": 2
3+
}

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ gem "rubocop-minitest", "0.31.0"
99
gem "rubocop-packaging", "0.5.2"
1010
gem "rubocop-performance", "1.18.0"
1111
gem "rubocop-rake", "0.6.0"
12+
13+
gem "pycall", "~> 1.4"

README.md

+17-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
[![Gem Version](https://img.shields.io/gem/v/guidance)](https://rubygems.org/gems/guidance)
44
[![Gem Downloads](https://img.shields.io/gem/dt/guidance)](https://www.ruby-toolbox.com/projects/guidance)
55
[![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)
6-
[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/Unsupervisedcom/guideance-rails)](https://codeclimate.com/github/Unsupervisedcom/guideance-rails)
76

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

1010
---
1111

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

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

23+
```
24+
env PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.10
25+
pyenv global 3.10
26+
pip install guidance
27+
```
28+
29+
To install the gem using bundle:
30+
```
31+
bundle add guidance
32+
```
33+
34+
Via Ruby gems directly:
2035
```
2136
$ gem install guidance
2237
```

lib/guidance.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module Guidance
22
autoload :VERSION, "guidance/version"
3+
autoload :Program, "guidance/program"
34
end

lib/guidance/program.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require "pycall"
2+
3+
class Guidance::Program
4+
def initialize
5+
@guidance_library = PyCall.import_module("math")
6+
end
7+
end

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
guidance

test/guidance/program_test.rb

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require "test_helper"
2+
require "guidance"
3+
4+
class ProgramTest < Minitest::Test
5+
def test_python_library_loads
6+
Guidance::Program.new
7+
end
8+
end

0 commit comments

Comments
 (0)