[fix] Use Dynaconf lazy variables insted of re-importing the settings.
Instead of doing from dynaconf import settings which causes the whole
settings load to be executed again, it is better to use the support for
lazy evaluation and formatting https://www.dynaconf.com/dynamic/#format-token
so it is possible to define a variable that is a template to be formed from
interpolation with other in settings variables.
So inside a settings file that is managed by dynaconf like:
from dynaconf import settings
FOO = settings.BAR + "/zaz"
It is better to do
FOO = "@format {this.BAR}/zaz"
or if Jinja powers is needed
FOO = "@jinja {{ this.BAR }}/zaz"
This way there is no need to reload all the settings and avoids circular dependencies.
[noissue]
I will be working on the issue https://github.com/rochacbruno/dynaconf/issues/690 which is a known bug, once that bug is fixed then we can apply this fix to pulp_ansible.
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
This PR is still missing dynaconf fix first
This issue is no longer marked for closure.
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
Dynaconf fix still pending, will be fixed for v4.0 soon
This issue is no longer marked for closure.
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
this is probably fixed by https://github.com/dynaconf/dynaconf/pull/944 I will test it
This issue is no longer marked for closure.
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
This pull request is no longer marked for closure.
This PR now depends on Dynaconf 3.3.0 that will include this https://github.com/dynaconf/dynaconf/pull/1040
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
This pull request is no longer marked for closure.
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
Do we need a versioned dependency on dynaconf here?
This issue is no longer marked for closure.
@mdellweg the feature used here is added on dynaconf 3.2.5 https://github.com/dynaconf/dynaconf/releases/tag/3.2.5 which is not available on pulpcore 3.49 https://github.com/pulp/pulpcore/blob/3.49/requirements.txt#L19 (the lower bound for pulp_ansible)
We would need to change main pulp_ansible to require at least pulpcore 3.50.
@mdellweg the feature used here is added on dynaconf 3.2.5 https://github.com/dynaconf/dynaconf/releases/tag/3.2.5 which is not available on pulpcore 3.49 https://github.com/pulp/pulpcore/blob/3.49/requirements.txt#L19 (the lower bound for pulp_ansible)
We would need to change main pulp_ansible to require at least pulpcore 3.50.
I thought, we could require that dynaconf version here until we bump pulpcore to >= 3.50. But we can also wait. What would be more convenient?
I think we cannot require the version here because pulpcore 3.49 has upper bounds for dynaconf.
Maybe we can just wait the proper time to merget this, this is not blocking anything, it is just adding a bit of overhead on application startup time.
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
I think I am ready to fix it now.
This issue is no longer marked for closure.
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
After 2.5 years of waiting, this PR is finally mergeable! 🎉