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 classmethod for initializing Sinequa class #18

Merged
merged 4 commits into from
Oct 12, 2023

Conversation

anisbhsl
Copy link
Contributor

@anisbhsl anisbhsl commented Oct 11, 2023

Description

This PR adds a from_config class method in Sinequa class to initialize Sinequa instance with given configuration dictionary.

Major Changes

  1. Added from_config class method to initialize Sinequa instance.

Minor Changes

  1. Updated docs (README)
  2. Update tests to accommodate new secondary constructor.
  3. Added few more docstrings.

Example Usage:

from pynequa import Sinequa
config= {
     "access_token" : "",
     "base_url": "",
     "app_name": "",
     "query_name": ""
}

sinequa = Sinequa.from_config(config)

OR do it directly using:

from pynequa import Sinequa
config= {
     "access_token" : "",
     "base_url": "",
     "app_name": "",
     "query_name": ""
}

sinequa = pynequa.Sinequa(
     access_token: config["access_token"],
     base_url: config["base_url"],
     app_name: config["app_name"],
     query_name: config["query_name"],
)

@anisbhsl anisbhsl added the enhancement New feature or request label Oct 11, 2023
@anisbhsl anisbhsl linked an issue Oct 11, 2023 that may be closed by this pull request
@anisbhsl anisbhsl requested a review from NISH1001 October 11, 2023 19:47
@NISH1001
Copy link
Collaborator

@anisbhsl can you also add the primary construction mechanism to pynequa usage? Something like Sinequa(...)

…NASA-IMPACT/pynequa into feature/17/simplify-sinequa-constructor
@anisbhsl
Copy link
Contributor Author

@anisbhsl can you also add the primary construction mechanism to pynequa usage? Something like Sinequa(...)

I've added example usage in both the README and the description of this PR.

@NISH1001 NISH1001 merged commit bd039a3 into develop Oct 12, 2023
@NISH1001 NISH1001 deleted the feature/17/simplify-sinequa-constructor branch October 12, 2023 16:53
anisbhsl added a commit that referenced this pull request Oct 24, 2023
* Add documentation for pynequa  (#7)

* added readme and license

* added readthedocs config

* added conf.py

update conf

update conf

removed theme

reset

* fix sphinx docs

* fix typo

* added in gitignore

* Feature: Add github action workflows and tests (#8)

* added build check action

* minor changes

* changes in markdowns

* build on push only

* added mock and actual api unit tests

* update install command for pypi

* add release version

* added usage example and minor fixes (#10)

* added engine.sql method (#13)

* Add classmethod for initializing Sinequa class (#18)

* added classmethod for initializing Sinequa class

* updated docs

* don't send empty params in payload

* don't send empty params in payload (#20)

* fix error with payload generation

* Feature: Update datamodels  (#21)

* updated datamodels to use dataclass

* resolved comments

* updated metadata in docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify the constructor for Sinequa class
2 participants