Let’s Build a Web App! Week 13 out of 30

Rona Chong
4 min readOct 30, 2017

--

In which I go on a detour by working on making a contribution to Graphene!

Hey strangers and friends!

Here’s my weekly breakdown for what’s gone down most recently in my web dev journey. It’s Week 13 out of 30, and I’m supposed to be in the middle of my development phase for my project (hooray!).

What’s that? You don’t know what I’m talking about and would like to? Well, for context, here are the previous posts for this blog series:

What did I set out to do?

As I mentioned last week, I set out to finish a basic MVP in this block of 4 weeks. Since this is the last week of Block 3, I had a lot to finish to achieve that (lots of React components, GraphQL types and fields, etc.) — probably too much to realistically accomplish, actually.

But this week I took a detour from that goal and decided to try to get a PR done for graphene_django, the Python library I’m using to implement a GraphQL server. This is functionality that I would need to add anyway, if not by directly altering the library, then by creating a wrapper class on top of it, so I figured, why not!

What did I end up getting done?

Not the whole PR, which was my goal. Instead, I worked by way through understanding graphene_django’s existing code, figured out how to add a new input argument option for queries on a specific field, verified that using Django’s existing order_by functionality on query sets is a viable option, and updated the DjangoFilterConnectionField connection resolver to check for any ‘order_by’ arguments and pass that to an order_by call on the query set for the query. (This much achieves the functionality that I currently need for myself.) I started working on allowing the Django developer to specify what order_by fields are permissible.

Steps that I still need to take:
Refactor my changes into PR-friendly code.
Write unit tests for my changes.
Create the actual pull request.

What went well:

I think my initial assumptions about what would work / how tackle-able this change is for a beginner like myself. Of course, verifying my idea about simply adding an order_by call to the resolver’s query set was the first step I tried to take — but seeing my queries resolve as intended with my changes so far is a nice, and more complete, confirmation that yes, it’s a doable change after all.

I’ve been doing better self-care (exercise and whatnot) and sleeping more successfully (related maybe?) — which I want to say is the first step towards establishing a healthy work-life balance.

What was difficult:

Well first, it can’t be overlooked that I’m putting off more progress on my actual web project to make this PR. On one hand, you could look at this as me simply shifting focus on what to work on for the time being (and on what I think of as a pretty cool thing to spend time on! Well, this is one of my first forays into open source contribution, so excuse me if I’m a little overexcited). On the other hand, if delivering my web project is still my biggest priority, this represents another instance where I sank extra time using new technology which is still under a lot of development.

Like I started describing last week, I spent a lot of time sorting out details which I think would be resolved much faster by experienced folks. That was what I spent the bulk of my time on this week (while working). But I did find myself thinking that the process would have been really facilitated by docstrings in the graphene_django library.

Even though I felt like I got one part down in improving my daily rhythm of work and not-work (the exercise and better sleep), I kind of derailed myself by opting to work from home most days of the week, as I work a lot better when I’m around others. I’d like to get better at making sure I still get work done even when things like mental preoccupation and sudden events crop up (I suddenly had to start a house search in the middle of this week).

What I would do differently next time (next time typically meaning from now on :P):

Go to school (or a cafe)!

One cool thing I learned about:

Updating my PYTHONPATH using sys, which allows me to add a file from a specific location (and therefore import logging settings I’ve already specified elsewhere to modules in my site-packages).

Misc links for your browsing pleasure:

--

--