internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: dynaconf/dynaconf

Issue:
Documentation link on CLI is outdated
The documentation link on CLI help points to http://dynaconf.readthedocs.io/ instead of https://www.dynaconf.com/




Discussion:

Resolving patch:
diff --git a/dynaconf/cli.py b/dynaconf/cli.py
--- a/dynaconf/cli.py
+++ b/dynaconf/cli.py
@@ -146,7 +146,7 @@ def print_version(ctx, param, value):
 def open_docs(ctx, param, value):  # pragma: no cover
     if not value or ctx.resilient_parsing:
         return
-    url = "http://dynaconf.readthedocs.io/"
+    url = "https://dynaconf.com/"
     webbrowser.open(url, new=2)
     click.echo(f"{url} opened in browser")
     ctx.exit()
@@ -197,7 +197,7 @@ def show_banner(ctx, param, value):
 @click.pass_context
 def main(ctx, instance):
     """Dynaconf - Command Line Interface\n
-    Documentation: http://dynaconf.readthedocs.io/
+    Documentation: https://dynaconf.com/
     """
     set_settings(ctx, instance)
 


Test patch:
Repository: dynaconf/dynaconf

Issue:
[bug] Settings files do not get merged if they have the same name (even if they are in different folders)
**Describe the bug**
I waste a lot of time on this..
If you provide multiple settings files with the same name, only the first one gets loaded, they do not get merged.

**To Reproduce**

settings = Dynaconf(settings_file=['settings.yaml', 'folder/settings.yaml'],
					merge_enabled=true)

Only the first settings.yaml gets loaded


[bug] Settings files do not get merged if they have the same name (even if they are in different folders)
**Describe the bug**
I waste a lot of time on this..
If you provide multiple settings files with the same name, only the first one gets loaded, they do not get merged.

**To Reproduce**

settings = Dynaconf(settings_file=['settings.yaml', 'folder/settings.yaml'],
					merge_enabled=true)

Only the first settings.yaml gets loaded


[bug] Settings files do not get merged if they have the same name (even if they are in different folders)
**Describe the bug**
I waste a lot of time on this..
If you provide multiple settings files with the same name, only the first one gets loaded, they do not get merged.

**To Reproduce**

settings = Dynaconf(settings_file=['settings.yaml', 'folder/settings.yaml'],
					merge_enabled=true)

Only the first settings.yaml gets loaded




Discussion:

Resolving patch:
diff --git a/example/issues/430_same_name/app.py b/example/issues/430_same_name/app.py
new file mode 100644
--- /dev/null
+++ b/example/issues/430_same_name/app.py
@@ -0,0 +1,8 @@
+from dynaconf import Dynaconf
+
+settings = Dynaconf(
+    settings_file=["settings.yaml", "folder/settings.yaml"], merge_enabled=True
+)
+
+assert settings.FOO.bar == 1
+assert settings.FOO.zaz == 2


Test patch:
Repository: dynaconf/dynaconf

Issue:
Allow core_loaders to be case insensitive.
**Describe the bug**

When using the `core_loaders` attribute with the value `["yaml"]` Dynaconf fails reading settings from the respective YML configuration file.

**To Reproduce**

1. Go into an empty dir.

2. Setup environment.

  * Python 3.9
  * `pip install dynaconf[yaml]` or `poetry add "dynaconf[yaml]"`
  * dynaconf 3.1.2
  * ruaml.yml 0.16.2

3. Create `settings.yml`

```yml
test: hallo
logging:
  json: true
```
4. Create `test.py` and execute it. It will succeed.

```python
from dynaconf import Dynaconf

settings = Dynaconf(
    merge_enabled=True,
    settings_files=["settings.yml"],
)

print(settings.TEST)
print(settings.LOGGING.JSON)
```

5. Add attribute `core_loaders` as recommended in the Dynaconf doc. Execute. This will fail.

```python
from dynaconf import Dynaconf

settings = Dynaconf(
    merge_enabled=True,
    core_loaders=["yaml"],
    settings_files=["settings.yml"],
)

print(settings.TEST)
print(settings.LOGGING.JSON)
```



Discussion:
Nevermind, it has to be uppercase.
Lets work on improving it and have make it to accept lower case.

