Skip to content

Adding dismod-at to conda-forge #29516

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

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open

Conversation

bradbell
Copy link
Contributor

Checklist

  • Title of this PR is meaningful: e.g. "Adding my_nifty_package", not "updated meta.yaml".
  • License file is packaged (see here for an example).
  • Source is from official source.
  • Package does not vendor other packages. (If a package uses the source of another package, they should be separate packages or the licenses of all packages need to be packaged).
  • If static libraries are linked in, the license of the static library is packaged.
  • Package does not ship static libraries. If static libraries are needed, follow CFEP-18.
  • Build number is 0.
  • A tarball (url) rather than a repo (e.g. git_url) is used in your recipe (see here for more details).
  • GitHub users listed in the maintainer section have posted a comment confirming they are willing to be listed there.
  • When in trouble, please check our knowledge base documentation before pinging a team.

Copy link
Contributor

Hi! This is the staged-recipes linter and your PR looks excellent! 🚀

@conda-forge-admin
Copy link
Contributor

conda-forge-admin commented Mar 24, 2025

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipes/dismod-at/recipe.yaml) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipes/dismod-at/recipe.yaml:

  • ℹ️ Recipes should usually depend on matplotlib-base as opposed to matplotlib so that runtime environments do not require large packages like qt.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/14091017934. Examine the logs at this URL for more detail.

@conda-forge-admin
Copy link
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/dismod-at/recipe.yaml) and found some lint.

Here's what I've got...

For recipes/dismod-at/recipe.yaml:

  • ❌ If python is a host requirement, it should be a run requirement.

For recipes/dismod-at/recipe.yaml:

  • ℹ️ Recipes should usually depend on matplotlib-base as opposed to matplotlib so that runtime environments do not require large packages like qt.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/14092879725. Examine the logs at this URL for more detail.

@conda-forge-admin
Copy link
Contributor

conda-forge-admin commented Mar 26, 2025

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipes/dismod-at/recipe.yaml) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipes/dismod-at/recipe.yaml:

  • ℹ️ Recipes should usually depend on matplotlib-base as opposed to matplotlib so that runtime environments do not require large packages like qt.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/14271047660. Examine the logs at this URL for more detail.

@conda-forge-admin
Copy link
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/dismod-at/recipe.yaml) and found some lint.

Here's what I've got...

For recipes/dismod-at/recipe.yaml:

  • ❌ If python is a host requirement, it should be a run requirement.

For recipes/dismod-at/recipe.yaml:

  • ℹ️ Recipes should usually depend on matplotlib-base as opposed to matplotlib so that runtime environments do not require large packages like qt.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/14274063004. Examine the logs at this URL for more detail.

bradbell and others added 2 commits April 7, 2025 06:09
@bradbell
Copy link
Contributor Author

@matthewfeickert
All of the tests seem to be passing now, except for using the dismod-at script after it is installed on Windows.
This is being tested by recipes/dismod-at/run_test.py

The dismod_at script appears in the projects pyproject.toml file as

[project.scripts]
dismod-at = 'dismod_at:main'

There also is a dismod_at executable created from C++ , but it seems to be working fine.

The failure is happening during the run_test.py script. If you search for run_test.py: in test section of
https://dev.azure.com/conda-forge/84710dde-1620-425b-80d0-4cf5baca359d/_apis/build/builds/1223573/logs/28
you will see

run_test.py: platform.system() =  Windows
run_test.py: found \bld\bld\rattler-build_dismod-at_1744462991\work\test\run\Library/bin/dismod_at.exe
run_test.py: found \bld\bld\rattler-build_dismod-at_1744462991\work\test\run\Scripts/dismod-at.exe

So it appears to me that the dismod-at script should be in the executable path.

I do not know why it fails to execute. If you look at the original test file
https://github.com/bradbell/dismod_at/blob/master/test/user/db2csv.py
The sandbox version is running as can be seen by searching for db2csv.py: OK in the build section of
https://dev.azure.com/conda-forge/84710dde-1620-425b-80d0-4cf5baca359d/_apis/build/builds/1223573/logs/28

There are some replacements made by run_test.py to test the installed instead of sandbox version.

@matthewfeickert
Copy link
Member

 │ Installing test environment
 │  Successfully updated the test environment
 │ Testing commands:
 │ (base) %PREFIX%\etc\conda\test-files\dismod-at\0>IF "" == "" (
 │  
 │  call %SRC_DIR%\build_env.bat 
 │ ) 
 │ (base) %PREFIX%\etc\conda\test-files\dismod-at\0>python "D:\\bld\\bld\\rattler-build_dismod-at_1744462991\\work\\test\\run\\etc/conda/test-files/dismod-at/0\\conda_build_script.py" 
 │ run_test.py: prefix with / and \ repalced by |
 │ D:|bld|bld|rattler-build_dismod-at_1744462991|work|test|run
 │ run_test.py: sys.path =
 │ ['D:\\bld\\bld\\rattler-build_dismod-at_1744462991\\work\\test\\run\\etc\\conda\\test-files\\dismod-at\\0', 'D:\\bld\\bld\\rattler-build_dismod-at_1744462991\\work\\test\\run\\python39.zip', 'D:\\bld\\bld\\rattler-build_dismod-at_1744462991\\work\\test\\run\\DLLs', 'D:\\bld\\bld\\rattler-build_dismod-at_1744462991\\work\\test\\run\\lib', 'D:\\bld\\bld\\rattler-build_dismod-at_1744462991\\work\\test\\run', 'D:\\bld\\bld\\rattler-build_dismod-at_1744462991\\work\\test\\run\\lib\\site-packages']
 │ run_test.py: sys.argv[0] = D:\\bld\\bld\\rattler-build_dismod-at_1744462991\\work\\test\\run\\etc/conda/test-files/dismod-at/0\\conda_build_script.py
 │ run_test.py: platform.system() =  Windows
 │ run_test.py: found \bld\bld\rattler-build_dismod-at_1744462991\work\test\run\Library/bin/dismod_at.exe
 │ run_test.py: found \bld\bld\rattler-build_dismod-at_1744462991\work\test\run\Scripts/dismod-at.exe
 │ python test/user/db2csv.py
 │ test/user/db2csv.py
 │ dismod_at example.db set option hold_out_integrand 
 │ dismod_at example.db init
 │ dismod_at example.db bnd_mulcov 0.0
 │ dismod_at example.db fit fixed
 │ dismod_at example.db fit fixed warm_start
 │ dismod-at build/test/user/example.db db2csv
 │ × error Script failed with status 1
 │ × error Work directory: 'D:\bld\bld\rattler-build_dismod-at_1744462991\work\test\run\etc/conda/test-files/dismod-at/0'
 │ × error To debug the build, run it manually in the work directory (execute the `./conda_build.sh` or `conda_build.bat` script)
 │
 ╰─────────────────── (took 71 seconds)
Error:   × failed to run test: Script failed

Traceback (most recent call last):
  File "D:\a\1\s\.ci_support\build_all.py", line 390, in <module>
    build_all(os.path.join(root_dir, "recipes"), args.arch)
  File "D:\a\1\s\.ci_support\build_all.py", line 206, in build_all
    build_folders_rattler_build(recipes_dir, platform, arch, channel_urls)
  File "D:\a\1\s\.ci_support\build_all.py", line 321, in build_folders_rattler_build
    subprocess.run(args + ["--variant-config", fp.name], check=True)
  File "D:\Miniforge\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['rattler-build', 'build', '--recipe-dir', 'D:\\a\\1\\s\\recipes', '--target-platform', 'win-64', '-c', 'D:\\bld', '-c', 'conda-forge', '--variant-config', 'C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\tmpx7hetfvh']' returned non-zero exit status 1.
##[error]Cmd.exe exited with code '1'.

Do you have a Windows machine that you can test your build on locally? Can you get more verbose output from the failing test? Have you validated that all files needed for your tests are present?

recipe.yaml: add sqlite3 as a test requirement.
@bradbell
Copy link
Contributor Author

Do you have a Windows machine that you can test your build on locally? Can you get more verbose output from the failing test? Have you validated that all files needed for your tests are present?

Yes, I have been testing on a windows machine, but just directly building and installing in a temp conda environment. I should try and run the build there and see what happens. Thanks.

@bradbell
Copy link
Contributor Author

bradbell commented Apr 13, 2025

The tests ran successfully using rattler-build on my windows machine. Here is the script I used to run it

set variant=win64.yaml
set recipe=recipes\dismod-at\recipe.yaml
del /s /q output/bld
rem
rattler-build build ^
        --test native ^
        --keep-build ^
        -m .ci_support/%variant% ^
        --log-style plain ^
        --recipe %recipe%
rem
echo conda_build.sh: Done

