Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implemented python properties in base.py #41

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

Merged
merged 12 commits into from
Jun 24, 2020

Conversation

cumason123
Copy link
Contributor

  • Link to issue this resolves
    Refactor for more pythonic data encapsulation  #40
  • What I did
    I made event attributes easier to obtain in a more pythonic matter
  • How I did it
    I added python properties and setters to the base class
  • How to verify it
    You can look at tests/test_data_encaps_refs.py for example on how to access attributes now
  • One line description for the changelog
    Implemented python properties in base.py

@cumason123 cumason123 force-pushed the data-encapsulation branch from 2e164fe to 85f33ec Compare June 19, 2020 16:35
@cumason123
Copy link
Contributor Author

@grant I believe mergeable. I'm unsure if I should keep the unit tests for base class properties (python setters/getters)

@grant
Copy link
Member

grant commented Jun 22, 2020

Hi @cumason123, can you please request reviews on GitHub?

Also please describe the PR with specifics (what is "easier"?) and format the GitHub PR comment according to the template: https://github.com/cloudevents/sdk-python/blob/master/.github/pull_request_template.md

@cumason123 cumason123 requested review from grant and grayside June 22, 2020 19:15
Comment on lines +23 to 40
# ce-specversion
def CloudEventVersion(self) -> str:
raise Exception("not implemented")
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be called CloudEventSpecversion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish, but unfortunately users are already using CloudEventVersion

Copy link
Member

Choose a reason for hiding this comment

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

Can we make breaking changes for major versions of this package?

Comment on lines 76 to 92
def SetEventID(self, eventID: str) -> object:
raise Exception("not implemented")
Copy link
Member

Choose a reason for hiding this comment

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

Rename to SetID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't rename the original setters/getters because that would break users code whom are using these functions

Comment on lines 91 to 107
def SetEventTime(self, eventTime: str) -> object:
raise Exception("not implemented")
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need these methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately yes. Removing them would break existing user code

Comment on lines +27 to +51
@property
def specversion(self):
return self.CloudEventVersion()

def Source(self) -> str:
def SetCloudEventVersion(self, specversion: str) -> object:
raise Exception("not implemented")

def EventID(self) -> str:
raise Exception("not implemented")
@specversion.setter
def specversion(self, value: str):
self.SetCloudEventVersion(value)
Copy link
Member

Choose a reason for hiding this comment

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

I believe having 3 methods like this is too much, don't we just need 2, getter and setter/@property/@foo.setter?

Copy link
Contributor Author

@cumason123 cumason123 Jun 23, 2020

Choose a reason for hiding this comment

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

The reason why there's 4 methods (property/foo.setter and getter/setter) is the original developers made getters/setters. To make sure I didn't break any existing code, I had to make sure the old getters/setters still work which is why I didn't remove them. The benefit of the properties is now you can do something such as event.specversion which is more pythonic instead of event.CloudEventVersion()

@cumason123 cumason123 force-pushed the data-encapsulation branch 2 times, most recently from d07b8ce to 53e3f48 Compare June 23, 2020 17:24
@cumason123 cumason123 requested a review from grant June 23, 2020 17:24
Copy link
Member

@di di left a comment

Choose a reason for hiding this comment

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

Will merge once DCO is passing.

@di di changed the base branch from master to v1.0.0-dev June 23, 2020 19:41
@cumason123 cumason123 force-pushed the data-encapsulation branch 2 times, most recently from 75d7613 to 4ca25b4 Compare June 23, 2020 19:43
@cumason123
Copy link
Contributor Author

Tox not running pytests in CI?

Curtis Mason and others added 10 commits June 23, 2020 17:03
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
@di di force-pushed the data-encapsulation branch from d6ae265 to b4fc958 Compare June 23, 2020 22:04
@di di removed the Do Not Merge label Jun 23, 2020
@di
Copy link
Member

di commented Jun 23, 2020

@cumason123 Good catch. Fixed in #46, looks like you now have some failing tests here.

Curtis Mason added 2 commits June 24, 2020 13:55
@cumason123 cumason123 merged commit 1ad120b into cloudevents:v1.0.0-dev Jun 24, 2020
cumason123 added a commit to cumason123/sdk-python that referenced this pull request Jul 7, 2020
* Added SetCloudEventVersion

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began adding python properties

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added pythonic properties to base class

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began testing for getters/setters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added general setter tests

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed spacing in base.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added __eq__ to option and datacontentencoding property to v03

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* testing extensions and old getters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* removed versions v01 and v02 from test_data_encaps_refs.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed inheritance issue in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* added prefixed_headers dict to test

Signed-off-by: Curtis Mason <[email protected]>
cumason123 added a commit to cumason123/sdk-python that referenced this pull request Jul 7, 2020
* Added SetCloudEventVersion

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began adding python properties

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added pythonic properties to base class

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began testing for getters/setters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added general setter tests

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed spacing in base.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added __eq__ to option and datacontentencoding property to v03

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* testing extensions and old getters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* removed versions v01 and v02 from test_data_encaps_refs.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed inheritance issue in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* added prefixed_headers dict to test

Signed-off-by: Curtis Mason <[email protected]>
cumason123 added a commit that referenced this pull request Jul 9, 2020
* added changelog

Signed-off-by: Curtis Mason <[email protected]>

