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

fix(python): respect mixed-case abbrevs while snake-casing #588

Merged
merged 1 commit into from
Jul 7, 2019

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jul 7, 2019

Common mixed-case abbrevations will be snake-cased as a while, instead
of being broken up into separate word parts.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Common mixed-case abbrevations will be snake-cased as a while, instead
of being broken up into separate word parts.
@eladb eladb changed the base branch from master to huijbers/python-capitalization July 7, 2019 09:28
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Notice that I've changed the base branch to be huijbers/python-capitalization. We should change to "master" once that branch is merged.


'reserved word snake-casing'(test: nodeunit.Test) {
test.equal(caseUtils.toSnakeCase('SizeMiB'), 'size_mib');
test.equal(caseUtils.toSnakeCase('SizeMiBiBytes'), 'size_mi_bi_bytes');
Copy link
Contributor

Choose a reason for hiding this comment

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

smartass

@eladb eladb merged commit c84fc7d into huijbers/python-capitalization Jul 7, 2019
@eladb
Copy link
Contributor

eladb commented Jul 7, 2019

Okay, just merged over into the capitalization branch and we'll merge it to master from there.

@eladb eladb deleted the huijbers/common-abbrevs branch July 7, 2019 09:33
eladb pushed a commit that referenced this pull request Jul 7, 2019
This change addresses 4 issues:

- Structs now use idiomatic (snake_case) capitalization of fields
  (instead of JSII-inherited camelCase).
- IDE support -- replace TypedDict usage with regular classes. This
  makes it so that we can't use dicts anymore, but mypy support in
  IDEs wasn't great and by using POPOs (Plain Old Python Objects)
  IDEs get their support back.
- Structs in a variadic argument use to be incorrectly lifted to
  keyword arguments, this no longer happens.
- Stop emitting "Stable" stabilities in docstrings, "Stable" is implied.

In order to make this change, I've had to make `jsii-pacmak` depend on
`jsii-reflect`. This is the proper layering of libraries anyway, since
`jsii-reflect` adds much-needed--and otherwise
duplicated--interpretation of the spec.

Complete refactoring of `jsii-pacmak` to build on `jsii-reflect` is too
much work right now, however, so I've added "escape hatching" where
generators can take advantage of the power of jsii-reflect if they want
to, but most of the code still works on the raw spec level.

Added a refactoring where we load the assembly once and reuse the same
instance for all generators, instead of loading the assembly for every
generator. Assembly-loading, especially with a lot of dependencies, takes
a non-negligible amount of time, so this has the side effect of making
the packaging step faster (shaves off 100 packages * 3 targets * a
couple of seconds).

Fixes #537 
Fixes #577 
Fixes #578 
Fixes #588
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.

2 participants