@matthewfeickert
Copy link
Member

By

Do you have a Windows machine that you can test your build on locally?

I mean have you been running the build-locally.py locally and are you able to compare the results?

@bradbell
Copy link
Contributor Author

bradbell commented Apr 14, 2025

Where are the instructions for running build-locally.py ?
I get the following in linux:

...
Building all recipes
+ python /home/conda/staged-recipes-copy/.ci_support/build_all.py
Found no recipes to build

@matthewfeickert
Copy link
Member

@bradbell
Copy link
Contributor Author

Where are the instructions for running build-locally.py ?

In the README: https://github.com/conda-forge/staged-recipes/blob/bbcbafaed55a25652d22630d31110d7a52fcf0e0/README.md#local-debugging-with-build-locallypy

The only instructions I found on the page above for building were

pixi run build-linux:

This eventually gave the same error as above; i.e. , it does not know were the recipe.yaml is (starting in the staged-recipe.git direcotory).

@matthewfeickert
Copy link
Member

The only instructions I found on the page above for building were

pixi run build-linux:

staged-recipes/README.md

Lines 48 to 55 in bbcbafa

`build-locally.py` can be run with any recent Python, or via a [`pixi`](#pixi) task:
* `pixi run build-linux`: will launch a Docker container, provision all the necessary tools and build your recipe for Linux.
* `pixi run build-osx`: will provision a conda environment with the necessary tools to build your recipe for macOS. This involves fetching and caching the necessary Apple SDKs.
* `pixi run build-win`: will provision a conda environment with the necessary tools to build your recipe for Windows.
These tasks will pass any extra arguments to `build-locally.py`, including `--help`. The resulting
artifacts will be available under `build_artifacts`.

This eventually gave the same error as above; i.e. , it does not know were the recipe.yaml is (starting in the staged-recipe.git direcotory).

oh. I see now that you're also not on a development/feature branch but are on main

2. Make a new branch from `main` for your package's recipe.

In general avoid doing this for any PR and that's going to potentially cause issues for local debugging as it figures out what recipes to build by what differs from main, which is why there was this mention added in PR #29226. For PRs you're comparing against the target branch, so things will still work, but for local builds it is going to delete the recipe.

@bradbell
Copy link
Contributor Author

Now I see the following instructions:

1. Fork this repository.
2. Make a new branch from main for your package's recipe.
3. Make a new folder in recipes for your package.

Does it matter what I name the branch ?
It seems to me that it does matter what I name the folder (that will be the package name correct ?).

@matthewfeickert
Copy link
Member

Does it matter what I name the branch ?

Good question. No, that's totally arbitrary. The internal logic is just that it is comparing the recipes that exist on the source branch to the target branch of main.

Mind you that the build failure in CI is something different though, so if you want to continue to debug here that's fine. Though I might suggest that you ask for advice on the conda-forge Zulip, as I don't know if I can provide anything super actionable.

It seems to me that it does matter what I name the folder (that will be the package name correct ?).

Another good question. I think this is also arbitrary, as the recipe YAML file and any other supporting files are the only things that matter in the end, but I'm not 100% sure on this.

@bradbell
Copy link
Contributor Author

bradbell commented Apr 16, 2025

Please note the following comment in run_test.py:

      #
      # skip
      # test/user/db2csv.py tests the installed dismod-at python script.
      # This is failing on the conda-forge test machine, but works
      # doing a local rattler-build on a windows machine. At this point
      # I think it is a problem with the conda test system.
     skip = test_file=='test/user/db2csv.py' and platform.system() =='Windows'

You can set skip equal to False and run the test on your local system as a check; see
#29516 (comment)

@bradbell
Copy link
Contributor Author

@conda-forge/help-python-c, ready for review

@@ -0,0 +1,80 @@
# conda-verify warnings:
Copy link
Member

Choose a reason for hiding this comment

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

Please remove all the comments here. They seem to be quite "empty"

Comment on lines 10 to 11
%BUILD_PREIX%\Library\lib\pkgconfig;^
%BUILD_PREIX%\Library\share\pkgconfig;
Copy link
Member

Choose a reason for hiding this comment

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

This is not correct. pkg-config should not point to BUILD_PREFIX. Please remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xhochy

Please remove all the comments here. They seem to be quite "empty" .
This is not correct. pkg-config should not point to BUILD_PREFIX. Please remove this.

Done in the following commit:
b44d02ff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants