Feature/detect casting comb token from converters#784
Merged
rochacbruno merged 3 commits intodynaconf:masterfrom Aug 16, 2022
Merged
Conversation
rochacbruno
approved these changes
Aug 16, 2022
rochacbruno
added a commit
that referenced
this pull request
Sep 22, 2022
Shortlog of commits since last release:
Amadou Crookes (1):
envars.md typo fix (#786)
Bruno Rocha (19):
Release version 3.1.9
Bump dev version to 3.1.10
Update badges
demo repo will be replaced by a video tutorial soon
Fix CI
New data key casing must adapt to existing key casing (#795)
Add test and docs about includes (#796)
Removed vendor_src folder (#798)
Replacing rochacbruno/ with dynaconf/ (#800)
Fix codecov (#801)
Parse negative numbers from envvar Fix #799 and Fix #585 (#802)
Fix get command with Django (#804)
Add a functional test runner (#805)
Test runner docs and styling (#806)
Allow merge_unique on lists when merge_enabled=True (#810)
Rebind current env when forced for Pytest Fix #728 (#809)
AUTO_CAST can be enabled on instance (#811)
Ensure pyminify is on release script
Add missing tomllib to monify script
Gaurav Talreja (1):
Fix #807 Use client.auth.approle.login instead of client.auth_approle (#808)
Jitendra Yejare (1):
Fix #768 of kv property depreciation from client object (#769)
Joren Retel (2):
Feature/detect casting comb token from converters (#784)
Adding documentation and example to makefile. (#791)
João Gustavo A. Amorim (1):
Add pyupgrade hook (#759)
Kian-Meng Ang (1):
Fix typos (#788)
Lucas Limeira (1):
Using filter_strategy in env_loader to fix #760 (#767)
Nicholas Nadeau, Ph.D., P.Eng (1):
fix: typo (#766)
Oleksii Baranov (2):
Bump codecov action version (#775)
Fix cli init command for flask (#705) (#774)
Pedro de Medeiros (1):
documentation fixes (#771)
The Gitter Badger (1):
Add a Gitter chat badge to README.md (#776)
Théo Melo (1):
Fixing a typo on the readme file (#763)
Vicente Marçal (1):
docs(pt-br): Docs Translation to brazilian portugues. (#787)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
first of all: thanks for this amazing library. This makes life a lot easier.
Main
I have a suggestion, but I can not see all the implications it has. What I suggest is to suggest to change the regex that detects whether two casting tokens are used in one variable definition. I think it would be nice if this regex is generated dynamically based on the values in the "converters" dict. What this allows is that a user could add a custom casting token. For instance, I wanted a casting token that would cast the string to a pathlib.Path object (see example/custom_cast_token):
This last thing would also work without changing the regex. But it becomes a problem when I would like to do something like:
The regex as it is now does not pick up "@path @Format" and therefore does not do the format step. This PR would solve that.
As as note. I also, found another solution that does not require changing Dynaconf:
with the following:
but this feels slightly hacky and would not allow to have casting to path without also formatting (which the Lazy does).
Tests
Before submitting this pull request I ran "make test_only" and that all passes. I also ran "make all", there I ran into some "maximum recursion depth reached" error. I already had this problem before making any changes though. I followed https://github.com/dynaconf/dynaconf/blob/master/CONTRIBUTING.md , but I must be doing something wrong. I have a similar (but not exactly the same) Traceback when I don't initialize settings like this:
but import them like I see in the other examples: