Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-11 Thread Ryan Culpepper

On 3/10/19 4:16 PM, Matt Jadud wrote:

Oh! Thank you, Matthew.

I see. So, I'm running into the sandbox... as in, the sandbox is doing 
what it should, and as a result, it is preventing the networked accesses 
that I've added to my documentation. That's awfully obvious (now that it 
is put that way), but it wasn't obvious from the error message.


I'll think about faking it for doc build. I'll add it to the issue 
tracker for the package. I'm still learning basic things about 
scribbling docs, but will likely stub something in to simplify the doc 
build at some point. Thanks, Robby.


You might find `make-log-based-eval` useful for writing your examples. 
It lets you run the examples once (for example, on your development 
machine where your credentials are installed, etc) and save the results, 
so other people can build the docs using the recorded interactions.


For example, it's used by the db library documentation; see config.rkt 
(defines `make-pg-eval` using `make-log-based-eval`) and using-db.scrbl 
(uses `make-pg-eval`, `interaction`, and `eval:alts`) in 
https://github.com/racket/db/blob/master/db-doc/db/scribblings/.


Ryan

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-10 Thread Matt Jadud
Oh! Thank you, Matthew.

I see. So, I'm running into the sandbox... as in, the sandbox is doing what
it should, and as a result, it is preventing the networked accesses that
I've added to my documentation. That's awfully obvious (now that it is put
that way), but it wasn't obvious from the error message.

I'll think about faking it for doc build. I'll add it to the issue tracker
for the package. I'm still learning basic things about scribbling docs, but
will likely stub something in to simplify the doc build at some point.
Thanks, Robby.

Cheers,
M



On Sun, Mar 10, 2019 at 10:57 AM Robby Findler 
wrote:

> For the purposes of documentation building however, does it perhaps make
> sense to fake then actual network connection?
>
> Robby
>
> On Sun, Mar 10, 2019 at 9:48 AM Matthew Flatt  wrote:
>
>> Use `call-with-trusted-sandbox-configuration` around the creation of
>> the evaluator. It's painful and unlikely to be worthwhile to give a
>> documentation sandbox limited (but workable) access to the filesystem.
>>
>> At Sun, 10 Mar 2019 10:29:15 -0400, Matt Jadud wrote:
>> > Hi all,
>> >
>> > I am trying to get sandboxed evaluation of code working in my scribble
>> > docs, and am having trouble.
>> >
>> > At the top of a scribble file, I have
>> >
>> > --- PASTE ---
>> > #lang scribble/manual
>> > @(require scribble/example
>> >   racket/sandbox
>> >   )
>> > --- ENDPASTE ---
>> >
>> > This file is a section that is being included into the top-level
>> > manual.scrbl.
>> >
>> > And, in the body of the included file, I have
>> >
>> > --- PASTE ---
>> > @(define my-evaluator
>> >(parameterize ([sandbox-output 'string]
>> >   [sandbox-error-output 'string]
>> >   [sandbox-memory-limit 50])
>> >  (make-evaluator 'racket
>> >  #:requires '(data-table
>> >
>> > @examples[#:eval my-evaluator
>> >   ; A remote Google Spreadsheet that we want to manipulate
>> >   (define test-url "http://bit.ly/2E2qZoI;)
>> >
>> >   ; Fetch the URL, and turn it into a table named "Testing"
>> >   (define fetched (read-gsheet "Testing" test-url))
>> >
>> >   ; Select all of the rows where the "age" column is greater
>> than 6.
>> >   (sieve fetched (> age 6))
>> >   ]
>> > --- ENDPASTE ---
>> >
>> > However, when I include this code, I get the following:
>> >
>> > --- PASTE ---
>> >
>> > raco setup: 3 running: /data-table/scribblings/manual.scrbl
>> >
>> > with-input-from-file: `read' access denied for
>> > /Users/mjadud/Library/Racket/7.2/share/info-cache.rktd
>> >
>> >   context...:
>> >
>> >/Applications/racket720/collects/setup/getinfo.rkt:231:4: for-loop
>> >
>> >/Applications/racket720/collects/setup/getinfo.rkt:221:0:
>> populate-table!
>> >
>> >/Applications/racket720/collects/setup/getinfo.rkt:289:0:
>> > find-relevant-directory-records23
>> >
>> >/Applications/racket720/collects/setup/getinfo.rkt:286:0:
>> > find-relevant-directories
>> >
>> >"/Users/mjadud/Library/Racket/7.2/pkgs/tzinfo/tzinfo/zoneinfo.rkt":
>> > [running body]
>> >
>> > --- ENDPASTE ---
>> >
>> >
>> > I can get things to build if I leave this file out.
>> >
>> > I can get things to build if I leave out the evaluator and sandboxed
>> > evaluation.
>> >
>> > Therefore, I think I have something wrong with how I'm setting up this
>> > evaluator, but I'm not sure how yet to fix the error I've encountered.
>> >
>> > Any insights would be appreciated.
>> >
>> > Cheers,
>> > Matt
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to racket-users+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-10 Thread Robby Findler
For the purposes of documentation building however, does it perhaps make
sense to fake then actual network connection?

Robby

On Sun, Mar 10, 2019 at 9:48 AM Matthew Flatt  wrote:

> Use `call-with-trusted-sandbox-configuration` around the creation of
> the evaluator. It's painful and unlikely to be worthwhile to give a
> documentation sandbox limited (but workable) access to the filesystem.
>
> At Sun, 10 Mar 2019 10:29:15 -0400, Matt Jadud wrote:
> > Hi all,
> >
> > I am trying to get sandboxed evaluation of code working in my scribble
> > docs, and am having trouble.
> >
> > At the top of a scribble file, I have
> >
> > --- PASTE ---
> > #lang scribble/manual
> > @(require scribble/example
> >   racket/sandbox
> >   )
> > --- ENDPASTE ---
> >
> > This file is a section that is being included into the top-level
> > manual.scrbl.
> >
> > And, in the body of the included file, I have
> >
> > --- PASTE ---
> > @(define my-evaluator
> >(parameterize ([sandbox-output 'string]
> >   [sandbox-error-output 'string]
> >   [sandbox-memory-limit 50])
> >  (make-evaluator 'racket
> >  #:requires '(data-table
> >
> > @examples[#:eval my-evaluator
> >   ; A remote Google Spreadsheet that we want to manipulate
> >   (define test-url "http://bit.ly/2E2qZoI;)
> >
> >   ; Fetch the URL, and turn it into a table named "Testing"
> >   (define fetched (read-gsheet "Testing" test-url))
> >
> >   ; Select all of the rows where the "age" column is greater
> than 6.
> >   (sieve fetched (> age 6))
> >   ]
> > --- ENDPASTE ---
> >
> > However, when I include this code, I get the following:
> >
> > --- PASTE ---
> >
> > raco setup: 3 running: /data-table/scribblings/manual.scrbl
> >
> > with-input-from-file: `read' access denied for
> > /Users/mjadud/Library/Racket/7.2/share/info-cache.rktd
> >
> >   context...:
> >
> >/Applications/racket720/collects/setup/getinfo.rkt:231:4: for-loop
> >
> >/Applications/racket720/collects/setup/getinfo.rkt:221:0:
> populate-table!
> >
> >/Applications/racket720/collects/setup/getinfo.rkt:289:0:
> > find-relevant-directory-records23
> >
> >/Applications/racket720/collects/setup/getinfo.rkt:286:0:
> > find-relevant-directories
> >
> >"/Users/mjadud/Library/Racket/7.2/pkgs/tzinfo/tzinfo/zoneinfo.rkt":
> > [running body]
> >
> > --- ENDPASTE ---
> >
> >
> > I can get things to build if I leave this file out.
> >
> > I can get things to build if I leave out the evaluator and sandboxed
> > evaluation.
> >
> > Therefore, I think I have something wrong with how I'm setting up this
> > evaluator, but I'm not sure how yet to fix the error I've encountered.
> >
> > Any insights would be appreciated.
> >
> > Cheers,
> > Matt
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-10 Thread Matthew Flatt
Use `call-with-trusted-sandbox-configuration` around the creation of
the evaluator. It's painful and unlikely to be worthwhile to give a
documentation sandbox limited (but workable) access to the filesystem.

At Sun, 10 Mar 2019 10:29:15 -0400, Matt Jadud wrote:
> Hi all,
> 
> I am trying to get sandboxed evaluation of code working in my scribble
> docs, and am having trouble.
> 
> At the top of a scribble file, I have
> 
> --- PASTE ---
> #lang scribble/manual
> @(require scribble/example
>   racket/sandbox
>   )
> --- ENDPASTE ---
> 
> This file is a section that is being included into the top-level
> manual.scrbl.
> 
> And, in the body of the included file, I have
> 
> --- PASTE ---
> @(define my-evaluator
>(parameterize ([sandbox-output 'string]
>   [sandbox-error-output 'string]
>   [sandbox-memory-limit 50])
>  (make-evaluator 'racket
>  #:requires '(data-table
> 
> @examples[#:eval my-evaluator
>   ; A remote Google Spreadsheet that we want to manipulate
>   (define test-url "http://bit.ly/2E2qZoI;)
> 
>   ; Fetch the URL, and turn it into a table named "Testing"
>   (define fetched (read-gsheet "Testing" test-url))
> 
>   ; Select all of the rows where the "age" column is greater than 6.
>   (sieve fetched (> age 6))
>   ]
> --- ENDPASTE ---
> 
> However, when I include this code, I get the following:
> 
> --- PASTE ---
> 
> raco setup: 3 running: /data-table/scribblings/manual.scrbl
> 
> with-input-from-file: `read' access denied for
> /Users/mjadud/Library/Racket/7.2/share/info-cache.rktd
> 
>   context...:
> 
>/Applications/racket720/collects/setup/getinfo.rkt:231:4: for-loop
> 
>/Applications/racket720/collects/setup/getinfo.rkt:221:0: populate-table!
> 
>/Applications/racket720/collects/setup/getinfo.rkt:289:0:
> find-relevant-directory-records23
> 
>/Applications/racket720/collects/setup/getinfo.rkt:286:0:
> find-relevant-directories
> 
>"/Users/mjadud/Library/Racket/7.2/pkgs/tzinfo/tzinfo/zoneinfo.rkt":
> [running body]
> 
> --- ENDPASTE ---
> 
> 
> I can get things to build if I leave this file out.
> 
> I can get things to build if I leave out the evaluator and sandboxed
> evaluation.
> 
> Therefore, I think I have something wrong with how I'm setting up this
> evaluator, but I'm not sure how yet to fix the error I've encountered.
> 
> Any insights would be appreciated.
> 
> Cheers,
> Matt
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.