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

feat: add python client #170

Merged
merged 3 commits into from
Mar 26, 2024
Merged

feat: add python client #170

merged 3 commits into from
Mar 26, 2024

Conversation

prakharmathur82
Copy link
Member

@prakharmathur82 prakharmathur82 commented Feb 22, 2024

This PR adds the following:

  • Python client for stencil
  • Support for auto-refresh of descriptors
  • Setup file for dependency installations
  • Tests

maztohir and others added 2 commits February 22, 2024 10:49
Co-Authored-By: Rahmat Hidayat <rahmatramahidayat@gmail.com>
__pypackages__/

# Celery stuff
celerybeat-schedule
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you copy this from somewhere else @prakharmathur82 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

it must have been from some project, removed this, and added gitignore from https://github.com/github/gitignore/blob/main/Python.gitignore

protobuf==3.17.3
pytest==6.0.1
pytest-cov==2.12.1
mock==4.0.3
Copy link
Contributor

Choose a reason for hiding this comment

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

use unittest.mock instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

self._scheduler = Scheduler()
if self._auto_refresh:
self._scheduler.every(self._interval).seconds.do(self.refresh)
#TODO: check whether scheduler executed immediatelly or not
Copy link
Contributor

Choose a reason for hiding this comment

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

When are we going to test this ?

Copy link
Member Author

Choose a reason for hiding this comment

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

checked it, it starts after 1st schedule


Use `pip`
```
pip3 install stencil-python-client
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we update this to use the git based method for downloading ?

Copy link
Member Author

Choose a reason for hiding this comment

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

added

clients/python/README.md Show resolved Hide resolved
@@ -0,0 +1,30 @@
from .store import Store
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use absolute path instead of relative path ?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

client = Client(URL)

assert client.get_descriptor('test.One')
assert client.get_descriptor('test.faile') is None
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

@@ -0,0 +1,26 @@
from src.raystack.stencil import Client
from src.raystack.store import Store
from mock import patch
Copy link
Contributor

Choose a reason for hiding this comment

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

Use unittest.mock instead

Copy link
Member Author

Choose a reason for hiding this comment

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

done


client = Client(URL)

assert client.get_descriptor('test.One')
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we asserting the value evaluates to True or True equivalent ?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@punit-kulal punit-kulal self-requested a review March 26, 2024 03:11
@ravisuhag ravisuhag merged commit 2213f4b into main Mar 26, 2024
6 checks passed
@ravisuhag ravisuhag deleted the python-client branch March 26, 2024 17:31
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.

4 participants