poetry-plugin-dotenv 3.3.2__tar.gz → 3.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/PKG-INFO +14 -14
  2. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/README.md +12 -12
  3. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/pyproject.toml +11 -6
  4. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/__init__.py +1 -1
  5. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/commands.py +3 -5
  6. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/configurator.py +3 -1
  7. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/dotenv/__init__.py +1 -1
  8. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/dotenv/core.py +11 -8
  9. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/dotenv/variables.py +1 -1
  10. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/LICENSE +0 -0
  11. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/dotenv/parsers.py +0 -0
  12. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/exceptions.py +0 -0
  13. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/loader.py +0 -0
  14. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/logging.py +0 -0
  15. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/plugin.py +0 -0
  16. {poetry_plugin_dotenv-3.3.2 → poetry_plugin_dotenv-3.3.4}/src/poetry_plugin_dotenv/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: poetry-plugin-dotenv
3
- Version: 3.3.2
3
+ Version: 3.3.4
4
4
  Summary: poetry-plugin-dotenv - is the plugin that automatically loads environment variables from a dotenv file into the environment before poetry commands are run.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -25,7 +25,7 @@ Classifier: Programming Language :: Python :: 3.11
25
25
  Classifier: Programming Language :: Python :: 3.12
26
26
  Classifier: Programming Language :: Python :: 3.13
27
27
  Classifier: Programming Language :: Python :: 3.14
28
- Classifier: Programming Language :: Python :: 3.8
28
+ Classifier: Programming Language :: Python :: 3.15
29
29
  Classifier: Topic :: Scientific/Engineering
30
30
  Classifier: Topic :: Software Development
31
31
  Classifier: Topic :: Software Development :: Libraries
@@ -39,7 +39,7 @@ Project-URL: Releases, https://github.com/pivoshenko/poetry-plugin-dotenv/releas
39
39
  Description-Content-Type: text/markdown
40
40
 
41
41
  <h1 align="left">
42
- <img src="docs/assets/logo.svg" alt="" height="40" align="left" style="vertical-align: middle; margin-right: 12px;">
42
+ <img src="https://raw.githubusercontent.com/pivoshenko/poetry-plugin-dotenv/main/assets/logo.svg" alt="" height="40" align="left" style="vertical-align: middle; margin-right: 12px;">
43
43
  poetry-plugin-dotenv
44
44
  </h1>
45
45
 
@@ -63,9 +63,9 @@ Description-Content-Type: text/markdown
63
63
 
64
64
  ## Overview
65
65
 
66
- `poetry-plugin-dotenv` - is the plugin that automatically loads environment variables from a dotenv file into the environment before `poetry` commands are run.
66
+ `poetry-plugin-dotenv` loads environment variables from a dotenv file into the environment before any `poetry` command runs.
67
67
 
68
- `poetry-plugin-dotenv` introduces **new commands** to extend the functionality of `poetry` such as:
68
+ It also adds new `poetry` commands:
69
69
 
70
70
  - `poetry activate` - loads environment variables from a dotenv file and activates the virtual environment
71
71
 
@@ -114,7 +114,7 @@ Prevents `poetry` from loading the dotenv file.
114
114
 
115
115
  If your dotenv file is located elsewhere or has a different name, you can set this parameter.
116
116
 
117
- ### Configuration via TOML file
117
+ ### Configuration Via TOML File
118
118
 
119
119
  The plugin can read project-specific default values for its options from a `pyproject.toml` file.
120
120
  By default, `poetry-plugin-dotenv` looks for a `pyproject.toml` file that includes either a `[tool.dotenv]` or `[tool.poetry.plugins.dotenv]` section.
@@ -137,13 +137,13 @@ location = ".env.dev"
137
137
  > [!IMPORTANT]
138
138
  > Due to `poetry`'s default parser, all options in the plugin sections must be specified as strings.
139
139
 
140
- As mentioned in the **Features** list, the schema for the plugin configuration is part of the [JSON Schema Store](https://www.schemastore.org/json), which enables auto-completion and validation in IDEs like Visual Studio Code and PyCharm.
140
+ The configuration schema is part of the [JSON Schema Store](https://www.schemastore.org/json), so IDEs like Visual Studio Code and PyCharm offer auto-completion and validation for it.
141
141
 
142
142
  <div align="center">
143
- <img alt="logo" src="https://github.com/pivoshenko/poetry-plugin-dotenv/blob/main/docs/assets/schema_example.png?raw=True">
143
+ <img alt="logo" src="https://raw.githubusercontent.com/pivoshenko/poetry-plugin-dotenv/main/assets/preview_schema.png">
144
144
  </div>
145
145
 
146
- ### Configuration via environment variables
146
+ ### Configuration Via Environment Variables
147
147
 
148
148
  `poetry-plugin-dotenv` supports the following configuration options via environment variables:
149
149
 
@@ -153,15 +153,15 @@ As mentioned in the **Features** list, the schema for the plugin configuration i
153
153
  > [!IMPORTANT]
154
154
  > As environment variables are always strings, options should always be set as strings.
155
155
 
156
- ### Lookup hierarchy
156
+ ### Lookup Hierarchy
157
157
 
158
- A `pyproject.toml` file can override default values. Options provided via environment variables override both.
158
+ A `pyproject.toml` file can override default values. Environment variables override both.
159
159
 
160
160
  ## Examples
161
161
 
162
- <!-- <img alt="demo" src="https://github.com/pivoshenko/poetry-plugin-dotenv/blob/main/docs/assets/demo.gif?raw=True"> -->
162
+ <!-- <img alt="demo" src="https://raw.githubusercontent.com/pivoshenko/poetry-plugin-dotenv/main/assets/demo.gif"> -->
163
163
 
164
- Example of using activate command:
164
+ Using the `activate` command:
165
165
 
166
166
  ```dotenv
167
167
  # .env
@@ -180,7 +180,7 @@ poetry activate -v
180
180
  # Reloads shell within the environment with loaded environment variables
181
181
  ```
182
182
 
183
- Example of using run command:
183
+ Using the `run` command:
184
184
 
185
185
  ```dotenv
186
186
  # .env
@@ -1,5 +1,5 @@
1
1
  <h1 align="left">
2
- <img src="docs/assets/logo.svg" alt="" height="40" align="left" style="vertical-align: middle; margin-right: 12px;">
2
+ <img src="https://raw.githubusercontent.com/pivoshenko/poetry-plugin-dotenv/main/assets/logo.svg" alt="" height="40" align="left" style="vertical-align: middle; margin-right: 12px;">
3
3
  poetry-plugin-dotenv
4
4
  </h1>
5
5
 
@@ -23,9 +23,9 @@
23
23
 
24
24
  ## Overview
25
25
 
26
- `poetry-plugin-dotenv` - is the plugin that automatically loads environment variables from a dotenv file into the environment before `poetry` commands are run.
26
+ `poetry-plugin-dotenv` loads environment variables from a dotenv file into the environment before any `poetry` command runs.
27
27
 
28
- `poetry-plugin-dotenv` introduces **new commands** to extend the functionality of `poetry` such as:
28
+ It also adds new `poetry` commands:
29
29
 
30
30
  - `poetry activate` - loads environment variables from a dotenv file and activates the virtual environment
31
31
 
@@ -74,7 +74,7 @@ Prevents `poetry` from loading the dotenv file.
74
74
 
75
75
  If your dotenv file is located elsewhere or has a different name, you can set this parameter.
76
76
 
77
- ### Configuration via TOML file
77
+ ### Configuration Via TOML File
78
78
 
79
79
  The plugin can read project-specific default values for its options from a `pyproject.toml` file.
80
80
  By default, `poetry-plugin-dotenv` looks for a `pyproject.toml` file that includes either a `[tool.dotenv]` or `[tool.poetry.plugins.dotenv]` section.
@@ -97,13 +97,13 @@ location = ".env.dev"
97
97
  > [!IMPORTANT]
98
98
  > Due to `poetry`'s default parser, all options in the plugin sections must be specified as strings.
99
99
 
100
- As mentioned in the **Features** list, the schema for the plugin configuration is part of the [JSON Schema Store](https://www.schemastore.org/json), which enables auto-completion and validation in IDEs like Visual Studio Code and PyCharm.
100
+ The configuration schema is part of the [JSON Schema Store](https://www.schemastore.org/json), so IDEs like Visual Studio Code and PyCharm offer auto-completion and validation for it.
101
101
 
102
102
  <div align="center">
103
- <img alt="logo" src="https://github.com/pivoshenko/poetry-plugin-dotenv/blob/main/docs/assets/schema_example.png?raw=True">
103
+ <img alt="logo" src="https://raw.githubusercontent.com/pivoshenko/poetry-plugin-dotenv/main/assets/preview_schema.png">
104
104
  </div>
105
105
 
106
- ### Configuration via environment variables
106
+ ### Configuration Via Environment Variables
107
107
 
108
108
  `poetry-plugin-dotenv` supports the following configuration options via environment variables:
109
109
 
@@ -113,15 +113,15 @@ As mentioned in the **Features** list, the schema for the plugin configuration i
113
113
  > [!IMPORTANT]
114
114
  > As environment variables are always strings, options should always be set as strings.
115
115
 
116
- ### Lookup hierarchy
116
+ ### Lookup Hierarchy
117
117
 
118
- A `pyproject.toml` file can override default values. Options provided via environment variables override both.
118
+ A `pyproject.toml` file can override default values. Environment variables override both.
119
119
 
120
120
  ## Examples
121
121
 
122
- <!-- <img alt="demo" src="https://github.com/pivoshenko/poetry-plugin-dotenv/blob/main/docs/assets/demo.gif?raw=True"> -->
122
+ <!-- <img alt="demo" src="https://raw.githubusercontent.com/pivoshenko/poetry-plugin-dotenv/main/assets/demo.gif"> -->
123
123
 
124
- Example of using activate command:
124
+ Using the `activate` command:
125
125
 
126
126
  ```dotenv
127
127
  # .env
@@ -140,7 +140,7 @@ poetry activate -v
140
140
  # Reloads shell within the environment with loaded environment variables
141
141
  ```
142
142
 
143
- Example of using run command:
143
+ Using the `run` command:
144
144
 
145
145
  ```dotenv
146
146
  # .env
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "poetry-plugin-dotenv"
3
- version = "3.3.2"
3
+ version = "3.3.4"
4
4
  description = "poetry-plugin-dotenv - is the plugin that automatically loads environment variables from a dotenv file into the environment before poetry commands are run."
5
5
  license = "MIT"
6
6
  authors = ["Volodymyr Pivoshenko <contact@pivoshenko.dev>"]
@@ -32,12 +32,12 @@ classifiers = [
32
32
  "Environment :: Other Environment",
33
33
  "Programming Language :: Python",
34
34
  "Programming Language :: Python :: 3",
35
- "Programming Language :: Python :: 3.8",
36
35
  "Programming Language :: Python :: 3.9",
37
36
  "Programming Language :: Python :: 3.10",
38
37
  "Programming Language :: Python :: 3.11",
39
38
  "Programming Language :: Python :: 3.12",
40
39
  "Programming Language :: Python :: 3.13",
40
+ "Programming Language :: Python :: 3.14",
41
41
  "Intended Audience :: Developers",
42
42
  "Intended Audience :: Information Technology",
43
43
  "Topic :: Software Development",
@@ -54,7 +54,7 @@ packages = [{ include = "poetry_plugin_dotenv", from = "src" }]
54
54
 
55
55
  [tool.poetry.dependencies]
56
56
  poetry = ">=1.5.0,<3.0.0"
57
- python = "~=3.9,<4.0"
57
+ python = ">=3.9,<4.0"
58
58
 
59
59
  [tool.poetry.group.formatters.dependencies]
60
60
  pyupgrade = "~=3.21.0"
@@ -66,7 +66,7 @@ ty = "~=0.0.17,<0.0.24"
66
66
 
67
67
  [tool.poetry.group.tests.dependencies]
68
68
  coverage = { version = "~=7.10.7", extras = ["toml"] }
69
- pytest = "~=7.4.4"
69
+ pytest = "~=8.4.2"
70
70
  pytest-cov = "~=7.1.0"
71
71
  pytest-mock = "~=3.15.1"
72
72
  pytest-sugar = "~=1.1.1"
@@ -86,11 +86,16 @@ addopts = ["--basetemp=tests/fixtures", "--color=yes", "--cov=src", "--cov-repor
86
86
  testpaths = ["tests"]
87
87
 
88
88
  [tool.ty.environment]
89
- python-version = "3.10"
89
+ python-version = "3.9"
90
+
91
+ [tool.ty.rules]
92
+ unresolved-attribute = "ignore"
93
+ invalid-argument-type = "ignore"
90
94
 
91
95
  [tool.ruff]
92
96
  fix = true
93
97
  line-length = 100
98
+ target-version = "py39"
94
99
  unsafe-fixes = true
95
100
 
96
101
  [tool.ruff.format]
@@ -98,7 +103,7 @@ docstring-code-format = true
98
103
  quote-style = "double"
99
104
 
100
105
  [tool.ruff.lint]
101
- ignore = ["D107", "D102", "D103", "D203", "D213", "COM812"]
106
+ ignore = ["D107", "D102", "D103", "D203", "D213", "COM812", "CPY001"]
102
107
  select = ["ALL"]
103
108
 
104
109
  [tool.ruff.lint.isort]
@@ -1,4 +1,4 @@
1
- """poetry-plugin-dotenv - is the plugin that automatically loads environment variables from a dotenv file into the environment before poetry commands are run."""
1
+ """Package that contains poetry-plugin-dotenv, the plugin that automatically loads environment variables from a dotenv file into the environment before poetry commands are run."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
@@ -46,7 +46,6 @@ class ActivateCommand(EnvCommand):
46
46
 
47
47
  shell = os.environ.get("SHELL", "")
48
48
  if not shell:
49
- # Detect PowerShell by presence of PSMODULEPATH or executable on PATH
50
49
  pwsh_present = (
51
50
  os.environ.get("PSMODULEPATH") is not None
52
51
  or shutil.which("pwsh")
@@ -55,10 +54,9 @@ class ActivateCommand(EnvCommand):
55
54
  if pwsh_present:
56
55
  ps_exe = shutil.which("pwsh") or shutil.which("powershell")
57
56
  if ps_exe:
58
- # Run PowerShell, execute activation command and keep interactive session
57
+ # -NoExit keeps the session interactive after activation
59
58
  os.execvp(ps_exe, [ps_exe, "-NoExit", "-Command", activation_command]) # noqa: S606
60
59
 
61
- # If PowerShell isn't available, try cmd.exe (COMSPEC)
62
60
  comspec = os.environ.get("COMSPEC") or shutil.which("cmd")
63
61
  if comspec:
64
62
  os.execvp(comspec, [comspec, "/k", activation_command]) # noqa: S606
@@ -86,12 +84,12 @@ class ActivateCommand(EnvCommand):
86
84
  if os.name == "nt" or not shell:
87
85
  ps1 = venv.path / "Scripts" / "Activate.ps1"
88
86
  if ps1.exists():
89
- # Use PowerShell command to dot-source the script so variables export to session
87
+ # Dot-source the script so its variables reach the session
90
88
  return f"& '{ps1}'"
91
89
 
92
90
  bat = venv.path / "Scripts" / "activate.bat"
93
91
  if bat.exists():
94
- # Return path to batch file; the caller can invoke cmd.exe /k <bat>
92
+ # Bare path; the caller invokes it as cmd.exe /k <bat>
95
93
  return str(bat)
96
94
 
97
95
  return None
@@ -8,6 +8,8 @@ import dataclasses
8
8
 
9
9
  from typing import TYPE_CHECKING
10
10
  from typing import Any
11
+ from typing import Optional
12
+ from typing import Union
11
13
 
12
14
  import tomlkit
13
15
 
@@ -43,7 +45,7 @@ class _Config:
43
45
 
44
46
 
45
47
  if TYPE_CHECKING:
46
- ConfigValue = str | bool | list[str] | list[pathlib.Path] | pathlib.Path | None
48
+ ConfigValue = Optional[Union[str, bool, list[str], list[pathlib.Path], pathlib.Path]]
47
49
  else:
48
50
  ConfigValue = Any
49
51
 
@@ -1,4 +1,4 @@
1
- """Package for the dotenv functionality.
1
+ """Package that contains the dotenv functionality.
2
2
 
3
3
  This package is a fork of the ``python-dotenv`` package.
4
4
 
@@ -40,9 +40,9 @@ class DotEnv:
40
40
  self.override = override
41
41
  self.interpolate = interpolate
42
42
  self.encoding = "utf-8"
43
- self._dict: OrderedDict[str, str] | None = None
43
+ self._dict: OrderedDict[str, str | None] | None = None
44
44
 
45
- def dict(self) -> OrderedDict[str, str]:
45
+ def dict(self) -> OrderedDict[str, str | None]:
46
46
  """Get content of a dotenv file."""
47
47
  if self._dict:
48
48
  return self._dict
@@ -57,7 +57,7 @@ class DotEnv:
57
57
 
58
58
  return self._dict
59
59
 
60
- def parse(self) -> Iterator[tuple[str, str]]:
60
+ def parse(self) -> Iterator[tuple[str, str | None]]:
61
61
  """Parse a dotenv file."""
62
62
  with self._get_stream() as stream:
63
63
  for mapping in parsers.parse_stream(stream):
@@ -109,9 +109,13 @@ class DotEnv:
109
109
  yield io.StringIO("") # pragma: nocover
110
110
 
111
111
 
112
- def resolve(values: Iterable[tuple[str, str]], *, override: bool) -> OrderedDict[str, str]:
112
+ def resolve(
113
+ values: Iterable[tuple[str, str | None]],
114
+ *,
115
+ override: bool,
116
+ ) -> OrderedDict[str, str | None]:
113
117
  """Resolve dotenv variables."""
114
- new_values: OrderedDict[str, str] = OrderedDict()
118
+ new_values: OrderedDict[str, str | None] = OrderedDict()
115
119
 
116
120
  for name, value in values:
117
121
  if value is None:
@@ -119,7 +123,7 @@ def resolve(values: Iterable[tuple[str, str]], *, override: bool) -> OrderedDict
119
123
 
120
124
  else:
121
125
  atoms = variables.parse(value)
122
- env: OrderedDict[str, str] = OrderedDict()
126
+ env: OrderedDict[str, str | None] = OrderedDict()
123
127
 
124
128
  if override:
125
129
  env.update(os.environ)
@@ -160,7 +164,6 @@ def find(filename: str = ".env", *, usecwd: bool = False) -> Path | None:
160
164
  if usecwd or getattr(sys, "frozen", False):
161
165
  path = Path.cwd()
162
166
  else:
163
- # Get the directory of the caller's file
164
167
  caller_frame = sys._getframe(1) # noqa: SLF001
165
168
  caller_file = Path(caller_frame.f_code.co_filename).resolve()
166
169
  path = caller_file.parent
@@ -191,6 +194,6 @@ def values(
191
194
  stream: IO[str] | None = None,
192
195
  *,
193
196
  interpolate: bool = True,
194
- ) -> OrderedDict[str, str]:
197
+ ) -> OrderedDict[str, str | None]:
195
198
  """Parse a dotenv file and return its content as a dictionary."""
196
199
  return DotEnv(filepath=filepath, stream=stream, interpolate=interpolate).dict()
@@ -44,7 +44,7 @@ class Variable:
44
44
  name: str
45
45
  default: str | None = None
46
46
 
47
- def resolve(self, env: OrderedDict[str, str], *args, **kwargs) -> str:
47
+ def resolve(self, env: OrderedDict[str, str | None], *args, **kwargs) -> str:
48
48
  """Resolve the variable value from the environment or use the default."""
49
49
  return env.get(self.name, self.default or "") or ""
50
50