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

Support for relative imports to reuse step impls #360

Merged
merged 5 commits into from
Jul 2, 2024
Merged

Support for relative imports to reuse step impls #360

merged 5 commits into from
Jul 2, 2024

Conversation

kunalvishwasrao
Copy link
Contributor

@kunalvishwasrao kunalvishwasrao commented Jun 26, 2024

Added support to reuse the step implementations from a different project using relative imports #359

Hey @chadlwilson, @BugDiver,
It would be really great if you could review this pull request and help me with the approval of pending workflow checks for merging this PR.

Thanks!😄

@chadlwilson chadlwilson linked an issue Jun 27, 2024 that may be closed by this pull request
Added support to reuse the step implementations from a different project using relative imports #359

Signed-off-by: Kunal Vishwasrao <[email protected]>
getgauge/impl_loader.py Outdated Show resolved Hide resolved
@chadlwilson
Copy link
Contributor

Personally I don’t have enough knowledge or time to review/validate this, especially without automated tests for all the paths. This does seem quite convoluted to me though, and potentially creating a lot of opportunity for issues in weird cases.

@BugDiver
Copy link
Member

BugDiver commented Jun 27, 2024

@zabil @kunalvishwasrao Can we also try to move the logic to append the path from _import_file, since it will try to update the path for every file import and the path will have duplicate values. Perhaps we can try to update the path in _import_impl or load_impls?

@kunalvishwasrao
Copy link
Contributor Author

@zabil @kunalvishwasrao Can we also try to move the logic to append the path from _import_file, since it will try to update the path for every file import and the path will have duplicate values. Perhaps we can try to update the path in _import_impl or load_impls?

@BugDiver, sure sounds good, will update that.

Copy link
Contributor Author

@kunalvishwasrao kunalvishwasrao left a comment

Choose a reason for hiding this comment

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

Hey @zabil, @BugDiver,

Moved the sys path appending into load_impls method as suggested.

Thanks

@zabil zabil requested review from BugDiver and removed request for zabil June 28, 2024 09:41
@gaugebot
Copy link

gaugebot bot commented Jul 1, 2024

@kunalvishwasrao Thank you for contributing to gauge-python. Your pull request has been labeled as a release candidate 🎉🎉.

Merging this PR will trigger a release.

Please bump up the version as part of this PR.

Instructions to bump the version can found at CONTRIBUTING.md

If the CONTRIBUTING.md file does not exist or does not include instructions about bumping up the version, please looks previous commits in git history to see what changes need to be done.

Copy link
Contributor Author

@kunalvishwasrao kunalvishwasrao left a comment

Choose a reason for hiding this comment

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

Hey @BugDiver,

Thanks for approving the PR. I've bumped up the gauge-python version too. Can you please let me know if its ready to be merged?

Thanks!😄

@BugDiver BugDiver merged commit 32e9662 into getgauge:master Jul 2, 2024
15 checks passed
@kunalvishwasrao kunalvishwasrao deleted the feature/#359-reuse-step_impls-via-relative-imports branch July 2, 2024 06:10
kunalvishwasrao added a commit to kunalvishwasrao/gauge-python that referenced this pull request Jul 2, 2024
kunalvishwasrao added a commit to kunalvishwasrao/gauge-python that referenced this pull request Jul 3, 2024
kunalvishwasrao added a commit to kunalvishwasrao/gauge-python that referenced this pull request Jul 3, 2024
zabil added a commit that referenced this pull request Jul 6, 2024
* Bump the pip-dependencies group with 2 updates (#358)

Bumps the pip-dependencies group with 2 updates: [importlib-metadata](https://github.com/python/importlib_metadata) and [setuptools](https://github.com/pypa/setuptools).

Updates `importlib-metadata` from 7.1.0 to 7.2.1
- [Release notes](https://github.com/python/importlib_metadata/releases)
- [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
- [Commits](python/importlib_metadata@v7.1.0...v7.2.1)

Updates `setuptools` from 70.0.0 to 70.1.0
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](pypa/setuptools@v70.0.0...v70.1.0)

---
updated-dependencies:
- dependency-name: importlib-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pip-dependencies
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pip-dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Kunal Vishwasrao <[email protected]>

* Bump the pip-dependencies group across 1 directory with 3 updates (#362)

Bumps the pip-dependencies group with 3 updates in the / directory: [debugpy](https://github.com/microsoft/debugpy), [importlib-metadata](https://github.com/python/importlib_metadata) and [setuptools](https://github.com/pypa/setuptools).

Updates `debugpy` from 1.8.1 to 1.8.2
- [Release notes](https://github.com/microsoft/debugpy/releases)
- [Commits](microsoft/debugpy@v1.8.1...v1.8.2)

Updates `importlib-metadata` from 7.2.1 to 8.0.0
- [Release notes](https://github.com/python/importlib_metadata/releases)
- [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
- [Commits](python/importlib_metadata@v7.2.1...v8.0.0)

Updates `setuptools` from 70.1.0 to 70.1.1
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](pypa/setuptools@v70.1.0...v70.1.1)

---
updated-dependencies:
- dependency-name: debugpy
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pip-dependencies
- dependency-name: importlib-metadata
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: pip-dependencies
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pip-dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Kunal Vishwasrao <[email protected]>

* Support for relative imports to reuse step impls

Signed-off-by: Kunal Vishwasrao <[email protected]>

* Update release dependencies

Signed-off-by: BugDiver <[email protected]>
Signed-off-by: Kunal Vishwasrao <[email protected]>

* Correctly loading the methods from relatively imported classs (addition to #360)

Signed-off-by: Kunal Vishwasrao <[email protected]>

* Update getgauge/impl_loader.py

Correctly loading the methods from relatively imported classes (#365)

Signed-off-by: Kunal Vishwasrao <[email protected]>

Co-authored-by: Zabil Cheriya Maliackal <[email protected]>
Signed-off-by: Kunal Vishwasrao <[email protected]>

* Returning method_list in update_step_resgistry_with_class method (#365)

Signed-off-by: Kunal Vishwasrao <[email protected]>

* Adding test class for relative import unittest (#365)

Signed-off-by: Kunal Vishwasrao <[email protected]>

* Adding unittest for relative import (#365)

Signed-off-by: Kunal Vishwasrao <[email protected]>

* Renaming method to update_step_registry_with_class (#365)

Signed-off-by: Kunal Vishwasrao <[email protected]>

* Updating unittest for impl loader (#365)

Signed-off-by: Kunal Vishwasrao <[email protected]>

* Bumping up python package version (#365)

Signed-off-by: Kunal Vishwasrao <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Kunal Vishwasrao <[email protected]>
Signed-off-by: BugDiver <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vinay Shukla <[email protected]>
Co-authored-by: Zabil Cheriya Maliackal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Unable to reuse step implementations from another project
4 participants