* Created CloudEvent class (#36)

CloudEvents is a more pythonic interface for using cloud events.
It is powered by internal marshallers and cloud event base classes.
It performs basic validation on fields, and cloud event type checking.

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Fix tox configuration for CI (#46)

Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Implemented python properties in base.py (#41)

* Added SetCloudEventVersion

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began adding python properties

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added pythonic properties to base class

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began testing for getters/setters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added general setter tests

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed spacing in base.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added __eq__ to option and datacontentencoding property to v03

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* testing extensions and old getters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* removed versions v01 and v02 from test_data_encaps_refs.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed inheritance issue in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* added prefixed_headers dict to test

Signed-off-by: Curtis Mason <[email protected]>

* CHANGELOG adjustment

Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Removed irrelevant files from commit diff

Signed-off-by: Curtis Mason <[email protected]>

Co-authored-by: Dustin Ingram <[email protected]>
cumason123 added a commit to cumason123/sdk-python that referenced this pull request Jul 22, 2020
* Added SetCloudEventVersion

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began adding python properties

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added pythonic properties to base class

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began testing for getters/setters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added general setter tests

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed spacing in base.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added __eq__ to option and datacontentencoding property to v03

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* testing extensions and old getters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* removed versions v01 and v02 from test_data_encaps_refs.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed inheritance issue in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* added prefixed_headers dict to test

Signed-off-by: Curtis Mason <[email protected]>
cumason123 added a commit to cumason123/sdk-python that referenced this pull request Jul 22, 2020
* added changelog

Signed-off-by: Curtis Mason <[email protected]>

* Created CloudEvent class (cloudevents#36)

CloudEvents is a more pythonic interface for using cloud events.
It is powered by internal marshallers and cloud event base classes.
It performs basic validation on fields, and cloud event type checking.

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Fix tox configuration for CI (cloudevents#46)

Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Implemented python properties in base.py (cloudevents#41)

* Added SetCloudEventVersion

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began adding python properties

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added pythonic properties to base class

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began testing for getters/setters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added general setter tests

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed spacing in base.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added __eq__ to option and datacontentencoding property to v03

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* testing extensions and old getters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* removed versions v01 and v02 from test_data_encaps_refs.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed inheritance issue in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* added prefixed_headers dict to test

Signed-off-by: Curtis Mason <[email protected]>

* CHANGELOG adjustment

Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Removed irrelevant files from commit diff

Signed-off-by: Curtis Mason <[email protected]>

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>
cumason123 added a commit that referenced this pull request Aug 11, 2020
* Created CloudEvent class (#36)

CloudEvents is a more pythonic interface for using cloud events.
It is powered by internal marshallers and cloud event base classes.
It performs basic validation on fields, and cloud event type checking.

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* Implemented python properties in base.py (#41)

* Added SetCloudEventVersion

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began adding python properties

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added pythonic properties to base class

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began testing for getters/setters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added general setter tests

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed spacing in base.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added __eq__ to option and datacontentencoding property to v03

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* testing extensions and old getters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* removed versions v01 and v02 from test_data_encaps_refs.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed inheritance issue in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* added prefixed_headers dict to test

Signed-off-by: Curtis Mason <[email protected]>

* Http structured cloudevents (#47)

* Moved fields out of base & structured support

base._ce_required_fields and base._ce_optional_fields were moved into
event classes v03 and v1.

http_events.CloudEvent class now looks for fieldnames in either headers
or data, and can automatically determine whether this is a binary or
structured event.

Signed-off-by: Curtis Mason <[email protected]>

* testing structured

Signed-off-by: Curtis Mason <[email protected]>

* added tests for structured events

Signed-off-by: Curtis Mason <[email protected]>

* Added test valid structured cloudevents

Signed-off-by: Curtis Mason <[email protected]>

* Created default headers arg in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* Added http_events.py sample code

Signed-off-by: Curtis Mason <[email protected]>

* removed ../python-event-requests

Signed-off-by: Curtis Mason <[email protected]>

* README.md nit

Signed-off-by: Curtis Mason <[email protected]>

* client.py nit

Signed-off-by: Curtis Mason <[email protected]>

* comment nits

Signed-off-by: Curtis Mason <[email protected]>

* created __getitem__ in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* sample nits

Signed-off-by: Curtis Mason <[email protected]>

* fixed structured empty data issue

Signed-off-by: Curtis Mason <[email protected]>

* Added CloudEvent to README

Signed-off-by: Curtis Mason <[email protected]>

* added http_msg to CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* implemented ToRequest in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* testing more specversions

Signed-off-by: Curtis Mason <[email protected]>

* Added sample code to README.md

Signed-off-by: Curtis Mason <[email protected]>

* modified sample code

Signed-off-by: Curtis Mason <[email protected]>

* added datavalidation to changelog

Signed-off-by: Curtis Mason <[email protected]>

* updated README

Signed-off-by: Curtis Mason <[email protected]>

* README adjustment

Signed-off-by: Curtis Mason <[email protected]>

* ruler 80 adjustment on http_events

Signed-off-by: Curtis Mason <[email protected]>

* style and renamed ToRequest to to_request

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* fixed self.binary typo

Signed-off-by: Curtis Mason <[email protected]>

* CHANGELOG adjustment

Signed-off-by: Curtis Mason <[email protected]>

* rollback CHANGELOG

Signed-off-by: Curtis Mason <[email protected]>

* Added documentation to to_request

Signed-off-by: Curtis Mason <[email protected]>

* README.md adjustment

Signed-off-by: Curtis Mason <[email protected]>

* renamed event_handler to event_version

Signed-off-by: Curtis Mason <[email protected]>

* inlined field_name_modifier

Signed-off-by: Curtis Mason <[email protected]>

* renamed test body data

Signed-off-by: Curtis Mason <[email protected]>

* removed unnecessary headers from test

Signed-off-by: Curtis Mason <[email protected]>

* removed field_name_modifier and fixed e.g. in client.py

Signed-off-by: Curtis Mason <[email protected]>

* pylint fix

Signed-off-by: Curtis Mason <[email protected]>

* Update types and handle data_base64 structured. (#34)

* Update types and handle data_base64 structured.

- Add sane defaults for encoding
  - Unfortunately, defaults for structured and binary need to be *different*
   - Push types through interfaces
- Make it easy to call 'ToRequest' using Marshaller defaults
- Add tests for above

Signed-off-by: Evan Anderson <[email protected]>

* Fix lint warnings due to changes to W503/W504

See https://gitlab.com/pycqa/flake8/-/issues/466 for details.

Signed-off-by: Evan Anderson <[email protected]>

* Adopt di's suggestions.

Signed-off-by: Evan Anderson <[email protected]>

* Fix lint.

Signed-off-by: Evan Anderson <[email protected]>

* Move types to another package.

Signed-off-by: Evan Anderson <[email protected]>

* Adjust CloudEvent class in http_events.py to support binary data as well as JSON.

Signed-off-by: Evan Anderson <[email protected]>

* Apply suggested changes by MacrBoissonneault

Signed-off-by: Evan Anderson <[email protected]>

* Fix samples as well.

Signed-off-by: Evan Anderson <[email protected]>

* Fix lint. Apparently, we can complain about formating issues, but a human has to fix them.

Signed-off-by: Evan Anderson <[email protected]>

* Add test for binary encoding of messages.

Fix usability of binary detection in MarshalJSON to support memoryview.

Signed-off-by: Evan Anderson <[email protected]>

* Fix errors noticed by cumason123

Signed-off-by: Evan Anderson <[email protected]>

* Changelog version deprecation (#48)

* added changelog

Signed-off-by: Curtis Mason <[email protected]>

* Created CloudEvent class (#36)

CloudEvents is a more pythonic interface for using cloud events.
It is powered by internal marshallers and cloud event base classes.
It performs basic validation on fields, and cloud event type checking.

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Fix tox configuration for CI (#46)

Signed-off-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Implemented python properties in base.py (#41)

* Added SetCloudEventVersion

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began adding python properties

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added pythonic properties to base class

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* began testing for getters/setters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added general setter tests

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed spacing in base.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* added __eq__ to option and datacontentencoding property to v03

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* testing extensions and old getters

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* removed versions v01 and v02 from test_data_encaps_refs.py

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Dustin Ingram <[email protected]>

* fixed inheritance issue in CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* added prefixed_headers dict to test

Signed-off-by: Curtis Mason <[email protected]>

* CHANGELOG adjustment

Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Removed irrelevant files from commit diff

Signed-off-by: Curtis Mason <[email protected]>

Co-authored-by: Dustin Ingram <[email protected]>

* Black formatter (#51)

* black and isort added to precommit

Signed-off-by: Curtis Mason <[email protected]>

* main renaming

Signed-off-by: Curtis Mason <[email protected]>

* fixed tox

Signed-off-by: Curtis Mason <[email protected]>

* linting in tox rename

Signed-off-by: Curtis Mason <[email protected]>

* fixed tox trailing space

Signed-off-by: Curtis Mason <[email protected]>

* added reformat tox env

Signed-off-by: Curtis Mason <[email protected]>

* Reformatting files

Signed-off-by: Curtis Mason <[email protected]>

* reformatted more files

Signed-off-by: Curtis Mason <[email protected]>

* documented tox in README

Signed-off-by: Curtis Mason <[email protected]>

* removed -rc flag

Signed-off-by: Curtis Mason <[email protected]>

* README and http-cloudevents sample code adjustments to reflect new CloudEvent (#56)

* README and http-cloudevents CloudEvent adjustments

README no longer shows how to use base event classes to create events.
Removed this because users shouldn't be forced to interact with the
marshaller class. Additionally, CloudEvent is a simpler interface
therefore we are encouraging the CloudEvent class usage.
http-cloudevents now has more example usage for the getitem overload.
Similarly README shows how to use getitem overload.

Signed-off-by: Curtis Mason <[email protected]>

* lint reformat

Signed-off-by: Curtis Mason <[email protected]>

* resolved nits

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* renamed /mycontext to url

Signed-off-by: Curtis Mason <[email protected]>

* renamed here linlk to in the samples directory

Signed-off-by: Curtis Mason <[email protected]>

* Separated http methods (#60)

* instantiated http path

Signed-off-by: Curtis Mason <[email protected]>

* moved from_http from CloudEvent to http

Signed-off-by: Curtis Mason <[email protected]>

* Moved to_http out of CloudEvent

Signed-off-by: Curtis Mason <[email protected]>

* moved http library into event.py

Signed-off-by: Curtis Mason <[email protected]>

* testing printable cloudevent

Signed-off-by: Curtis Mason <[email protected]>

* Adjusted README

Signed-off-by: Curtis Mason <[email protected]>

* Created EventClass

Signed-off-by: Curtis Mason <[email protected]>

* reformatted event.py

Signed-off-by: Curtis Mason <[email protected]>

* from_json definition

Signed-off-by: Curtis Mason <[email protected]>

* server print changes

Signed-off-by: Curtis Mason <[email protected]>

* Specversion toggling (#57)

* cloudevent now switches specversion types

Signed-off-by: Curtis Mason <[email protected]>

* removed duplicate marshall instance

Signed-off-by: Curtis Mason <[email protected]>

* resolved grant requests

Signed-off-by: Curtis Mason <[email protected]>

* converters now can check headers for fields

Signed-off-by: Curtis Mason <[email protected]>

* removed print statement

Signed-off-by: Curtis Mason <[email protected]>

* Fixed marshallers looking at headers for specversion

Signed-off-by: Curtis Mason <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>

* is_binary static method and structured isinstance rework

Signed-off-by: Curtis Mason <[email protected]>

* testing for is_binary and is_structured

Signed-off-by: Curtis Mason <[email protected]>

* Image sample code (#65)

* added image example

Signed-off-by: Curtis Mason <[email protected]>

* moved size into headers

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* renamed sample code

Signed-off-by: Curtis Mason <[email protected]>

* added test to http-image-cloudevents sample

Signed-off-by: Curtis Mason <[email protected]>

* removed unnecessary function

Signed-off-by: Curtis Mason <[email protected]>

* Added testing for http-image-cloudevents

Signed-off-by: Curtis Mason <[email protected]>

* Data marshall arg fix and better image in sample

Fixed bug where data_marshaller and data_unmarshaller wasn't being
passed into positional arguments. Also used cloudevents logo for the
image in http-image-cloudevents

Signed-off-by: Curtis Mason <[email protected]>

* adjusted http-image-cloudevents samples

Signed-off-by: Curtis Mason <[email protected]>

* reformat and README changes

Signed-off-by: Curtis Mason <[email protected]>

* io bytes casting in data_unmarshaller

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* removed unusued imports in http-image samples

Signed-off-by: Curtis Mason <[email protected]>

* removed samples/http-cloudevents/tmp.png

Signed-off-by: Curtis Mason <[email protected]>

* Nits

Signed-off-by: Curtis Mason <[email protected]>

* Implemented to_json and from_json (#72)

* added test_to_json test

Signed-off-by: Curtis Mason <[email protected]>

* implemented to_json with tests

Signed-off-by: Curtis Mason <[email protected]>

* from_json and to_json tests

Signed-off-by: Curtis Mason <[email protected]>

* Tests for to_json being able to talk to from_json

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* added documentation for to_json and from_json

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* Fixed top level extensions bug (#71)

* Fixed top level extensions bug

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* fixed name bug in test_event_extensions

Signed-off-by: Curtis Mason <[email protected]>

* fixed broken links in README.md (#75)

Signed-off-by: Curtis Mason <[email protected]>

* Fixed marshaller documentation typo's in http (#76)

* Fixed marshaller documentation in http directory

Signed-off-by: Curtis Mason <[email protected]>

* adjusted marshaller documentation

Signed-off-by: Curtis Mason <[email protected]>

* None data fix (#78)

* fixed none data issue

Signed-off-by: Curtis Mason <[email protected]>

* added none data test for marshalling

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* Samples image test server (#79)

* fixed none data issue

Signed-off-by: Curtis Mason <[email protected]>

* added none data test for marshalling

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* added http server test in image sample

Signed-off-by: Curtis Mason <[email protected]>

* Removed print statements from test

Signed-off-by: Curtis Mason <[email protected]>

* removed requests from test

Signed-off-by: Curtis Mason <[email protected]>

* Top level http (#83)

* Modularized http and made http a top level module

Modularized the http directory by separating related functions into
different scripts. Also removed EventClass and kept a singular
CloudEvent. Finally, CloudEvent.__repr__ was refactored such that it
doesn't depend on external methods.

Signed-off-by: Curtis Mason <[email protected]>

* renamed requests.py to http_methods

Signed-off-by: Curtis Mason <[email protected]>

* lint fixes

Signed-off-by: Curtis Mason <[email protected]>

* http-json-cloudevents testing (#80)

* Added tests to http-json-cloudevents

Signed-off-by: Curtis Mason <[email protected]>

* removed outdated python-requests sample code

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* Added flask to requirements

Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

* docs: add README badge (#85)

Signed-off-by: Grant Timmerman <[email protected]>

* added pypi-release rule (#87)

* added pypi-release rule

Signed-off-by: Curtis Mason <[email protected]>

* added RELEASING.md

Signed-off-by: Curtis Mason <[email protected]>

* Adjusted RELEASING.md

Signed-off-by: Curtis Mason <[email protected]>

* Update .github/workflows/pypi-release.yml

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* workflow pypi name changed

Signed-off-by: Curtis Mason <[email protected]>

* Update RELEASING.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update RELEASING.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update RELEASING.md

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* removed some pbr stuff

Signed-off-by: Curtis Mason <[email protected]>

* Removed all pbr stuff

Signed-off-by: Curtis Mason <[email protected]>

* README nits

Signed-off-by: Curtis Mason <[email protected]>

* RELEASING adjustment in README

Signed-off-by: Curtis Mason <[email protected]>

* author update in setup.cfg

Signed-off-by: Curtis Mason <[email protected]>

* removed setup.cfg

Signed-off-by: Curtis Mason <[email protected]>

* Update setup.py

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* lint fix

Signed-off-by: Curtis Mason <[email protected]>

Co-authored-by: Dustin Ingram <[email protected]>

* pypi-release git tags automation (#88)

* added pypi_packaging

Signed-off-by: Curtis Mason <[email protected]>

* reverted pypi-release

Signed-off-by: Curtis Mason <[email protected]>

* added pypi_package workflow

Signed-off-by: Curtis Mason <[email protected]>

* added gitpython dependency

Signed-off-by: Curtis Mason <[email protected]>

* added git import in createTag function

Signed-off-by: Curtis Mason <[email protected]>

* Updated RELEASING.md and implemented pypi_config in pypi_packaging.pg

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Fixed some docs

Signed-off-by: Curtis Mason <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* Update .github/workflows/pypi-release.yml

Co-authored-by: Dustin Ingram <[email protected]>
Signed-off-by: Curtis Mason <[email protected]>

* added __version__

Signed-off-by: Curtis Mason <[email protected]>

* lint change

Signed-off-by: Curtis Mason <[email protected]>

* reinstalling cloudevents in workflow

Signed-off-by: Curtis Mason <[email protected]>

* added cloudevents to publish.txt

Signed-off-by: Curtis Mason <[email protected]>

* removed old release_doc

Signed-off-by: Curtis Mason <[email protected]>

Co-authored-by: Dustin Ingram <[email protected]>

Co-authored-by: Evan Anderson <[email protected]>
Co-authored-by: Dustin Ingram <[email protected]>
Co-authored-by: Grant Timmerman <[email protected]>
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.

3 participants