Add 'pip install pypeg2' to documentation page

Issue #30 closed
Michael Jones
created an issue


I wanted to try pypeg2 for a project but I struggled to figure out how to install it because I thought that pip install pypeg would work but it doesn't as it requires pip install pypeg2.

I wanted to make a pull request with an Installation section added to the documentation to make it nice and clear for new people but I now can't figure out how to install your YML library. I've downloaded the tar ball as it doesn't seem to be on PyPI but your tarball doesn't have a file which makes it super hard to install it :)

I like the look of pypeg2. I wanted to try to use it for attempting to add a JSX style syntax to Python files. Do you think it would be suitable for this? For parsing something like:

def render(args):
    return <div>
              <p>My paragraph</p>

I do not having any experience with parsing. I am asking here because I can't find a mailing list for pypeg2 or any other place to ask.

Any help would be much appreciated, Michael

Comments (5)

  1. Michael Jones reporter

    I've been playing around with pypeg2. I'm really enjoying it. Thanks for the great project. I've got something working as a basic proof of concept for my JSX-in-python thing. The compose stuff is great, it plays really well with my use case.

    I felt I had to write my own custom parsing method to do matching tags as I couldn't see anything about back-references or repeat patterns but that was easy too. I think maybe the compose method is best as a bound instance method rather than a class method as the docs indicate? I might be wrong though.

    Thanks again, Michael

  2. Volker Birk repo owner

    Hi, Michael,

    first: I like seeing you enjoying pyPEG ;-) The reason why pip install pypeg2 is needed is that there is pyPEG 1 which is not compatible. I could have given another name to pyPEG 2, but it has lots of ideas of pyPEG 1, so I decided to reuse that name and give it a new major version number.

    For your topic, maybe looking at YML2 could be interesting as well:

    There is nothing which prevents you from having an instance method for compose. For your documentation improvement ideas: do you want to supply a patch?

  3. Michael Jones reporter


    In case you are interested my code using pypeg2 can be seen here: I would welcome feedback if you have any.

    I think my approach might be better if I had a full Python syntax parser in pypeg2 and then adapted it to allow the additional syntax at particular points. Do you know of such a parser? I've seen your pyC11 project but wonder if such a thing has been done for Python?

    I'm still really loving pypeg2. This has been my first real experience parsing stuff and it has made it so easy.

    Cheers, Michael

  4. Log in to comment