Opened 6 years ago

Closed 4 years ago

#10411 closed enhancement (implemented)

Downloadable tutorial examples

Reported by: atagar Owned by: atagar
Priority: Low Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords: website
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Markus makes the good point that it would be nice for visitors to be able to download example.py source files for our tutorial examples. The trick with this will be to avoid duplicating the code. Ideally, we'd have a directory with tutorial examples and they'd be injected into the ReST as part of the build process.

Child Tickets

Attachments (1)

0001-Added-downloadable-tutorial-example-for-tutorial-The.patch (2.2 KB) - added by sambuddhabasu 4 years ago.
Downloadable tutorial example for tutorial The Little Relay that Could

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by sambuddhabasu

If currently no one is working on this, I would like to fix this.

comment:2 Changed 4 years ago by atagar

That's great, thanks! Please keep in mind that the main trick behind this is doing something smart. The simple solution (make a copy of the tutorial example code) is easy, but unmaintainable. Rather, we'll want something smart to happen when you type 'make html' to build the site.

comment:3 Changed 4 years ago by sambuddhabasu

Yes, just making a simple copy of the tutorial example is not a good thing to do. This way, whenever we change the example, we have to change the copy too.

As the ticket description says, I was thinking about having the code in one file and once we 'make html', the code will be read from that file and added to the .html files.

comment:4 Changed 4 years ago by atagar

Great, sounds perfect! Depending on how this is implemented this might address #10036 too since our unit tests could read examples from the file and exercise them with eval().

Changed 4 years ago by sambuddhabasu

Downloadable tutorial example for tutorial The Little Relay that Could

comment:5 Changed 4 years ago by sambuddhabasu

I have added the downloadable option for all the tutorials and it can be seen at https://github.com/sammyshj/stem/pull/3
If the code looks good, I will squash the commits into one and attach the final patch to this ticket.
Thanks

comment:6 Changed 4 years ago by atagar

Resolution: implemented
Status: newclosed

Fantastic work, Sambuddha! No need to squash 'em down, I went ahead and merged your branch as-is. Nice direction from here would be for our test/unit/tutorial.py to exec() these rather than bundle a duplicate, but that can be on another ticket.

Nice work!

Note: See TracTickets for help on using tickets.