19
github
7y

DevRant API Wrapper in Python

Project Type
Project idea
Summary

DevRant API Wrapper in Python

Description
Currently, there is a wrapper in python but doesn't support pip install and needs better structuring. I am proposing to build one with better project layout and maintained properly with setting up CI and writing tests. This will be a small project. Mostly 3-4 days effort. Great way to learn about devrant APIs and contributing to a library can people can pip install.
Tech Stack
Python
Current Team Size
4
URL
Comments
  • 2
  • 1
    let's do it!
  • 0
    @goojal great. Are you familiar with git and Travis CI?
  • 0
    @github I've worked with Gitlab CI/CD.
    I think I'm gonna be ok with Travis CI.
  • 0
    I was planning to setup the infrastructure first, when the codebase is in early stage.
    The repo won't be that big, but still I thought setting it up now will be better.
    What's your call? You can look into the repo. I have already made it available through pip also.
    If it sounds ok, you can contribute in setting up the Travis CI .yml file.
    Currently, last weekend I added the Travis CI yml file but config wasn't setup correctly by me and the build got failed.
  • 1
    @github yeah that looks like a good plan. I'm gonna go check out the repo then working on Travis config file
  • 0
    @SHA-16384 Great. Cool. This tests later can be added to Travis CI script to validate correct builds.
    You can look into the repo. Only 1 api is made till now. That can be a jumpstart. This weekend, I will add more APIs
  • 0
    @SHA-16384 Did you looked into the repo? My weekend starts tomorrow. I will be starting to write codes for remaining APIs. You can consider putting out a test plan. May be a rough one.
  • 0
    @goojal Any progress in setting it up?
  • 1
    Cool! I'm in! I've worked with PyPi before, and with travis too (although for a java project).
    What needs to be done? I don't want to step on eachothers feet
  • 0
    @Joserc87 if you have worked with Travis CI, you can take it, if you are fine to finish by tomorrow. Then, you start adding other APIs. @goojal was working on it, but seems he is busy and CI task is important.
  • 1
    @github I cloned the repo and tried it. First of all, good job :)
    I had to do a few tweaks on the unit tests to make them work. Do you use nosetests to run the tests? And if not, what do you use?
    Travis is very easy to setup, but (IMHO) travis with python doesn't make much sense if you don't run tests, because you won't get any errors until you run the tests; that's why I started with the unit tests.

    I have quite a few comments on the structure of the project. I'll send you pull requests tomorrow, but for now (continues):
  • 1
    - In this case, pirant.app is so small that can be inside __init__.py. This is a common practice and it would allow you to do:

    >> from pirant import DevRant

    instead of

    >> from pirant.app import DevRant

    If not, at leat __init__.py should import app.

    - The test files should start with test_X so that nosetests (or other runners) can identify the test files

    - Modules can be combined. I used to write one file per class too in the past, but the "pythonian" way is to write all the classes that are related into one module (file). Some small pypi packages are written entirely in the __init__.py. But that's not very important for now.

    - By default, I use python3, although I am creating virtual environments for python2 and python3 so that I can test both. There are a few lines that will give errors in python3: some imports should be relative and the print statements should have brackets().
  • 1
    Tell me what you think about those changes and I will work on them tomorrow (it's 1:40 where I live ;)

    Cheers, and again, good Job!

    PS: is there any other channel where we can communicate?
  • 0
    @Joserc87 thanks for your tons of advices.I am pretty new to writing good code in building python modules. I took this project to learn more on building python libs correctly and starting with a devrant api wrapper seemed easy and useful. The repo is very new, I created it to have a better starting point for anyone who wants to contribute.
    -- regarding Unit Tests, I used unittest. I fully agree Travis makes sense only when UT are ready. I planned it that way only. As you can see, @SHA-16384 was gonna handle the UT part, but I will write for the existing ones today. As you mentioned, I will look into nosetest and write tests using it. I was not aware of test_X as in Java Ant builds, it takes files ending with xTest. So, was following that, but will change it.
  • 0
    @Joserc87
    -- I agree it should be from pirant import DevRant. You can add this change in your pull request.
    -- regarding python 3. I believe, till now the module is written to support both. I have to test separately in python3 though. The print I used are just sample files. Adding print() should work too.
    Your contributions will be really helpful to shape the repo in a proper manner.
    Do you have slack or gitter? I can create a group in any of them. Or any other suggestions, I am ok.
  • 1
    @Joserc87 how about tracking stuffs in github itself? Create issues for your tasks. We can communicate there too.
  • 2
    heeeyyy guys, what's up?
    @github sorry dude, I had no free time in last 2 days. I'm starting to contribute from right now.
    @Joserc87 nice comments buddy!

    I'm gonna continue my work on Travis CI and that's mostly because I'm curious about how it works and maybe some unit tests after that, but I can help in other parts too. I'll stick to that till @github comes and gives me another task or @Joserc87 wakes up and talks about tasks! :D
  • 1
    So, I didn't realice that @goojal was working on Travis already, so I did too. Luckily we came up with almost exactly the same .travis.yml haha. I sent a pull request @github. At first my pull request had conflicts with your changes but I just merged it all together and resolved those conflicts and everything seems to work fine (and so Travis says ;).

    I also introduced some small changes to the structure. Like for example, I put some classes together in the same module, which is the recomendation from python (coming from Java, it's counter intuitive, but this is the Python way haha). Besides that, I just added a few tests for the models.

    I look forward to your comments!
  • 0
    @Joserc87 yup. I got your PR. Thanks for your contributions and advices. I will send out the reviews for doubts soon. May be in an hour.
    Further, create an issue for your task and we will assign whoever is working on it. That way it will be easier and to avoid overlapping. I have already created few issues which you can also take up.
  • 1
    Oh! one thing that I did change in travis.yml is to add more versions of python (travis will test 2.7, 3.3 and 3.4), and also a couple of versions of pypi. I moved the packages from travis.yml to requirements-dev.txt so that it's easier to install them manually (pip install -r requirements-dev.txt); if there is a new requirements for the tests, we can add it there.

    @github it's your project and you are on change, so if you disagree with some of these changes let me know so we can discuss :)
  • 0
    @github Ok cool. I will check the issues
  • 0
    Hi @goojal . We have added you in a gitter room. Will carry all our discussions there.
  • 0
    Hi @SHA-16384, we all geared up really well this weekend. Both @Joserc87 and @goojal contributed a lot. If you have time you can still contribute. There are still multiple issues open and you can pick anyone of them, whenever you are free.
    We all made the repo more stable, and currently having 100% code coverage.
    @SHA-16384 if you still wanna contribute, let us know, we will add you to gitter room.
  • 2
    @Joserc87 hi. We are having some problem while building for PyPy-5.3.1. Can you share some thoughts whether it's required or not? Since you have worked on it, I have minimum context regarding it.
  • 1
    @github sure. Let me see :)
  • 1
    @Joserc87 thanks a lot. 😊 Go to PR tab and look into the collabs API PR.
  • 1
    @Joserc87 I got a response here regarding the error: https://github.com/pyca/... [ go to the last 2 comments ]
  • 1
    I'll add my two cents via pr later today - good job so far!
  • 0
    @evilmupp3t thanks. 😊 Will be looking ahead for it.
  • 0
    @github, submitted :)
Add Comment