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

🔧 Deprecate use of dynamic functions in need type fields #1406

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Feb 18, 2025

It is unintended and unlikely the dynamic functions would have been used in there fields, but just in case we issue a warning of the deprecation, so that we can remove them in the future

fields affected: type, type_name, type_prefix, type_color, type_style.

this follows on from #1387 and the fields now allowed are:

  • title
  • status
  • tags
  • style
  • constraints
  • all needs_extra_options
  • all needs_extra_links
  • all needs_global_options

Note, there are still maybe some outstanding questions about where dynamic functions should be processed:

  • should they be processed for the need title?
  • should they be processed at all for needs coming from external and/or needimport needs.json?

Copy link

codecov bot commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.22%. Comparing base (4e10030) to head (1010507).
Report is 115 commits behind head on master.

Files with missing lines Patch % Lines
sphinx_needs/functions/functions.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1406      +/-   ##
==========================================
+ Coverage   86.87%   88.22%   +1.34%     
==========================================
  Files          56       60       +4     
  Lines        6532     7153     +621     
==========================================
+ Hits         5675     6311     +636     
+ Misses        857      842      -15     
Flag Coverage Δ
pytests 88.22% <80.00%> (+1.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

It is unintended and unlikely the dynamic functions would have been used in there fields,
but just in case we issue a warning of the deprecation,
so that we can remove them in the future

fields affected: `type`, `type_name`, `type_prefix`, `type_color`, `type_style`.

---

Note, there are still maybe some outstanding questions about where dynamic functions should be processed:
- should they be processed fo the need title?
- should they be processed at all for needs coming from external and/or needimport `needs.json`?
@ubmarco
Copy link
Member

ubmarco commented Feb 19, 2025

I would keep dynamic function evaluation for the title field as I see a usecase for (partly) generated titles.

For imported and external needs, I think they should not be evaluated. The needs.json producer is in charge of providing non-dynamic field values. It also does not make sense to apply project-local dynamic functions to fields of foreign projects.

@chrisjsewell chrisjsewell merged commit 98c630f into master Feb 20, 2025
19 checks passed
@chrisjsewell chrisjsewell deleted the df-deprecate branch February 20, 2025 10:32
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.

3 participants