diff --git a/.github/workflows/dev_tests.yml b/.github/workflows/dev_tests.yml new file mode 100644 index 0000000..e945ef8 --- /dev/null +++ b/.github/workflows/dev_tests.yml @@ -0,0 +1,48 @@ +name: dev tests + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + + +permissions: + contents: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Set up environment variables + run: echo "Environment variables set up" + env: + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + ENV : "dev" + - name: Install dependencies + run: | + pip install -r requirements-dev.txt + - name: Run tests + env: + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + ENV : "dev" + run: pytest -r nmdc_api_utilities/test/ + - name: Create Issue + if: failure() && github.event_name == 'schedule' + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { owner, repo } = context.repo; + await github.rest.issues.create({ + owner, + repo, + title: "notebook_api_utilities production tests failed", + body: "The development tests have failed in the latest run. Please investigate the issue.", + labels: ["report", "automated issue"] + }); diff --git a/.github/workflows/prod_tests.yml b/.github/workflows/prod_tests.yml new file mode 100644 index 0000000..896f3f3 --- /dev/null +++ b/.github/workflows/prod_tests.yml @@ -0,0 +1,50 @@ +name: prod tests + +on: + push: + pull_request: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +permissions: + contents: write + issues: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Set up environment variables + run: echo "Environment variables set up" + env: + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + ENV : "prod" + - name: Install dependencies + run: | + pip install -r requirements-dev.txt + - name: Run tests + env: + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + ENV : "prod" + run: pytest -r nmdc_api_utilities/test/ + - name: Create Issue + if: failure() && github.event.pull_request == null && github.event_name == 'schedule' + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { owner, repo } = context.repo; + await github.rest.issues.create({ + owner, + repo, + title: "notebook_api_utilities production tests failed", + body: "The production tests have failed in the latest run. Please investigate the issue.", + labels: ["report", "automated issue"] + }); \ No newline at end of file diff --git a/nmdc_api_utilities/biosample_search.py b/nmdc_api_utilities/biosample_search.py index 39960e8..52348bc 100644 --- a/nmdc_api_utilities/biosample_search.py +++ b/nmdc_api_utilities/biosample_search.py @@ -11,5 +11,5 @@ class BiosampleSearch(LatLongFilters, CollectionSearch): Class to interact with the NMDC API to get biosamples. """ - def __init__(self): - super().__init__("biosample_set") + def __init__(self, env="prod"): + super().__init__(collection_name="biosample_set", env=env) diff --git a/nmdc_api_utilities/calibration_search.py b/nmdc_api_utilities/calibration_search.py index 0db7d79..a4b12a7 100644 --- a/nmdc_api_utilities/calibration_search.py +++ b/nmdc_api_utilities/calibration_search.py @@ -10,5 +10,5 @@ class CalibrationSearch(CollectionSearch): Class to interact with the NMDC API to get calibration records. """ - def __init__(self): - super().__init__("calibration_set") + def __init__(self, env="prod"): + super().__init__(collection_name="calibration_set", env=env) diff --git a/nmdc_api_utilities/chemical_entity_search.py b/nmdc_api_utilities/chemical_entity_search.py index 4d611cc..585fbde 100644 --- a/nmdc_api_utilities/chemical_entity_search.py +++ b/nmdc_api_utilities/chemical_entity_search.py @@ -10,5 +10,5 @@ class ChemicalEntitySearch(CollectionSearch): Class to interact with the NMDC API to get chemical entities. """ - def __init__(self): - super().__init__("chemical_entity_set") + def __init__(self, env="prod"): + super().__init__(collection_name="chemical_entity_set", env=env) diff --git a/nmdc_api_utilities/collecting_biosamples_from_site_search.py b/nmdc_api_utilities/collecting_biosamples_from_site_search.py index 19e632a..0479bea 100644 --- a/nmdc_api_utilities/collecting_biosamples_from_site_search.py +++ b/nmdc_api_utilities/collecting_biosamples_from_site_search.py @@ -10,5 +10,5 @@ class CollectingBiosamplesFromSiteSearch(CollectionSearch): Class to interact with the NMDC API to get collecting biosamples from site sets. """ - def __init__(self): - super().__init__("collecting_biosamples_from_site_set") + def __init__(self, env="prod"): + super().__init__(collection_name="collecting_biosamples_from_site_set", env=env) diff --git a/nmdc_api_utilities/collection_helpers.py b/nmdc_api_utilities/collection_helpers.py index 7ea0518..6d4a666 100644 --- a/nmdc_api_utilities/collection_helpers.py +++ b/nmdc_api_utilities/collection_helpers.py @@ -12,8 +12,8 @@ class CollectionHelpers(NMDCSearch): These functions may not be specific to a particular collection. """ - def __init__(self): - super().__init__() + def __init__(self, env="prod"): + super().__init__(env=env) def get_record_name_from_id(self, doc_id: str): """ diff --git a/nmdc_api_utilities/collection_search.py b/nmdc_api_utilities/collection_search.py index 81c86e5..0124c60 100644 --- a/nmdc_api_utilities/collection_search.py +++ b/nmdc_api_utilities/collection_search.py @@ -13,9 +13,9 @@ class CollectionSearch(NMDCSearch): Class to interact with the NMDC API to get collections of data. Must know the collection name to query. """ - def __init__(self, collection_name): + def __init__(self, collection_name, env="prod"): self.collection_name = collection_name - super().__init__() + super().__init__(env=env) def get_records( self, @@ -166,57 +166,8 @@ def get_record_by_id( logging.debug( f"API request response: {response.json()}\n API Status Code: {response.status_code}" ) - - results = response.json()["resources"] - + results = response.json() return results - - def get_record_data_object_by_type( - self, - data_object_type: str = "", - max_page_size: int = 100, - fields: str = "", - all_pages: bool = False, - ): - """ - Get a collection of data from the NMDC API. Specific function to get a collection of data from the NMDC API, filtered by data object type. - params: - data_object_type: str - The data_object_type to filter by. Default is an empty string, which will return all data. - max_page_size: int - The maximum number of items to return per page. Default is 100. - fields: str - The fields to return. Default is all fields. - pages: bool - True to return all pages. False to return the first page. Default is False. - """ - results = [] - dp = DataProcessing() - # create the filter based on data object type - filter = f'{{"data_object_type":{{"$regex": "{data_object_type}"}}}}' - filter = urllib.parse.quote_plus(filter) - # if fields is empty, return all fields - if not fields: - fields = "id,name,description,alternative_identifiers,file_size_bytes,md5_checksum,data_object_type,url,type" - url = f"{self.base_url}/nmdcschema/data_object_set?filter={filter}&max_page_size={max_page_size}&projection={fields}" - # get the reponse - try: - response = requests.get(url) - response.raise_for_status() - except requests.exceptions.RequestException as e: - logger.error("API request failed", exc_info=True) - raise RuntimeError("Failed to get data object from NMDC API") from e - else: - logging.debug( - f"API request response: {response.json()}\n API Status Code: {response.status_code}" - ) - results = response.json()["resources"] - # otherwise, get all pages - if all_pages: - results = self._get_all_pages( - response, "data_object_set", filter, max_page_size, fields - )["resources"] - return dp.convert_to_df(results) def check_ids_exist(self, ids: list) -> bool: """ diff --git a/nmdc_api_utilities/configuration_search.py b/nmdc_api_utilities/configuration_search.py index bca45e2..a16d119 100644 --- a/nmdc_api_utilities/configuration_search.py +++ b/nmdc_api_utilities/configuration_search.py @@ -10,5 +10,5 @@ class ConfigurationSearch(CollectionSearch): Class to interact with the NMDC API to get cofiguration sets. """ - def __init__(self): - super().__init__("configuration_set") + def __init__(self, env="prod"): + super().__init__(collection_name="configuration_set", env=env) diff --git a/nmdc_api_utilities/data_generation_search.py b/nmdc_api_utilities/data_generation_search.py index 2529f76..773cea3 100644 --- a/nmdc_api_utilities/data_generation_search.py +++ b/nmdc_api_utilities/data_generation_search.py @@ -10,5 +10,5 @@ class DataGenerationSearch(CollectionSearch): Class to interact with the NMDC API to get data generation sets. """ - def __init__(self): - super().__init__("data_generation_set") + def __init__(self, env="prod"): + super().__init__(collection_name="data_generation_set", env=env) diff --git a/nmdc_api_utilities/data_object_search.py b/nmdc_api_utilities/data_object_search.py index aaf256e..b69e3a0 100644 --- a/nmdc_api_utilities/data_object_search.py +++ b/nmdc_api_utilities/data_object_search.py @@ -10,5 +10,5 @@ class DataObjectSearch(CollectionSearch): Class to interact with the NMDC API to get data object sets. """ - def __init__(self): - super().__init__("data_object_set") + def __init__(self, env="prod"): + super().__init__(collection_name="data_object_set", env=env) diff --git a/nmdc_api_utilities/field_research_site_search.py b/nmdc_api_utilities/field_research_site_search.py index 6211828..76de278 100644 --- a/nmdc_api_utilities/field_research_site_search.py +++ b/nmdc_api_utilities/field_research_site_search.py @@ -4,13 +4,11 @@ import logging logger = logging.getLogger(__name__) -# TODO - what are these - class FieldResearchSiteSearch(LatLongFilters, CollectionSearch): """ Class to interact with the NMDC API to get field research site sets. """ - def __init__(self): - super().__init__("field_research_site_set") + def __init__(self, env="prod"): + super().__init__("field_research_site_set", env=env) diff --git a/nmdc_api_utilities/functional_annotation_agg_search.py b/nmdc_api_utilities/functional_annotation_agg_search.py index f2962d4..d44ba0b 100644 --- a/nmdc_api_utilities/functional_annotation_agg_search.py +++ b/nmdc_api_utilities/functional_annotation_agg_search.py @@ -10,5 +10,5 @@ class FunctionalAnnotationAggSearch(FunctionalSearch): Class to interact with the NMDC API to get functional annotation agg sets. These are most helpful when trying identify workflows associted with a KEGG, COG, or PFAM ids. """ - def __init__(self): - super().__init__() + def __init__(self, env="prod"): + super().__init__(env=env) diff --git a/nmdc_api_utilities/functional_search.py b/nmdc_api_utilities/functional_search.py index 6003cad..5ec9295 100644 --- a/nmdc_api_utilities/functional_search.py +++ b/nmdc_api_utilities/functional_search.py @@ -8,8 +8,8 @@ class FunctionalSearch: Class to interact with the NMDC API to filter functional annotations by KEGG, COG, or PFAM ids. """ - def __init__(self): - self.collectioninstance = CollectionSearch("functional_annotation_agg") + def __init__(self, env="prod"): + self.collectioninstance = CollectionSearch(collection_name="functional_annotation_agg", env=env) def get_functional_annotations( self, @@ -70,4 +70,4 @@ def get_records( fields: str The fields to return. Default is all fields. """ - self.collectioninstance.get_records(filter, max_page_size, fields, all_pages) + return self.collectioninstance.get_records(filter, max_page_size, fields, all_pages) diff --git a/nmdc_api_utilities/instrument_search.py b/nmdc_api_utilities/instrument_search.py index 7127d39..020fd3a 100644 --- a/nmdc_api_utilities/instrument_search.py +++ b/nmdc_api_utilities/instrument_search.py @@ -10,5 +10,6 @@ class InstrumentSearch(CollectionSearch): Class to interact with the NMDC API to get instrument sets. """ - def __init__(self): - super().__init__("instrument_set") + def __init__(self, env="prod"): + super().__init__(collection_name="instrument_set", env=env) + diff --git a/nmdc_api_utilities/lat_long_filters.py b/nmdc_api_utilities/lat_long_filters.py index 51dc350..6f21d8b 100644 --- a/nmdc_api_utilities/lat_long_filters.py +++ b/nmdc_api_utilities/lat_long_filters.py @@ -10,9 +10,9 @@ class LatLongFilters(CollectionSearch): Class to interact with the NMDC API to filter sets by latitude and longitude. """ - def __init__(self, collection_name): + def __init__(self, collection_name, env="prod"): self.collection_name = collection_name - super().__init__(self.collection_name) + super().__init__(collection_name=self.collection_name, env=env) def get_record_by_latitude( self, comparison: str, latitude: float, page_size=25, fields="", all_pages=False diff --git a/nmdc_api_utilities/manifest_search.py b/nmdc_api_utilities/manifest_search.py index b60cbfa..a021287 100644 --- a/nmdc_api_utilities/manifest_search.py +++ b/nmdc_api_utilities/manifest_search.py @@ -10,5 +10,5 @@ class ManifestSearch(CollectionSearch): Class to interact with the NMDC API to get genome menifest sets. """ - def __init__(self): - super().__init__("manifest_set") + def __init__(self, env="prod"): + super().__init__(collection_name="manifest_set", env=env) diff --git a/nmdc_api_utilities/material_processing_search.py b/nmdc_api_utilities/material_processing_search.py index c3c05ce..af650e3 100644 --- a/nmdc_api_utilities/material_processing_search.py +++ b/nmdc_api_utilities/material_processing_search.py @@ -10,5 +10,5 @@ class MaterialProcessingSearch(CollectionSearch): Class to interact with the NMDC API to get material processing sets. """ - def __init__(self): - super().__init__("material_processing_set") + def __init__(self, env="prod"): + super().__init__(collection_name="material_processing_set", env=env) diff --git a/nmdc_api_utilities/metadata.py b/nmdc_api_utilities/metadata.py index f936f9f..eccbe5b 100644 --- a/nmdc_api_utilities/metadata.py +++ b/nmdc_api_utilities/metadata.py @@ -9,8 +9,8 @@ class Metadata(NMDCSearch): """ Class to interact with the NMDC API metadata. """ - def __init__(self): - super().__init__() + def __init__(self, env="prod"): + super().__init__(env=env) def validate_json(self, json_path) -> None: """ diff --git a/nmdc_api_utilities/minter.py b/nmdc_api_utilities/minter.py index e9abb28..e06d8d6 100644 --- a/nmdc_api_utilities/minter.py +++ b/nmdc_api_utilities/minter.py @@ -10,8 +10,8 @@ class Minter(NMDCSearch): """ Class to interact with the NMDC API to mint new identifiers. """ - def __init__(self): - super().__init__() + def __init__(self, env="prod"): + super().__init__(env=env) def mint(self, nmdc_type:str, client_id: str, client_secret: str) -> str: """ Mint a new identifier for a collection. diff --git a/nmdc_api_utilities/nmdc_search.py b/nmdc_api_utilities/nmdc_search.py index db70183..0359eec 100644 --- a/nmdc_api_utilities/nmdc_search.py +++ b/nmdc_api_utilities/nmdc_search.py @@ -5,5 +5,21 @@ class NMDCSearch: - def __init__(self): - self.base_url = "https://api.microbiomedata.org" + """ + Base class for interacting with the NMDC API. Sets the base URL for the API based on the environment. + """ + def __init__(self, env="prod"): + """ + Environment is defaulted to the production isntance of the API. This functionality is in place for monthly testing of the runtime updates to the API. + params + env: str + The environment to use. Default is prod. Must be one of the following: + prod + dev + """ + if env == "prod": + self.base_url = "https://api.microbiomedata.org" + elif env == "dev": + self.base_url = "https://api-dev.microbiomedata.org" + else: + raise ValueError("env must be one of the following: prod, dev") diff --git a/nmdc_api_utilities/processed_sample_search.py b/nmdc_api_utilities/processed_sample_search.py index 59eec26..0d6ed81 100644 --- a/nmdc_api_utilities/processed_sample_search.py +++ b/nmdc_api_utilities/processed_sample_search.py @@ -11,4 +11,4 @@ class ProcessedSampleSearch(CollectionSearch): """ def __init__(self): - super().__init__("processed_sample_set") + super().__init__(collection_name="processed_sample_set", env="prod") diff --git a/nmdc_api_utilities/protocol_execution_search.py b/nmdc_api_utilities/protocol_execution_search.py index 12ce6c1..0b97e91 100644 --- a/nmdc_api_utilities/protocol_execution_search.py +++ b/nmdc_api_utilities/protocol_execution_search.py @@ -10,5 +10,5 @@ class ProtocolExecutionSearch(CollectionSearch): Class to interact with the NMDC API to get protocol execution sets. """ - def __init__(self): - super().__init__("protocol_execution_set") + def __init__(self, env="prod"): + super().__init__(collection_name="protocol_execution_set", env=env) \ No newline at end of file diff --git a/nmdc_api_utilities/storage_process_search.py b/nmdc_api_utilities/storage_process_search.py index a1b967e..b8be1c1 100644 --- a/nmdc_api_utilities/storage_process_search.py +++ b/nmdc_api_utilities/storage_process_search.py @@ -10,5 +10,5 @@ class StorageProcessSearch(CollectionSearch): Class to interact with the NMDC API to get storage process sets. """ - def __init__(self): - super().__init__("storage_process_set") + def __init__(self, env="prod"): + super().__init__(collection_name="storage_process_set", env=env) diff --git a/nmdc_api_utilities/study_search.py b/nmdc_api_utilities/study_search.py index ee658e7..b32ccf7 100644 --- a/nmdc_api_utilities/study_search.py +++ b/nmdc_api_utilities/study_search.py @@ -10,5 +10,5 @@ class StudySearch(CollectionSearch): Class to interact with the NMDC API to get studies. """ - def __init__(self): - super().__init__("study_set") + def __init__(self, env="prod"): + super().__init__(collection_name="study_set", env=env) diff --git a/nmdc_api_utilities/test/test_biosample.py b/nmdc_api_utilities/test/test_biosample.py index a641086..e5fe77a 100644 --- a/nmdc_api_utilities/test/test_biosample.py +++ b/nmdc_api_utilities/test/test_biosample.py @@ -51,7 +51,7 @@ def test_biosample_by_longitude(): def test_biosample_by_lat_long(): # {"lat_lon.latitude": {"$gt": 45.0}, "lat_lon.longitude": {"$lt":45}} biosample = BiosampleSearch() - results = biosample.biosample_by_lat_long("gt", "lt", 45.0, 45.0) + results = biosample.get_record_by_lat_long("gt", "lt", 45.0, 45.0) assert len(results) > 0 assert results[0]["lat_lon"]["latitude"] == 63.875088 assert results[0]["lat_lon"]["longitude"] == -149.210438 diff --git a/nmdc_api_utilities/test/test_collection.py b/nmdc_api_utilities/test/test_collection.py index e2ccffc..f4db264 100644 --- a/nmdc_api_utilities/test/test_collection.py +++ b/nmdc_api_utilities/test/test_collection.py @@ -1,17 +1,43 @@ # -*- coding: utf-8 -*- from nmdc_api_utilities.collection_search import CollectionSearch +import unittest +from dotenv import load_dotenv +import os +load_dotenv() +ENV = os.getenv("ENV") +class TestCollection(unittest.TestCase): + """ + A class to test each endpoint in the CollectionSearch class. + """ + def test_get_records(self): + # simple test to check if the get_records method returns a list of records + collection = CollectionSearch("study_set", env=ENV) + results = collection.get_records(max_page_size=10) + assert len(results) == 10 -def test_get_collection(): - # testing the filters - collection = CollectionSearch() - results = collection.get_record("study_set") - assert len(results) > 0 - -def test_get_collection_data_object_by_type(): - collection = CollectionSearch() - results = collection.get_record_data_object_by_type( - "data_object_set", "nmdc:bsm-11-002vgm56" - ) - assert len(results) > 0 + def test_get_record_by_filter(self): + # simple test to check if the get_record_by_filter method returns a record + collection = CollectionSearch("study_set", env=ENV) + results = collection.get_record_by_filter(filter='{"id": "nmdc:sty-11-8fb6t785"}') + assert results[0]["id"] == "nmdc:sty-11-8fb6t785" + assert len(results) == 1 + + def test_get_record_by_attribute(self): + # simple test to check if the get_record_by_attribute method returns a record + collection = CollectionSearch("study_set", env=ENV) + results = collection.get_record_by_attribute("name", "Lab enrichment of tropical soil microbial communities from Luquillo Experimental Forest, Puerto Rico") + assert len(results) == 1 + + def test_get_record_by_id(self): + # simple test to check if the get_record_by_id method returns a record + collection = CollectionSearch("study_set", env=ENV) + results = collection.get_record_by_id("nmdc:sty-11-8fb6t785") + assert results["id"] == "nmdc:sty-11-8fb6t785" + + def test_check_ids_exist(self): + # simple test to check if the check_ids_exist method returns a boolean + collection = CollectionSearch("study_set",env=ENV) + results = collection.check_ids_exist(["nmdc:sty-11-8fb6t785"]) + assert results == True \ No newline at end of file diff --git a/nmdc_api_utilities/test/test_collection_helpers.py b/nmdc_api_utilities/test/test_collection_helpers.py new file mode 100644 index 0000000..59a4833 --- /dev/null +++ b/nmdc_api_utilities/test/test_collection_helpers.py @@ -0,0 +1,10 @@ +from nmdc_api_utilities.collection_helpers import CollectionHelpers +from dotenv import load_dotenv +import os +load_dotenv() +ENV = os.getenv("ENV") + +def test_get_record_name_from_id(): + ch = CollectionHelpers(env=ENV) + result = ch.get_record_name_from_id("nmdc:sty-11-8fb6t785") + assert result == "study_set" \ No newline at end of file diff --git a/nmdc_api_utilities/test/test_func_ann_agg.py b/nmdc_api_utilities/test/test_func_ann_agg.py index 0e1c097..d78ff5d 100644 --- a/nmdc_api_utilities/test/test_func_ann_agg.py +++ b/nmdc_api_utilities/test/test_func_ann_agg.py @@ -4,16 +4,25 @@ ) import logging import unittest - +from dotenv import load_dotenv +import os +load_dotenv() +ENV = os.getenv("ENV") class TestFunctionalAnnotation(unittest.TestCase): def test_func_ann_id(self): - fannagg = FunctionalAnnotationAggSearch() + fannagg = FunctionalAnnotationAggSearch(env=ENV) results = fannagg.get_functional_annotations("K01426", "KEGG") self.assertGreater(len(results), 0) self.assertEqual(results[0]["gene_function_id"], "KEGG.ORTHOLOGY:K01426") def test_func_ann_id_fail(self): - fannagg = FunctionalAnnotationAggSearch() + fannagg = FunctionalAnnotationAggSearch(env=ENV) with self.assertRaises(ValueError): fannagg.get_functional_annotations("K01426", "nfjbg") + + def test_get_records(self): + fannagg = FunctionalAnnotationAggSearch(env=ENV) + results = fannagg.get_records(max_page_size=10) + self.assertEqual(len(results), 10) + diff --git a/nmdc_api_utilities/test/test_study.py b/nmdc_api_utilities/test/test_study.py index 7ebbdaa..496c7a0 100644 --- a/nmdc_api_utilities/test/test_study.py +++ b/nmdc_api_utilities/test/test_study.py @@ -10,6 +10,11 @@ def test_find_study_by_attribute(): ) assert len(stu) > 0 +def test_find_study_by_id(): + st = StudySearch() + stu = st.get_record_by_id("nmdc:sty-11-8fb6t785") + assert len(stu) > 0 + assert stu["id"] == "nmdc:sty-11-8fb6t785" def test_find_study_by_filter(): st = StudySearch() @@ -34,4 +39,4 @@ def test_get_studies(): st = StudySearch() studies = st.get_records(max_page_size=100) print(studies) - assert len(studies) == 32 + assert len(studies) > 32 diff --git a/nmdc_api_utilities/workflow_execution_search.py b/nmdc_api_utilities/workflow_execution_search.py index 154e9db..73f3641 100644 --- a/nmdc_api_utilities/workflow_execution_search.py +++ b/nmdc_api_utilities/workflow_execution_search.py @@ -10,5 +10,5 @@ class WorkflowExecutionSearch(CollectionSearch): Class to interact with the NMDC API to get workflow execution sets. """ - def __init__(self): - super().__init__("workflow_execution_set") + def __init__(self, env="prod"): + super().__init__(collection_name="workflow_execution_set", env=env) diff --git a/pyproject.toml b/pyproject.toml index cf76df7..9d85ca7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "nmdc_api_utilities" -version = "0.3.3" +version = "0.3.4" description = "A Python library for general research functions using NMDC APIs" authors = [ { name = "Olivia Hess", email = "olivia.hess@pnnl.gov" }, diff --git a/requirements-dev.txt b/requirements-dev.txt index c8336c0..2331cdf 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,6 +2,9 @@ pre-commit pandas requests matplotlib +oauthlib +requests_oauthlib +dotenv sphinx sphinx_rtd_theme pytest