Skip to content

Convert feedstock to v1 recipe format#361

Merged
h-vetinari merged 2 commits intoconda-forge:mainfrom
lgray:convert_feedstock_to_v1_recipe_format
Jul 15, 2025
Merged

Convert feedstock to v1 recipe format#361
h-vetinari merged 2 commits intoconda-forge:mainfrom
lgray:convert_feedstock_to_v1_recipe_format

Conversation

@lgray
Copy link
Copy Markdown
Contributor

@lgray lgray commented Jul 7, 2025

This PR converts numpy-feedstock to a v1 recipe and switches the conda build tool to rattler-build.
It has been partially generated with feedrattler v0.3.13 and portions fixed by hand.

Changes:

  • 📝 Converted meta.yaml to recipe.yaml
  • Used a personal fork of the feedstock to propose changes
  • 🔧 Updated conda-forge.yml to use rattler-build and pixi (optional)
  • 🔢 Bumped the build number
  • 🐍 Applied temporary fixes for python_min and python_version
  • 🔄 Rerender the feedstock with conda-smithy
  • Ensured the license file is being packaged.

Please merge this as you like, if you're waiting on the spec or rattler-build to become more stable that's fine.
Mostly, I'm playing with it in my spare time with more difficult packages, it shouldn't hurt to see where there are rough edges.
If this is somehow a major draw to someone's time aside from my own, please let me know, I'm fine with doing something else.

@conda-forge-admin
Copy link
Copy Markdown
Contributor

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 (recipe/recipe.yaml) and found it was in an excellent condition.

@rgommers
Copy link
Copy Markdown
Contributor

rgommers commented Jul 8, 2025

