-
Notifications
You must be signed in to change notification settings - Fork 59
Conda package attempt #75
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
base: main
Are you sure you want to change the base?
Conversation
…define build recipe in meta.yaml and relevant fields. define conda environment.
|
green check, yes. note failures in pipeline... |
…for test step. add git at dependency to see if it keeps the pipeline happy.
|
current testing state is odd. In the pipeline, Additionally, in the pipeline, all |
…move most unneeded failure-guarding shell commands.
…st t/t001-list_paths.sh
…nge approach to resolving binDir in t/t001-list_paths- should possibly keep the pipeline happier. include mkmf in source files for test step of conda build. more echos, switch spot of echo output to avoid adjusting status of last-called shell command.
…he testing approach makes perfect sense locally- so why isnt the pipeline happy?
…tween string and ints in test success condition checks
…slowing this pipeline down for its own good!! (maybe...)
|
AHA! the failure in githhub's pipeline arises because the command there, for some reason, resolves the symbolic link file a little more simply: locally, the test |
|
relatively sure that once the |
|
It looks great, thanks! The What do you think about throwing in the noaa-gfdl anaconda channel key and having this pipeline publish as well as build. Too soon? It's odd that the tests needing adjusting (but then again I hadn't realized there were mkmf tests. :) |
nope!
no we can do it- i'll maybe say it should stick with an alpha version tag for now... at most, beta
100% conda build is derefencing links found in specified source files for the testing step! idk what the best way to deal with that is and not lose true quality control. |
put conda-relevant things in README- adjust markdown, update dependencies discussed. put disclaimer+license at the bottom of the readme to emphasize usage, installation, featurres etc.
update badge
…pty repo for pipeline-compatibility
|
All tests now pass without caveat in all contexts. |
ceblanton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, Ian. Bonus for the the documentation updates.
The templates still have to be installed somehow, right?
RE: these templates- |
|
It's odd that mkmf includes the code and the templates for compiling FMS models on selected platforms, but they're been used together like this for 20 years. I think it's a little more consistent to only conda install the mkmf and list-paths tools, but by tradition, we should probably include the templates in the conda package also. CatalogBuilder does this.. I'm not sure how it works, but e.g. the templates are installed alongside the bin and lib files. @Ciheim could explain it. For proof though, the GFDL default template (gfdl_template.json) is installed in fre-cli: |
using shell to drive workflows for decades will incentivize this kind of approach. unfortunately, given the way conda packages function... do we really want to be doing things like this? targeting the maybe we should consider de-coupling the templates and the code?
i'm sympathetic, i wanna figure it out.
It's not quite 1-1: |
|
i get the executables in the environment to $PREFIX/bin, because |
|
i think the ideal solution would be that |
|
Yes!! I agree that would be a natural solution. I was thinking of a dummy |
Pertaining to the templates for fre make functions, currently we have the path specified in the platforms.yaml: Ryan mentioned this in another issue as well (in relation to mkmf being a submodule but still applies): NOAA-GFDL/fre-cli#303 If the template is in a set location in the conda package, that would pretty nice to refer to that location and just have the name of the template in the platforms.yaml (for fre make things at least) |
|
My main problem with me implementing that in this PR is that i do not know |
|
Let's chat for a minute in-person on this when we can |
|
The templates should be a separate repository, as they're not really used by this repository out of necessity- they are a convenience for prospective users. We're informing this view point with the following:
|
… package directory.
slightly adjust current README instructions
test-run publish_conda workflow by asking it to run on push to `conda_package` branch, see what happens!
…gitlab/travis pipeline workflow files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, mkmf isn't really touched that much I don't think...right? If it was at all, Mikyung had that really nice addition in the fre-cli build_conda script:
https://github.com/NOAA-GFDL/fre-cli/blob/main/.github/workflows/build_conda.yml#L8-L10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not- but those bits that @mlee03 stuck in there are about redundant CI/CD workflows, not about the install. It's to use CI/CD minutes efficiently.
| conda install conda-build conda-verify | ||
| # set token and upload preference | ||
| export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my own clarification, what were the token and secrets for again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upload to the noaa-gfdl channel
| Usage as a `conda` package requires `conda`. | ||
|
|
||
| For testing, we recommend [`bats-core`](https://github.com/bats-core/bats-core), | ||
| a current and up-to-date (as of January 2025) fork of the original |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like there was a new release as of May 18th
| Kushner's suggestion). | ||
| Usage as a `conda` package requires `conda`. | ||
|
|
||
| For testing, we recommend [`bats-core`](https://github.com/bats-core/bats-core), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice to include what bats stands for (Bash Automated Testing System)..because I had no idea what it was 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and maybe a quick little blurb about why it's recommended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bats is standard bash testing infrastructure- given the link is there for a curious person to find bats-core doc with, i'm gonna disagree here.
and you're right, it's not recommended- it's required until someone comes up with something different for testing :-p.
| git clone https://github.com/noaa-gfdl/mkmf.git mkmf && cd mkmf | ||
| conda env create -y -f ./environment.yaml | ||
| conda activate mkmf | ||
| export $PATH=$PWD/mkmf/bin:$PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, why would it be necessary to add it to the path if there is a conda package for mkmf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is like the "developer install" of fre-cli- local code responds to local edits, so add the local mkmf/bin to PATH.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit unrelated, but do you know if anyone has made a simplified conda packaging guide at the lab or is it really, just follow along with tutorials online?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is really good development, so I'm just curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
none that i know of. generally, we should be consulting official packaging guides and encouraging others to do so. we should be very cautious about writing our own packaging guides on top of the official ones- that invites some pretty nasty potential mistakes/misunderstandings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... that being said i have some personal notes i can share that may shortcut you, just don't spread them around as a "packaging guide" :-p... follow up on that offline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wholeheartedly agree, just wondering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conda packaging is great candidate for the 5-10 minute MSD training topics, I agree.
I'm afraid yours truly attempted to do exactly this, building off of a Seth guide, as part of a conda MSD seminar a year or two ago, but the conda packaging parts were not that well-developed.
underwoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes, or additional information needed.
| requirements: | ||
| host: | ||
| - conda-forge::perl | ||
| - conda-forge::tcsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tcsh is not used in any of the mkmf tools anymore. This dependency can be removed.
| - conda-forge::bats-core | ||
| run: | ||
| - conda-forge::perl | ||
| - conda-forge::tcsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tcsh.
| test: | ||
| requires: | ||
| - conda-forge::perl | ||
| - conda-forge::tcsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed.
| binDir=$(readlink -f ${BATS_TEST_DIRNAME}/../mkmf/bin) | ||
| do_we_have_mkmf=$(which mkmf) || echo "no we do not!" | ||
| if [ $do_we_have_mkmf ]; then | ||
| echo 'likely conda case' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to make this more clear. I think I understand why this is done, but I could be wrong. Add comments or a better string to help someone who comes along later to know why this check is here.
Also, it is better to do something like:
if [ $(command -v mkmf) ]
then
echo "mkmf already in PATH. Not adding \"${binDir}\" to PATH."
else
PATH=${binDir}:$PATH
fi
export PATH
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this more, I don't think you will want to do this check. This is a test to verify that the mkmf in the repository passes the tests. If mkmf is anywhere in PATH, even if the user adds their own copy, then the test will run that copy, and likely hide any issues the test will attempt to find. I strongly suggest removing this, unless you have a good reason otherwise.
| # set PATH if needed | ||
| binDir=$(readlink -f ${BATS_TEST_DIRNAME}/../mkmf/bin) | ||
| do_we_have_mkmf=$(which mkmf) || echo "no we do not!" | ||
| if [ $do_we_have_mkmf ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
| } | ||
|
|
||
| teardown() { | ||
| rm -f ${BATS_TEST_DIRNAME}/src/file6.f90 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this file is in testDir, then you won't need this specific file removal.
| [ "$status" -eq 0 ] | ||
| [ -e path_names ] | ||
| [ "$(wc -l < path_names)" -eq 6 ] | ||
| num_paths=$(cat path_names | wc -l) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making a function to do this check.
| # set PATH if needed | ||
| binDir=$(readlink -f ${BATS_TEST_DIRNAME}/../mkmf/bin) | ||
| do_we_have_mkmf=$(which mkmf) || echo "no we do not!" | ||
| if [ $do_we_have_mkmf ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
| # set PATH if needed | ||
| binDir=$(readlink -f ${BATS_TEST_DIRNAME}/../mkmf/bin) | ||
| do_we_have_mkmf=$(which mkmf) || echo "no we do not!" | ||
| if [ $do_we_have_mkmf ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
| # set PATH if needed | ||
| binDir=$(readlink -f ${BATS_TEST_DIRNAME}/../mkmf/bin) | ||
| do_we_have_mkmf=$(which mkmf) || echo "no we do not!" | ||
| if [ $do_we_have_mkmf ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
this PR:
meta.yamlandbuild.shto define theconda buildpackage recipeenvironment.ymldefining fully functionalcondaenvironment inwhichmkmfshould workbin/executables under a nestedmkmf"package" directory forconda buildrecipe compatibilityconda buildunder github's CI/CD pipelines,conda build .--no-anaconda-uploadversion in.github/workflows/build_conda.yml, with uploading in.github/workflows/publish_conda.yml. run conditions identical to that offre-cli.travis.yaml,.gitlab-ci.yml)list_paths prints versionregex reflect recent version stringst/t001-list_paths.shdoes set-up, now createst/src/file6.f90symbolic link on-the-fly. removed at end of each of those testsPATHand adjusts only if needed. abovefile6.f90link creation done on-the-fly fort/t003-mkmf.shas well.