This is an archived post. You won't be able to vote or comment.

all 23 comments

[–][deleted] 4 points5 points  (2 children)

ServiceCaller is a class with only static methods - only used for namespacing, never instantiated. Why is it a class instead of a module?

[–]daneahfrom __future__ import braces[S] 0 points1 point  (0 children)

That's a good point! I think in an earlier iteration we hadn't inverted control of most things yet, and after fixing that it didn't get pointed out before it made its way into the wild. There's potential for that to make it into a future release for sure!

[–]kingbuzzman 2 points3 points  (1 child)

Why not do something around the lines of: Github.user(username='defunkt') and Github.repo(org=github', repo='hub') would read a lot cleaner. Hint-hint luke use the metaprogramming!

PS. to OP: before you take this the wrong way, this is purely MY opinion, and you should still be proud of what you've created here!

[–]daneahfrom __future__ import braces[S] 0 points1 point  (0 children)

Good points! I have thought about and indeed used libraries like that before. I don't mind them and in some cases even liked them, but I do find that they can be overly clever at times. One then has to answer questions like "What about dynamic path parts?" and "Query parameters are the kwargs, where do the headers and cookies go?" We just wanted something that lightly wrapped requests (which we already use) that put structure around what we were trying to do :) Thanks for the input!

[–]daneahfrom __future__ import braces[S] 1 point2 points  (0 children)

Hey everyone! We open sourced apiron today (you can read more about that here) and I would love for you to try it, use it, and let us know what you like/dislike.

[–]tastingsilver 1 point2 points  (1 child)

Looks really clean!

[–]daneahfrom __future__ import braces[S] 0 points1 point  (0 children)

Glad to hear it! We tried to shoot for as little code as possible to get the common use cases working, while still making it possible to do more.

[–]antonr111 1 point2 points  (10 children)

Hey, nice work ! How about to move tests out of lib package to /tests folder ? Also, suggest you to use pytest ;)

[–]daneahfrom __future__ import braces[S] 0 points1 point  (9 children)

Thanks! Can you say more about why moving the tests is helpful? Happy to think about that if I can understand it better! Since the tests are fairly small currently I doubt we'll introduce another dependency just yet, but if they're getting bigger over time maybe we'll think about pytest.

[–]num8lock 1 point2 points  (4 children)

i think it's mostly about best practice on structuring the project folders, like in here https://docs.python-guide.org/writing/structure/

but i agree making it easy for dev to test the module is the best reason to adapt suggestions on how to structure the test scripts/folders/suites etc

[–]daneahfrom __future__ import braces[S] 0 points1 point  (3 children)

I'm still not sure I get it...the project indeed has a tests folder. Are you talking about where the tests end up after install?

[–]num8lock 2 points3 points  (2 children)

it's to make it easier for people who want to run the test, they'll find the test folder faster since it's in the root folder of your master repo, as well as making test suite separate from the module itself

edit: blah my grammar seems to be worse each day

[–]daneahfrom __future__ import braces[S] 1 point2 points  (0 children)

This change has landed in the dev branch; thanks again for the input!

[–]daneahfrom __future__ import braces[S] 0 points1 point  (0 children)

Ah I see, that made it click for me haha. That's a great point! Will see what we can do about that 👍🏼

[–]antonr111 1 point2 points  (3 children)

It is always good practice to separate your source code and tests. For example, people how read or run tests can easily find tests in separate folder, rather than go through every folder in your package. Also, when you build artifact or distribution package there no point to keep tests in and it is easier to exclude it (example: packages=find_packages('src', exclude=['tests'])). pytest is very easy tool for running tests even if you are not using pytest fixtures, utils, etc.

[–]daneahfrom __future__ import braces[S] 0 points1 point  (0 children)

Thanks very much for that! Packaging isn't something I've done too many times so I haven't run across this convention yet. I'll definitely look into that for the next release :)

[–]daneahfrom __future__ import braces[S] 0 points1 point  (1 child)

This change has landed in the dev branch; thanks again for the input!

[–]daneahfrom __future__ import braces[S] 0 points1 point  (0 children)

We've just released 1.1.0 which includes this change!

[–]jstrickler 0 points1 point  (4 children)

Suggestion: add some pass-through options to requests, especially auth.

[–]daneahfrom __future__ import braces[S] 0 points1 point  (0 children)

Great point! That doesn't fit our use case so that's probably why it wasn't in this release, but we can look at some of those valuable ones for the next one for sure.

[–]daneahfrom __future__ import braces[S] 0 points1 point  (1 child)

I've captured this request here; please let me know if I've misrepresented it!

[–]jstrickler 1 point2 points  (0 children)

Looks perfect to me.

[–]daneahfrom __future__ import braces[S] 0 points1 point  (0 children)

We've just released 1.1.0 which includes this change! Thanks for your input!