Thanks for working on this @lgray! I'm definitely keen to migrate to rattler-build, it's just so much nicer to work with. This looks like a significant improvement, and also fixes the linter complaints that are visible with conda-build (see for example #360 (comment)).

CI logs look quite good, one question about the warnings visible at the bottom for the Windows and macOS builds - are these expected?

⚠ warning Overlinking against "/usr/lib/libSystem.B.dylib" for "lib/python3.13t/site-packages/numpy/random/_common.cpython-313t-darwin.so"

@lgray
Copy link
Copy Markdown
Contributor Author

lgray commented Jul 8, 2025

Cool, nice to have that pleasant side effect concerning the blas tests!

The "overlinking against libSystem.B.dylib and python3XY.dll" complaints I've seen in other packages I've converted. They appear to be harmless, since logically your python module shall eventually need symbols from python and anything eventually needs symbols from core system libraries. It may just be indirect depending on what part of the package you're looking at in a specific shared lib. That's my personal understanding, at least.

If there's a serious performance reason (some memory mapping or locality issue) I don't understand that's critical here, we can dig. I'll go ahead and open an issue over in rattler-build, unless there already is one in which case I will link this PR.

@lgray
Copy link
Copy Markdown
Contributor Author

lgray commented Jul 8, 2025

Ah yeah the main developer sees it too for macos:
prefix-dev/rattler-build#1260

But seems fine with it?


context:
version: 2.3.1
dev: nodev
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we use something like "null" here instead of some arbitrary string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I never tried null specifically but it complained loudly on empty strings. Shall give it a go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, yeah same complaint when using null:

Error: 
  × expected a scalar value.
   ╭─[recipe/recipe.yaml:6:8]
 5 │   version: 2.3.1
 6 │   dev: null
   ·        ──┬─
   ·          ╰── here
 7 │   # numpy will by default use the ABI feature level for the first numpy version
   ╰────
  help: `context` values must always be scalars (booleans, integers or strings) or uniform lists of scalars

What would you prefer instead of "nodev"?

Copy link
Copy Markdown
Contributor Author

@lgray lgray Jul 8, 2025

Choose a reason for hiding this comment

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

I guess you may have meant "null" as a string as opposed to null the keyword? Still at that point it is some arbitrary string.

I could use a number? -1 works. I have done this for now and added a comment as to intended usage.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess you may have meant "null" as a string as opposed to null the keyword?

No, I meant the keyword. As you mention, "null" would just be yet another arbitrary string, and a very confusing one at that.

Given that we can't use empty strings, I'd like to switch this to something like rc_num. If it's -1, we ignore it, if it's >=0, we construct a rc${{ rc_num }} suffix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah but then you're doing if: (rc_num | int) > -1 whenever we need to do control flow.

if: rc_num != "-1"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Whatever you're cool with, but that will accept "-2" or "nosegoblins" as viable rc_num values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I fully understand that, but we still have human reviewers in the loop here (and trivially, no tag for that would be found, so CI would be deep red). Making this fool-proof or "fuzzing" the recipe is not the right trade-off.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No prob! Will make the change when back at a computer with a keyboard.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done!

@lgray lgray force-pushed the convert_feedstock_to_v1_recipe_format branch from e9c8d59 to 4fe376a Compare July 8, 2025 13:17
@lgray lgray force-pushed the convert_feedstock_to_v1_recipe_format branch 2 times, most recently from 80fdea0 to 59250ac Compare July 8, 2025 14:12
@lgray
Copy link
Copy Markdown
Contributor Author

lgray commented Jul 8, 2025

I see in .ci_support that this deleted a bunch of lines like:

numpy:
- '2'

Does this need to remain or it's an obsolete artifact from the release of numpy 2?

@h-vetinari
Copy link
Copy Markdown
Member

Does this need to remain or it's an obsolete artifact from the release of numpy 2?

It's an obsolete artefact of the fact that conda{,-smithy} sees that the recipe mentions numpy, thinks it depends on it, and thus needs to apply the values from the global pinning. It's harmless but good to remove these values from the variant configs.

@lgray lgray force-pushed the convert_feedstock_to_v1_recipe_format branch 2 times, most recently from a3b1c7a to ca72588 Compare July 8, 2025 23:57
@lgray
Copy link
Copy Markdown
Contributor Author

lgray commented Jul 9, 2025

Good - one of the rattler-build devs finds the overlinking complaints in windows benign.

@lgray
Copy link
Copy Markdown
Contributor Author

lgray commented Jul 11, 2025

Is there any further review for this PR?

@h-vetinari
Copy link
Copy Markdown
Member

Can you reduce this to two commits please: one for the recipe transformation, and one for rerendering.

@lgray
Copy link
Copy Markdown
Contributor Author

lgray commented Jul 11, 2025

certainly!

@lgray lgray force-pushed the convert_feedstock_to_v1_recipe_format branch from ca72588 to 80d7143 Compare July 11, 2025 14:04
Copy link
Copy Markdown
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

getting close, but a few nits remain


package:
name: numpy
version: ${{ version }}${{ "rc" + rc_num if rc_num != "-1" else "" }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd like the precedence clearer here. Also, string concatenation in jinja should use ~ AFAIU; + is unreliable.

Suggested change
version: ${{ version }}${{ "rc" + rc_num if rc_num != "-1" else "" }}
version: ${{ version }}${{ ("rc" ~ rc_num) if rc_num != "-1" else "" }}

Copy link
Copy Markdown
Contributor Author

@lgray lgray Jul 15, 2025

Choose a reason for hiding this comment

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

Ah, I did not know about the ~ operator in jinja! As it performs conversion to string, this would allow us to use an integer for rc_num in a pleasant way, as originally discussed. Up to you, it lints and re-renders fine locally.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done, using an int for rc_num.

- pytz
- if: match(python, "<=3.11")
then: setuptools <60.0.0
- if: match(python, ">=3.12")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use else: here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

- if: linux
then: ${{ compiler('fortran') }}
- pkg-config

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove this newline, those two blocks form a unit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done


context:
version: 2.3.1
# -1 means "not a dev version", a number > -1 will emit postfix "rc${{ rc_num }}"
Copy link
Copy Markdown
Member

@h-vetinari h-vetinari Jul 15, 2025

Choose a reason for hiding this comment

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

comment is out-dated

Suggested change
# -1 means "not a dev version", a number > -1 will emit postfix "rc${{ rc_num }}"
# "-1" means "not a dev version", a string != "-1" will emit postfix "rc${{ rc_num }}"

Copy link
Copy Markdown
Contributor Author

@lgray lgray Jul 15, 2025

Choose a reason for hiding this comment

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

see commentary on being able to actually use numbers in a non-ugly way for rc_num

Comment on lines +1 to +3

schema_version: 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think these lines can be deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment on lines +70 to +67
- ${{ compiler('c') }}
- ${{ stdlib('c') }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's use this opportunity to order the stdlib before the compilers

Suggested change
- ${{ compiler('c') }}
- ${{ stdlib('c') }}
- ${{ stdlib('c') }}
- ${{ compiler('c') }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines -123 to -129
# some linux tests need a C/C++ compiler;
# extra f2py tests need a fortran compiler
- {{ compiler('c') }} # [unix]
- {{ compiler('cxx') }} # [unix]
- {{ compiler('fortran') }} # [linux]
# For some cython tests
- pkg-config
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

these comments went missing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added back

Comment on lines +221 to +228
- jakirkham
- msarahan
- pelson
- rgommers
- ocefpaf
- isuruf
- xhochy
- h-vetinari
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, let's alphabetize that list in the rewrite commit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@lgray lgray force-pushed the convert_feedstock_to_v1_recipe_format branch from 80d7143 to 5d278fd Compare July 15, 2025 13:33
@lgray lgray force-pushed the convert_feedstock_to_v1_recipe_format branch from 5d278fd to b97f7b6 Compare July 15, 2025 13:40
Copy link
Copy Markdown
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

Thank you for your work and patience on this. :)

@h-vetinari h-vetinari merged commit c8f725c into conda-forge:main Jul 15, 2025
27 checks passed
HLinde added a commit to HLinde/staged-recipes that referenced this pull request Nov 11, 2025
danielnachun pushed a commit to conda-forge/staged-recipes that referenced this pull request Mar 12, 2026
…30301)

* add go4 recipe

* remove explicit python variants

* skip win and osx builds for now

* fix homepage link

* clean up recipe
- raising errors on overdepending/overlinking helped to figure out more reasonable dependencies
- removing variants.yaml as they are anyways set by conda-forge pins
- switching dependency from root to root_base
- did a test run building a user analysis and running it on real data

* add python to run dependencies again

* add GO4License.txt to recipe

* Add comment on ${{ compiler('cxx') }} resolution for the test environment.

* try building on osx

* only use libgl-devel host dependency on linux

* remove globstar shell option for osx build

* clean up and avoid using globstar as osx does not support it

* try different sed commands for osx

* try if cleanup is even necessary at all anymore

* add osx libSystem.B.dylib to allowlist
From reading discussions at numpy conda-forge/numpy-feedstock#361 (comment) and the GO-recipe https://github.com/conda-forge/go-feedstock/blob/main/recipe/meta.yaml#L51
this seems to be ok to overlink against.

* remove the sed cleanups as they do not seem necessary any more

* adjust test requirements for osx

* try again on osx without compiler macro

* clean up

* further cleanup

* patch compiler selection in Go4s Makefile.Linux
Now it should read CXX from environment variables

* adjust cmake invocation to conda-forge

* build on of the test cases with cmake

* try matching the library on both linux / osx

* set extglob for test examples

* remove special settings for dynamic_linking

* try using CMAKE_ARGS.. but leads to errors

* use CMAKE_ARGS

* use CPU_COUNT parameter instead of trying to call nproc

* remove manual pins
The updated conda-forge-pinning solved the issue

* patch lipthread linking

* take DCMAKE_INSTALL_LIBDIR out of CMAKE_ARGS

* adjust patches to docker building

* handle linking issues only on linux

* remove CMAKE argument with pattern mattching instead of array position

* fix cmake argument expansion in example runs

* remove optional hdf5
The linking issues on sysroot_linux seem to happen only in hdf5 dependencies

* explicitly turn hdf5 feature off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants