Code Monkey home page Code Monkey logo

xbundle's Introduction

xbundle

https://travis-ci.org/mitodl/xbundle.svg?branch=travis https://coveralls.io/repos/mitodl/xbundle/badge.svg?branch=master&service=github

xbundle converts back and forth between OLX and "xbundle" style XML formats. The xbundle format is a single XML file.

The OLX format is defined in this documentation.

Installation

python setup.py install

This will install xbundle and the xbundle_convert command-line tool.


Using xbundle in your code

To convert from xbundle to OLX

from xbundle import XBundle

bundle = XBundle()
# get input_path and output_path from user input
bundle.load(input_path)
bundle.export_to_directory(output_path)

To convert from OLX to xbundle

from xbundle import XBundle

bundle = XBundle()
# get input_path and output_path from user input
bundle.import_from_directory(input_path)
bundle.save(output_path)

Using the command-line tool

xbundle_convert convert /path/to/course /path/to/output.xml

or

xbundle_convert convert /path/to/output.xml /path/to/course


Run tests

xbundle_convert test

xbundle's People

Contributors

bdero avatar carsongee avatar ichuang avatar jamiefolsom avatar justinabrahms avatar noisecapella avatar pdpinch avatar shawnmilo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xbundle's Issues

fails to completely convert 2.01

Trying to convert the course at https://github.mit.edu/mitx/content-mit-201-2015_Fall

xbundle is failing to include the content within verticals, for nearly all verticals. For example:

https://github.mit.edu/mitx/content-mit-201-2015_Fall/blob/master/chapter/Week_1.xml#L2-L4

is bundled as:

<course org="MITx" course="2.01r_2" url_name_orig="2015_Fall" semester="2015_Fall">
    <chapter display_name="Week 1" url_name_orig="Week_1">
      <sequential url_name="seq_WO1" display_name="Weekly Overview">
        <vertical url_name="WO1"/>
      </sequential>

-- ignoring the contents of https://github.mit.edu/mitx/content-mit-201-2015_Fall/blob/master/vertical/WO1.xml

This may be the same root cause of this bug mitodl/lore#502

xbundle -> OLX breaks on unicode characters

This is like #14, but when converting in the other direction.

content-mit-801r
Converting edX xml directory '/home/shawn/temp/courses/content-mit-801r' to xbundle file 'content-mit-801r.xml'
Oops, failed to add file /home/shawn/temp/courses/content-mit-801r/about/overview.html, error=All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters
done
Converting xbundle file 'content-mit-801r.xml' to edX xml directory '/tmp/extracted_content-mit-801r'
course id = 8.01
Traceback (most recent call last):
  File "/home/shawn/projects/mitodl/xbundle/bin/xbundle_convert", line 69, in <module>
    main()
  File "/home/shawn/projects/mitodl/xbundle/bin/xbundle_convert", line 56, in main
    bundle.export_to_directory(outfn)
  File "/home/shawn/projects/mitodl/xbundle/xbundle/__init__.py", line 452, in export_to_directory
    self.export_meta_to_directory()
  File "/home/shawn/projects/mitodl/xbundle/xbundle/__init__.py", line 471, in export_meta_to_directory
    open(join(dir, fn), 'w').write(k.text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 1904: ordinal not in range(128)

Example:

Newton’s Laws of Motion" contains a \u2019, instead of an apostrophe.

0.3.0 Release

Includes python 3 compatibility and python 2 unicode bug fix.

Maybe also fix to #34

Test round-trip conversion with 3.091

3.091 (particularly the exam version) is an outlier among course structures. However, there is a good chance that we will want to re-use its problems using a tool like LORE.

After some very brief testing with 3.091, converting to an xbundle seems OK, but converting the bundle back to OLX does not. This needs further testing.

Note that the 3.091 course repository is not open: https://github.mit.edu/mitx/content-mit-3091r-exam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.