Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python support #6

Merged
merged 1 commit into from May 24, 2018
Merged

Add python support #6

merged 1 commit into from May 24, 2018

Conversation

imbstack
Copy link
Contributor

@imbstack imbstack commented May 22, 2018

This is based on changes from #5, so we should land that one first if we land this one.

Copy link

@jhford jhford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The only comments that I have are general to the design of the library regardless of language, but nothing blocks landing here for sure.

The only thing I'm not sure on is the parameterize stuff in the unit tests. It looks reasonable but I'm not familiar with it.

@@ -0,0 +1,27 @@
import json
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More a general point, maybe the best thing is to have one repository that has per-language directories where each langauge's project lives.
e.g.

jhford-work:lib-url jhford$ tree
.
├── go
│   └── urls.go
├── javascript
│   ├── index.js
│   ├── package.json
│   └── test.js
├── python
│   ├── module.py
│   └── setup.py
└── test-files
    └── spec.yml

4 directories, 7 files

This would make it a little more clear what's going on, but still let us have commit-atomicity as well as a shared test spec. For extra points, we could even have a single test script in the root of the repository that will run the unit tests for all languages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of wish we had done this in json-e, too -- the top-level of that repo is pretty crowded, and it's only by luck that various languages have not collided with one another (src for JS, jsone for Python, and jsone.go for Go)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree. I'm going to land all of this now to get it off my plate but we can circle back in a bit and make it look like what you specified up there ^

I admit I just cargo-culted what we did in jsone

else:
return '{}/references/{}/{}/api.json'.format(root_url, service, version)

def docs(root_url, path):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more generally, should we have a version and service parameter in here, or a serviceDocs function? We shouldn't need to know how docs are layed out to get a URL to the docs for the specified service i suspect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for linking to manual and tutorial pages a well as reference pages. We want docs URLs to be stable over time (since people will bookmark them), so I think this is OK. Historically, the thing that's changed most with reference pages is the tier, and that would need to be supplied as a literal here either way.

else:
return '{}/schemas/{}/{}'.format(root_url, service, name)

def ui(root_url, path):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider having the UI component name for a service in the api reference and then using just service name and version here as well? This library probably isn't the best place to encode the mapping between API and UI component, I suspect

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @eliperelman is getting away from the one-to-one mapping from UI-component to service. This method is just ${rootUrl}/${path} for everything but taskcluster.net, so it's really only useful for managing that special case (but nice-to-have for consistency anyway).

@imbstack imbstack changed the base branch from add-golang-impl to master May 24, 2018 02:04
@imbstack imbstack merged commit eb72ade into master May 24, 2018
@imbstack imbstack deleted the add-python-impl branch May 24, 2018 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants