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

Changing packaging structure #5

Merged
merged 40 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
eefe4e2
Create __init__.py
aradhakrishnanGFDL Jul 19, 2024
f6799f3
rearranging dirs since the landscape has evolved
aradhakrishnanGFDL Jul 19, 2024
3f6c8a9
meta yml test updated
aradhakrishnanGFDL Jul 19, 2024
81a5757
moving scripts
aradhakrishnanGFDL Jul 19, 2024
5bdc2f0
Update meta.yaml
aradhakrishnanGFDL Jul 19, 2024
9d6048f
Update publish-conda.yml
aradhakrishnanGFDL Jul 19, 2024
bdf6312
Delete scripts/__init__.py
aradhakrishnanGFDL Jul 19, 2024
00fc556
Delete intakebuilder/__init__.py
aradhakrishnanGFDL Jul 19, 2024
b8175a0
Update publish-conda.yml
aradhakrishnanGFDL Jul 19, 2024
97283dd
Update create-gfdl-catalog.yml
aradhakrishnanGFDL Jul 19, 2024
31e6e6e
Update publish-conda.yml
aradhakrishnanGFDL Jul 19, 2024
839b7bf
Update meta.yaml
aradhakrishnanGFDL Jul 19, 2024
6dd7410
Delete scripts directory
aradhakrishnanGFDL Jul 19, 2024
6e8ae71
Delete intakebuilder directory
aradhakrishnanGFDL Jul 19, 2024
1fa7910
Update test_config.yaml
aradhakrishnanGFDL Jul 19, 2024
6521d68
Update meta.yaml
aradhakrishnanGFDL Jul 19, 2024
91752a9
Update test_catalog.py
aradhakrishnanGFDL Jul 19, 2024
ef86c6d
Update test_ingestion.py
aradhakrishnanGFDL Jul 19, 2024
78897ff
Update test_import.py
aradhakrishnanGFDL Jul 19, 2024
cf33250
Update test_import.py
aradhakrishnanGFDL Jul 19, 2024
f13771b
Update meta.yaml
aradhakrishnanGFDL Jul 19, 2024
dfa4629
Update test_import.py
aradhakrishnanGFDL Jul 19, 2024
d72f406
Update test_import.py
aradhakrishnanGFDL Jul 19, 2024
50944f3
Update test_import.py
aradhakrishnanGFDL Jul 19, 2024
8c87b1d
Update create-gfdl-catalog.yml
aradhakrishnanGFDL Jul 19, 2024
167f7b6
Update gen_intake_gfdl_runner.py
aradhakrishnanGFDL Jul 19, 2024
1b7dadf
Update gen_intake_gfdl_notebook.ipynb
aradhakrishnanGFDL Jul 19, 2024
5cf5b9e
Update gen_intake_gfdl_runner_config.py
aradhakrishnanGFDL Jul 19, 2024
9c923fc
tweak meta.yaml, setup.py for requirements.
ilaflott Jul 22, 2024
f1ab693
fixup import things. breakup some long lines.
ilaflott Jul 22, 2024
6965b94
Update create-gfdl-catalog.yml
ilaflott Jul 22, 2024
6b70e56
... is it because github CI/CD doesn't preserve things between steps …
ilaflott Jul 22, 2024
be073ac
one more idea...
ilaflott Jul 22, 2024
e9766e5
ONE LAST IDEA i swear.
ilaflott Jul 22, 2024
49dc0af
OK so there's a few things happening in the workflows.
ilaflott Jul 22, 2024
c12f60c
.... should prob activate the created conda env...
ilaflott Jul 22, 2024
1435204
conda init before conda activate...
ilaflott Jul 22, 2024
a328d8c
use miniconda3 docker image, auto-activate catalogbuilder env created…
ilaflott Jul 22, 2024
59e72b1
oops
ilaflott Jul 22, 2024
a82f589
revert to last working state before i broke it
ilaflott Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/create-gfdl-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
run: python tests/make_sample_data.py
- name: 'Generate catalog'
run: |
$CONDA/envs/catalogbuilder/bin/python scripts/gen_intake_gfdl.py archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp gfdl_autotest
$CONDA/envs/catalogbuilder/bin/python catalogbuilder/scripts/gen_intake_gfdl.py archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp gfdl_autotest
- name: 'Generate catalog with yaml'
run: |
$CONDA/envs/catalogbuilder/bin/python scripts/gen_intake_gfdl.py --config tests/test_config.yaml
$CONDA/envs/catalogbuilder/bin/python catalogbuilder/scripts/gen_intake_gfdl.py --config tests/test_config.yaml
- name: upload-artifacts1
uses: actions/upload-artifact@v4
with:
Expand All @@ -50,5 +50,5 @@ jobs:
$CONDA/envs/catalogbuilder/bin/pytest -v --runxfail
- name: Test for completeness
run: |
$CONDA/envs/catalogbuilder/bin/python scripts/test_catalog.py -tf gfdl_autotest.json cats/gfdl_template.json
$CONDA/envs/catalogbuilder/bin/python scripts/test_catalog.py -tf cats/gfdl_autotest_from_yaml.json
$CONDA/envs/catalogbuilder/bin/python catalogbuilder/scripts/test_catalog.py -tf gfdl_autotest.json catalogbuilder/cats/gfdl_template.json
$CONDA/envs/catalogbuilder/bin/python catalogbuilder/scripts/test_catalog.py -tf catalogbuilder/cats/gfdl_autotest_from_yaml.json
3 changes: 2 additions & 1 deletion .github/workflows/publish-conda.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: publish_conda
on:
push:
pull_request:
branches:
#for testing the restructuring, back on push only later.
- main
jobs:
build_and_publish:
Expand Down
1 change: 1 addition & 0 deletions catalogbuilder/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
],
"source": [
"from scripts import gen_intake_gfdl\n",
"from catalogbuilder.scripts import gen_intake_gfdl\n",
"import sys,os\n",
"\n",
"######USER input begins########\n",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

from scripts import gen_intake_gfdl
#TODO test after conda pkg is published and make changes as needed
from catalogbuilder.scripts import gen_intake_gfdl
import sys

input_path = "/archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp/"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

from scripts import gen_intake_gfdl
from catalogbuilder.scripts import gen_intake_gfdl
import sys

sys.argv = ['input_path','--config', '/home/a1r/github/CatalogBuilder/scripts/configs/config-example.yml']
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def main(json_path,json_template_path,test_failure):
if json_template_path:
json_template = json.load(open(json_template_path))
else:
json_template = json.load(open('cats/gfdl_template.json'))
json_template = json.load(open('catalogbuilder/cats/gfdl_template.json'))

#Validate JSON against JSON template
comp = (diff(j,json_template))
Expand Down
18 changes: 10 additions & 8 deletions meta.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package:
name: intakebuilder
name: catalogbuilder
version: 2.0.1

source:
git_url: https://github.com/aradhakrishnanGFDL/CatalogBuilder.git
git_url: https://github.com/NOAA-GFDL/CatalogBuilder.git
git_branch: subpkgtest
path: .

build:
Expand All @@ -16,16 +17,17 @@ requirements:
- pip
run:
- python
- pytest
- click
- pandas
- xarray
- pytest
- conda-forge::intake-esm=2023.7.7
- pandas
- jsondiff
- conda-forge::intake-esm=2023.7.7
- boto3
test:
imports:
- intakebuilder
- scripts.gen_intake_gfdl

- catalogbuilder
- catalogbuilder.scripts
- catalogbuilder.cats
about:
home:
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
'click',
'xarray',
'pandas',
'boto3',
'botocore'
'jsondiff',
'intake-esm',
'boto3'
]
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ output_file_template: ['modeling_realm','temporal_subset','variable_id']
#######################################################

input_path: "archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp/" #"ENTER INPUT PATH HERE" #Example: /Users/ar46/archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp/"
output_path: "cats/gfdl_autotest_from_yaml" # ENTER NAME OF THE CSV AND JSON, THE SUFFIX ALONE. e.g catalog (the builder then generates catalog.csv and catalog.json. This can also be an absolute path)
output_path: "catalogbuilder/cats/gfdl_autotest_from_yaml" # ENTER NAME OF THE CSV AND JSON, THE SUFFIX ALONE. e.g catalog (the builder then generates catalog.csv and catalog.json. This can also be an absolute path)
19 changes: 15 additions & 4 deletions tests/test_import.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import os,sys
def check_import():
try:
from intakebuilder import getinfo, localcrawler, CSVwriter
print("Imported intakebuilder and getinfo, localcrawler, CSVwriter ")
from intakebuilder import gfdlcrawler, CSVwriter, configparser
except ImportError:
raise ImportError('Error importing intakebuilder and other packages')
return -97
print("The module intakebuilder is not installed. Do you have intakebuilder in your sys.path or have you activated the conda environment with the intakebuilder package in it? ")
print("Attempting again with adjusted sys.path ")
try:
#candobetter with actual conda package built before this, but this is a decent test for those that do not use conda package
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+"/catalogbuilder")
from intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser
except:
print("Unable to adjust sys.path")
raise ImportError('Error importing intakebuilder and other packages')
return -97
return True

def test_import():
assert check_import() == True


2 changes: 1 addition & 1 deletion tests/test_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def load_cat(catspec=None):
return cat
def test_loadcat():
#TODO generate csv on the fly, check if its readable etc
catspec = pathlib.Path(os.path.dirname(__file__)).parent / 'cats/gfdl_template.json'
catspec = pathlib.Path(os.path.dirname(__file__)).parent / 'catalogbuilder/cats/gfdl_template.json'
#TODO generate test catalog on the fly, push spec to the test directory
cat = load_cat((str(catspec)))
try:
Expand Down
Loading