Resolving patch:
diff --git a/dynaconf/loaders/__init__.py b/dynaconf/loaders/__init__.py
--- a/dynaconf/loaders/__init__.py
+++ b/dynaconf/loaders/__init__.py
@@ -94,7 +94,9 @@ def settings_loader(
             # a bare python module name w/o extension
             modules_names.append(item)
 
-    enabled_core_loaders = obj.get("CORE_LOADERS_FOR_DYNACONF")
+    enabled_core_loaders = [
+        item.upper() for item in obj.get("CORE_LOADERS_FOR_DYNACONF") or []
+    ]
 
     # add `.local.` to found_files list to search for local files.
     found_files.extend(


Test patch:
Repository: dynaconf/dynaconf

Issue:
[RFC] Allow execute_loaders to accept one or more loader types
The current signature of execute_loaders is pretty flexible. However, it would be useful to specify which loaders you want to run as well. This would allow for greater flexibility when overriding specific settings, but ensuring that one loader's values can be reloaded to maintain priority.

For example, I would like to overwrite values loaded from file at runtime, but (depending on some conditions) maintain values that have been set by environment variables. Being able to re-execute the envar loader should allow this behavior.

Desired usage:
```python
settings.execute_loaders(loaders=[dynaconf.loaders.env_loader])
```



Discussion:

Resolving patch:
diff --git a/dynaconf/base.py b/dynaconf/base.py
--- a/dynaconf/base.py
+++ b/dynaconf/base.py
@@ -958,26 +958,36 @@ def reload(self, env=None, silent=None):  # pragma: no cover
         self.clean()
         self.execute_loaders(env, silent)
 
-    def execute_loaders(self, env=None, silent=None, key=None, filename=None):
+    def execute_loaders(
+        self, env=None, silent=None, key=None, filename=None, loaders=None
+    ):
         """Execute all internal and registered loaders
 
         :param env: The environment to load
         :param silent: If loading erros is silenced
         :param key: if provided load a single key
         :param filename: optional custom filename to load
+        :param loaders: optional list of loader modules
         """
         if key is None:
             default_loader(self, self._defaults)
+
         env = (env or self.current_env).upper()
         silent = silent or self.SILENT_ERRORS_FOR_DYNACONF
-        self.pre_load(env, silent=silent, key=key)
-        settings_loader(
-            self, env=env, silent=silent, key=key, filename=filename
-        )
-        self.load_extra_yaml(env, silent, key)  # DEPRECATED
-        enable_external_loaders(self)
-        for loader in self.loaders:
+
+        if loaders is None:
+            self.pre_load(env, silent=silent, key=key)
+            settings_loader(
+                self, env=env, silent=silent, key=key, filename=filename
+            )
+            self.load_extra_yaml(env, silent, key)  # DEPRECATED
+            enable_external_loaders(self)
+
+            loaders = self.loaders
+
+        for loader in loaders:
             loader.load(self, env, silent=silent, key=key)
+
         self.load_includes(env, silent=silent, key=key)
 
     def pre_load(self, env, silent, key):


Test patch:
Repository: dynaconf/dynaconf

Issue:
Make `environment` an alias to `environments`
A common mistake is to pass `environment=True` when it should be `environments`

Solutions:

1. Warn the user

**Did you mean `environments`?**

2. make an alias the same way we did with `settings_file` and `settings_files`


Discussion:

Resolving patch:
diff --git a/dynaconf/base.py b/dynaconf/base.py
--- a/dynaconf/base.py
+++ b/dynaconf/base.py
@@ -115,6 +115,8 @@ def __resolve_config_aliases(self, kwargs):
         mispells = {
             "settings_files": "settings_file",
             "SETTINGS_FILES": "SETTINGS_FILE",
+            "environment": "environments",
+            "ENVIRONMENT": "ENVIRONMENTS",
         }
         for mispell, correct in mispells.items():
             if mispell in kwargs:
diff --git a/example/issues/478_mispell_environments/app.py b/example/issues/478_mispell_environments/app.py
new file mode 100644
--- /dev/null
+++ b/example/issues/478_mispell_environments/app.py
@@ -0,0 +1,19 @@
+from dynaconf import Dynaconf
+
+
+settings = Dynaconf(
+    environment=True,  # should be environents but it is an alias
+    settings_files="settings.toml",  # should be settings_file it is an alias
+)
+
+
+assert settings.NAME == "Bruno"
+
+
+settings = Dynaconf(
+    ENVIRONMENT=True,  # should be environents but it is an alias
+    SETTINGS_FILES="settings.toml",  # should be settings_file it is an alias
+)
+
+
+assert settings.NAME == "Bruno"


Test patch:
Repository: dynaconf/dynaconf

Issue:
Load setting files
(sorry for this newbie and probably dumb question)

I have the following project structure
```
.
├── ...
├── project
│   ├── src
│   │   ├── app.py
│   ├── conf.py
│   ├── __init__.py
│   ├── settings.toml
│   ├── configs
│   │   ├── config1.yaml
│   │   ├── config2.yaml
```
and in essence, the question is how can I load `config1.yaml` and `config2.yaml`.

I added the path to the files in settings_files at `conf.py` but then, when I import dynaconf in `src/app.py` using ` from dynaconf import settings` I have no access to the defined settings.

Probably I misunderstood the documentation but I would really appreciate it if you can help me :)


Discussion:

Resolving patch:
diff --git a/example/issues/467_load_from_parent_folder/src/app.py b/example/issues/467_load_from_parent_folder/src/app.py
new file mode 100644
--- /dev/null
+++ b/example/issues/467_load_from_parent_folder/src/app.py
@@ -0,0 +1,15 @@
+from dynaconf import Dynaconf
+
+
+settings = Dynaconf(
+    settings_files=[
+        "../settings.toml",
+        "../configs/config1.yaml",
+        "../configs/config2.yaml",
+    ]
+)
+
+
+assert settings.VALUE == 1
+assert settings.NAME == "Bruno"
+assert settings.LASTNAME == "Rocha"


Test patch:
Repository: dynaconf/dynaconf

Issue:
[bug] filter_strategy config not working
**Describe the bug**
It seems that the `filter_strategy` config (which by the way is misspelled int the [docs](https://github.com/rochacbruno/dynaconf/blob/master/docs/configuration.md)) is not taken into account when used in the `Dynaconf` constructor.

**To Reproduce**
Steps to reproduce the behavior:

1. Having the following folder structure
Just a plain python script.

2. Having the following config files:
No config file, just using env variables

4. Having the following app code:

<details>
<summary> Code </summary>

**/test/test.py**
```python
import dynaconf

class CustomFilter:
    def __call__(self, data):
        print("this is never called")
        return {
            k: v
            for k, v in data.items()
            if k.startswith("PREFIX")
        }


if __name__ == "__main__":
    dc = dynaconf.Dynaconf(
        envvar_prefix=False,
        filter_strategy=CustomFilter(),
    )
    print(dc.as_dict())
```

</details>

5. Executing under the following environment

<details>
<summary> Execution </summary>

```bash
PREFIX_VAR="HELLO" OTHER_VAR="WORLD" python test.py
```

</details>

**Expected behavior**
`CustomFilter` should be called ("this is never called" should be displayed) and only the `PREFIX_VAR` should be in dict, not `OTHER_VAR`

**Environment (please complete the following information):**
 - OS: Linux version 5.10.60.1-microsoft-standard-WSL2 
 - Dynaconf Version 3.1.9
 - Framework: None

**Context**

I was looking for a way to filter out empty environment variables.



Discussion:
I would like to fix this issue. Adding a check and execution for the `filter_strategy` in the `env_loader` seems to fix it.

```diff
diff --git a/dynaconf/loaders/env_loader.py b/dynaconf/loaders/env_loader.py
index 660bd27..3e61396 100644
--- a/dynaconf/loaders/env_loader.py
+++ b/dynaconf/loaders/env_loader.py
@@ -76,6 +76,9 @@ def load_from_env(
         }
         # Update the settings space based on gathered data from environment.
         if data:
+            filter_strategy = obj.get("FILTER_STRATEGY")
+            if filter_strategy:
+                data = filter_strategy(data)
             obj.update(data, loader_identifier=identifier)
 
```

Please, let me know if that's seems okay. If so, should I open a PR with the fix? 😃 (That's my first contribution to the project)

Resolving patch:
diff --git a/dynaconf/loaders/env_loader.py b/dynaconf/loaders/env_loader.py
--- a/dynaconf/loaders/env_loader.py
+++ b/dynaconf/loaders/env_loader.py
@@ -76,6 +76,9 @@ def load_from_env(
         }
         # Update the settings space based on gathered data from environment.
         if data:
+            filter_strategy = obj.get("FILTER_STRATEGY")
+            if filter_strategy:
+                data = filter_strategy(data)
             obj.update(data, loader_identifier=identifier)
 
 


Test patch:
Repository: dynaconf/dynaconf

Issue:
[RFC] Resolve depreciation warning for depreciated property kv
**Is your feature request related to a problem? Please describe.**
Yes, Currently we are hitting the depreciation warning in hvac 0.11 since the kv property is depreciated and adviced to use from `Client.secrets`

Clear Warning:
DeprecationWarning: Call to deprecated property 'kv'. This property will be removed in version '0.9.0' Please use the 'kv' property on the 'Client.secrets' attribute moving forward

**Describe the solution you'd like**
Remove the usage of kv property directly in dynaconf and use if from `Client.secrets`

**Describe alternatives you've considered**
The alternative is not required.


[RFC] Resolve depreciation warning for depreciated property kv
**Is your feature request related to a problem? Please describe.**
Yes, Currently we are hitting the depreciation warning in hvac 0.11 since the kv property is depreciated and adviced to use from `Client.secrets`

Clear Warning:
DeprecationWarning: Call to deprecated property 'kv'. This property will be removed in version '0.9.0' Please use the 'kv' property on the 'Client.secrets' attribute moving forward

**Describe the solution you'd like**
Remove the usage of kv property directly in dynaconf and use if from `Client.secrets`

**Describe alternatives you've considered**
The alternative is not required.




Discussion:

Resolving patch:
diff --git a/dynaconf/loaders/vault_loader.py b/dynaconf/loaders/vault_loader.py
--- a/dynaconf/loaders/vault_loader.py
+++ b/dynaconf/loaders/vault_loader.py
@@ -58,7 +58,7 @@ def get_client(obj):
         "Vault authentication error: is VAULT_TOKEN_FOR_DYNACONF or "
         "VAULT_ROLE_ID_FOR_DYNACONF defined?"
     )
-    client.kv.default_kv_version = obj.VAULT_KV_VERSION_FOR_DYNACONF
+    client.secrets.kv.default_kv_version = obj.VAULT_KV_VERSION_FOR_DYNACONF
     return client
 
 


Test patch:
Repository: dynaconf/dynaconf

Issue:
[bug] CLI get command doesn't work on Django
When running 
```bash
export DJANGO_SETTINGS_MODULE=myapp.settings
dynaconf get DEBUG
```

Instead of the value of the `DEBUG` variable `True|False`

I am seeing

```bash
Django app detected
```

Looks like the `get` command must omit the `Django app detected` line that it is inheriting from the main command.


Discussion:

Resolving patch:
diff --git a/dynaconf/cli.py b/dynaconf/cli.py
--- a/dynaconf/cli.py
+++ b/dynaconf/cli.py
@@ -43,6 +43,8 @@ def set_settings(ctx, instance=None):
 
     settings = None
 
+    _echo_enabled = ctx.invoked_subcommand not in ["get", None]
+
     if instance is not None:
         if ctx.invoked_subcommand in ["init"]:
             raise click.UsageError(
@@ -57,7 +59,7 @@ def set_settings(ctx, instance=None):
 
             flask_app = ScriptInfo().load_app()
             settings = FlaskDynaconf(flask_app, **flask_app.config).settings
-            click.echo(
+            _echo_enabled and click.echo(
                 click.style(
                     "Flask app detected", fg="white", bg="bright_black"
                 )
@@ -73,7 +75,7 @@ def set_settings(ctx, instance=None):
             settings = LazySettings()
 
         if settings is not None:
-            click.echo(
+            _echo_enabled and click.echo(
                 click.style(
                     "Django app detected", fg="white", bg="bright_black"
                 )


Test patch:
Repository: dynaconf/dynaconf

Issue:
[bug] dynaconf[vault] fails with new hvac
**Describe the bug**
dynaconf[vault] is not able to work with new `hvac` 1.0.0+
`DeprecationWarning` turned into `AttributeError`

This:
```
DeprecationWarning: Call to deprecated function 'auth_approle'. This method will be removed in version '0.12.0' Please use the 'login' method on the 'hvac.api.auth_methods.approle' class moving forward.
```
into this:
```
AttributeError: 'Client' has no attribute 'auth_approle'
```

**To Reproduce**
Steps to reproduce the behavior:

1. Use unpinned hvac (1.0.0+) - dynaconf[vault] dependency


[bug] dynaconf[vault] fails with new hvac
**Describe the bug**
dynaconf[vault] is not able to work with new `hvac` 1.0.0+
`DeprecationWarning` turned into `AttributeError`

This:
```
DeprecationWarning: Call to deprecated function 'auth_approle'. This method will be removed in version '0.12.0' Please use the 'login' method on the 'hvac.api.auth_methods.approle' class moving forward.
```
into this:
```
AttributeError: 'Client' has no attribute 'auth_approle'
```

**To Reproduce**
Steps to reproduce the behavior:

1. Use unpinned hvac (1.0.0+) - dynaconf[vault] dependency




Discussion:

Resolving patch:
diff --git a/dynaconf/loaders/vault_loader.py b/dynaconf/loaders/vault_loader.py
--- a/dynaconf/loaders/vault_loader.py
+++ b/dynaconf/loaders/vault_loader.py
@@ -33,7 +33,7 @@ def get_client(obj):
         **{k: v for k, v in obj.VAULT_FOR_DYNACONF.items() if v is not None}
     )
     if obj.VAULT_ROLE_ID_FOR_DYNACONF is not None:
-        client.auth_approle(
+        client.auth.approle.login(
             role_id=obj.VAULT_ROLE_ID_FOR_DYNACONF,
             secret_id=obj.get("VAULT_SECRET_ID_FOR_DYNACONF"),
         )


Test patch:
Repository: dynaconf/dynaconf

Issue:
[bug][Documentation] Exporting: write() got an unexpected keyword argument 'merge'
**Describe the bug**
Following the example on the documentation to [export](https://www.dynaconf.com/advanced/#exporting) Dynaconf data to a file raises an exception with the `merge` argument

**To Reproduce**
~~~Python
loaders.write("/a/b/c", DynaBox(config).to_dict(), merge=False)
~~~

**Expected behavior**
The file should have been written

**Actual Behavior**
`TypeError: write() got an unexpected keyword argument 'merge'`

Just a quick documentation fix,
thanks !



Discussion:

Resolving patch:
diff --git a/dynaconf/loaders/__init__.py b/dynaconf/loaders/__init__.py
--- a/dynaconf/loaders/__init__.py
+++ b/dynaconf/loaders/__init__.py
@@ -263,7 +263,7 @@ def enable_external_loaders(obj):
             obj.LOADERS_FOR_DYNACONF.insert(0, loader)
 
 
-def write(filename, data, env=None):
+def write(filename, data, env=None, merge=False):
     """Writes `data` to `filename` infers format by file extension."""
     loader_name = f"{filename.rpartition('.')[-1]}_loader"
     loader = globals().get(loader_name)
@@ -274,4 +274,4 @@ def write(filename, data, env=None):
     if loader is not py_loader and env and env not in data:
         data = {env: data}
 
-    loader.write(filename, data, merge=False)
+    loader.write(filename, data, merge=merge)


Test patch:
Repository: dynaconf/dynaconf

Issue:
[bug]
**Describe the bug**
At https://www.dynaconf.com/settings_files/#includes-and-preloads, it says

```
# in toml file
dynaconf_includes = ["path/to/file.toml"]
```

to include another settings file in a toml file. However, this does not work. Instead, it should read

```
# in toml file
dynaconf_include = ["path/to/file.toml"]
```

(`dynaconf_include` instead of `dynaconf_includes`)



Discussion:
Thanks for pointing it out.

@rochacbruno  I've noticed `dynaconf_include` does not accept `str`, just `list` (it raises an error about trying to use `extend`), while `includes_for_dynaconf`, which is kind an alias, accepts `str` too.
May I add the same behaviour as `includes_for_dynaconf` to it?

Resolving patch:
diff --git a/dynaconf/base.py b/dynaconf/base.py
--- a/dynaconf/base.py
+++ b/dynaconf/base.py
@@ -1045,7 +1045,7 @@ def pre_load(self, env, silent, key):
 
     def load_includes(self, env, silent, key):
         """Do we have any nested includes we need to process?"""
-        includes = self.get("DYNACONF_INCLUDE", [])
+        includes = ensure_a_list(self.get("DYNACONF_INCLUDE"))
         includes.extend(ensure_a_list(self.get("INCLUDES_FOR_DYNACONF")))
         if includes:
             self.load_file(path=includes, env=env, silent=silent, key=key)
diff --git a/dynaconf/utils/__init__.py b/dynaconf/utils/__init__.py
--- a/dynaconf/utils/__init__.py
+++ b/dynaconf/utils/__init__.py
@@ -7,6 +7,7 @@
 from typing import Any
 from typing import Iterator
 from typing import TYPE_CHECKING
+from typing import TypeVar
 
 
 if TYPE_CHECKING:  # pragma: no cover
@@ -290,7 +291,10 @@ def trimmed_split(
     return [s]  # raw un-splitted
 
 
-def ensure_a_list(data: Any) -> list[int] | list[str]:
+T = TypeVar("T")
+
+
+def ensure_a_list(data: T) -> list[T]:
     """Ensure data is a list or wrap it in a list"""
     if not data:
         return []


Test patch:
Repository: dynaconf/dynaconf

Issue:
[bug] AttributeError is thrown if one of the configuration keys is an integer
**Describe the bug**
Dynaconf fails to validate settings if any of the configuration keys are integer. Wrapping the key in quotes fixes the issue, but I would prefer dynaconf to keep its behavior from `3.1.11` where it did handle the integer-like keys correctly without throwing an exception.

**To Reproduce**
Steps to reproduce the behavior:
* have dynaconf 3.1.12 installed, I could not reproduce the bug with 3.1.11.
* initialize LazySettings
* validate settings

Project: [robottelo](https://github.com/SatelliteQE/robottelo/blob/b4b471aac102cfaeb40cffda7cd8452f1a2c1e1f/robottelo/config/__init__.py#L34)

Having the following config files:

<!-- Please adjust if you are using different files and formats! -->

<details>
<summary> Config files </summary>

**conf/ldap.yaml**
```yaml
LDAP:
  HOSTNAME:
    2016: env-ad-2016.acme.com
    2019: env-ad-2019.acme.com
  USERNAME: foobar
  PASSWORD: '@format {this.vault_awesome_password}'
  BASEDN: cn=Users,dc=department1,dc=loc1,dc=acme,dc=com
  GRPBASEDN: dc=department1,dc=loc1,dc=acme,dc=com
  REALM: INFRA.DEPARTMENT1.ACME.COM
  NAMESERVER:
    2016: 10.22.33.42
    2019: 10.22.33.43
  WORKGROUP:
    2016: SUBDEPT1
    2019: SUBDEPT12019
```

</details>

3. Having the following app code:
* [link to the repository](https://github.com/SatelliteQE/robottelo/blob/b4b471aac102cfaeb40cffda7cd8452f1a2c1e1f/robottelo/config/__init__.py#L19-L34)

4. Executing under the following environment

<details>
<summary> Execution </summary>

```bash
$ python -c 'from robottelo.config import settings'
```

</details>

**Expected behavior**
Dynaconf not throwing an AttributeError. Dynaconf should handle keys that are not strings as it did in version `3.1.11`.

**Environment (please complete the following information):**
 - OS: Fedora 36
 - Python 3.11
 - Dynaconf Version: 3.1.12
 - Frameworks in use: none




Discussion:

Resolving patch:
diff --git a/dynaconf/utils/parse_conf.py b/dynaconf/utils/parse_conf.py
--- a/dynaconf/utils/parse_conf.py
+++ b/dynaconf/utils/parse_conf.py
@@ -386,7 +386,7 @@ def parse_conf_data(data, tomlfy=False, box_settings=None):
         # recursively parse inner dict items
         _parsed = {}
         for k, v in data.items():
-            _parsed[k] = parse_conf_data(
+            _parsed[str(k)] = parse_conf_data(
                 v, tomlfy=tomlfy, box_settings=box_settings
             )
         return _parsed


Test patch: