python-dotenvx 0.2.1__tar.gz → 0.2.3__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.
@@ -2,7 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.1...main)
5
+ ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.3...main)
6
+
7
+ ## [0.2.3](https://github.com/dotenvx/dotenvx/compare/v0.2.2...v0.2.3)
8
+
9
+ ### Changed
10
+
11
+ * Patch `dotenvx` binary install across multiple edge cases
12
+
13
+ ## [0.2.2](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.2)
14
+
15
+ ### Changed
16
+
17
+ * Adjust installation of `dotenvx` binary on demand
6
18
 
7
19
  ## [0.2.1](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.1)
8
20
 
@@ -0,0 +1,2 @@
1
+ include CHANGELOG.md
2
+ include src/dotenvx/bin/dotenvx
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-dotenvx
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: [dotenvx.com] a better dotenv–from the creator of `dotenv`
5
5
  Home-page: https://github.com/dotenvx/python-dotenvx
6
6
  Author: dotenv
@@ -46,23 +46,43 @@ Install and use it in code just like `python-dotenv`.
46
46
  ```sh
47
47
  pip install python-dotenvx
48
48
  ```
49
+
50
+ Then run `dotenvx-postinstall` to install the `dotenvx` binary (python-dotenvx is a wrapper).
51
+
52
+ ```sh
53
+ dotenvx-postinstall
54
+ ```
55
+
56
+ Then use it in code.
57
+
49
58
  ```python
50
59
  # main.py
51
60
  import os
52
61
  from dotenvx import load_dotenvx
53
- load_dotenvx() # take environment variables from .env.
62
+ load_dotenvx() # take environment variables from .env.
54
63
 
55
64
  print(os.getenv("S3_BUCKET"))
56
65
  ```
57
66
 
58
67
   
59
68
 
60
-
61
69
  # Changelog
62
70
 
63
71
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
64
72
 
65
- ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.1...main)
73
+ ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.3...main)
74
+
75
+ ## [0.2.3](https://github.com/dotenvx/dotenvx/compare/v0.2.2...v0.2.3)
76
+
77
+ ### Changed
78
+
79
+ * Patch `dotenvx` binary install across multiple edge cases
80
+
81
+ ## [0.2.2](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.2)
82
+
83
+ ### Changed
84
+
85
+ * Adjust installation of `dotenvx` binary on demand
66
86
 
67
87
  ## [0.2.1](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.1)
68
88
 
@@ -25,14 +25,22 @@ Install and use it in code just like `python-dotenv`.
25
25
  ```sh
26
26
  pip install python-dotenvx
27
27
  ```
28
+
29
+ Then run `dotenvx-postinstall` to install the `dotenvx` binary (python-dotenvx is a wrapper).
30
+
31
+ ```sh
32
+ dotenvx-postinstall
33
+ ```
34
+
35
+ Then use it in code.
36
+
28
37
  ```python
29
38
  # main.py
30
39
  import os
31
40
  from dotenvx import load_dotenvx
32
- load_dotenvx() # take environment variables from .env.
41
+ load_dotenvx() # take environment variables from .env.
33
42
 
34
43
  print(os.getenv("S3_BUCKET"))
35
44
  ```
36
45
 
37
46
   
38
-
@@ -1,7 +1,5 @@
1
1
  import os
2
- import subprocess
3
2
  from setuptools import setup, find_packages
4
- from setuptools.command.install import install
5
3
 
6
4
  src = {}
7
5
  dir = os.path.abspath(os.path.dirname(__file__))
@@ -17,19 +15,6 @@ def read_files(files):
17
15
 
18
16
  readme = read_files(['README.md', 'CHANGELOG.md'])
19
17
 
20
- class InstallBinary(install):
21
- def run(self):
22
- bin_dir = os.path.join(dir, 'src', 'dotenvx', 'bin')
23
- os.makedirs(bin_dir, exist_ok=True)
24
-
25
- # install dotenvx binary using your install script into bin/
26
- subprocess.run([
27
- 'sh', '-c',
28
- f'curl -sfS "https://dotenvx.sh?directory={bin_dir}" | sh'
29
- ], check=True)
30
-
31
- super().run()
32
-
33
18
  setup(
34
19
  name='python-dotenvx',
35
20
  description=src['__description__'],
@@ -39,6 +24,7 @@ setup(
39
24
  license=src['__license__'],
40
25
  author=src['__author__'],
41
26
  author_email=src['__author_email__'],
27
+ include_package_data=True,
42
28
  packages=find_packages('src'),
43
29
  package_dir={'': 'src'},
44
30
  url=src['__url__'],
@@ -55,7 +41,9 @@ setup(
55
41
  ],
56
42
  install_requires=[
57
43
  ],
58
- package_data={'dotenvx': ['bin/dotenvx']},
59
- include_package_data=True,
60
- cmdclass={'install': InstallBinary},
44
+ entry_points={
45
+ 'console_scripts': [
46
+ 'dotenvx-postinstall=dotenvx.main:postinstall',
47
+ ],
48
+ }
61
49
  )
@@ -1,7 +1,7 @@
1
1
  __title__ = "python-dotenvx"
2
2
  __description__ = "[dotenvx.com] a better dotenv–from the creator of `dotenv`"
3
3
  __url__ = "https://github.com/dotenvx/python-dotenvx"
4
- __version__ = "0.2.1"
4
+ __version__ = "0.2.3"
5
5
  __author__ = "dotenv"
6
6
  __author_email__ = "mot@dotenvx.com"
7
7
  __license__ = "BSD-3-Clause"
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ echo "[MISSING_BINARY] missing dotenvx binary. run: dotenvx-postinstall"
3
+ exit 1
@@ -0,0 +1,61 @@
1
+ import os
2
+ import json
3
+ import shutil
4
+ import subprocess
5
+
6
+ from dotenvx import __file__ as package_path
7
+
8
+ ERROR_MISSING_BINARY = "[MISSING_BINARY] missing dotenvx binary\n[MISSING_BINARY] https://github.com/dotenvx/dotenvx/issues/576"
9
+
10
+ def load_dotenvx():
11
+ output = get()
12
+
13
+ try:
14
+ parsed = json.loads(output)
15
+ for key, value in parsed.items():
16
+ os.environ[key] = value
17
+ return parsed
18
+ except Exception as e:
19
+ raise RuntimeError(f"Failed to parse dotenvx output: {e}")
20
+
21
+ def get():
22
+ binpath = binary()
23
+ output = subprocess.run(
24
+ [binpath, "get", "-pp"],
25
+ capture_output=True,
26
+ text=True,
27
+ check=True
28
+ )
29
+ return output.stdout.strip()
30
+
31
+ def binary():
32
+ local_bin = os.path.join(os.path.dirname(package_path), "bin", "dotenvx")
33
+ candidates = [local_bin, shutil.which("dotenvx")]
34
+
35
+ for candidate in candidates:
36
+ if candidate and os.path.isfile(candidate) and os.access(candidate, os.X_OK):
37
+ if is_stub_file(candidate):
38
+ continue
39
+ return candidate
40
+
41
+ print("[MISSING_BINARY] missing dotenvx binary")
42
+ print("[MISSING_BINARY] https://github.com/dotenvx/dotenvx/issues/576")
43
+ raise SystemExit(1)
44
+
45
+ def is_stub_file(path, max_stub_size=1024):
46
+ try:
47
+ return os.path.getsize(path) < max_stub_size
48
+ except OSError:
49
+ return False
50
+
51
+ def postinstall():
52
+ bin_dir = os.path.join(os.path.dirname(package_path), "bin")
53
+ os.makedirs(bin_dir, exist_ok=True)
54
+
55
+ try:
56
+ subprocess.run(
57
+ ["sh", "-c", f"curl -sfS https://dotenvx.sh?directory={bin_dir} | sh"],
58
+ check=True
59
+ )
60
+ except subprocess.CalledProcessError as e:
61
+ raise SystemExit(e.returncode)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-dotenvx
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: [dotenvx.com] a better dotenv–from the creator of `dotenv`
5
5
  Home-page: https://github.com/dotenvx/python-dotenvx
6
6
  Author: dotenv
@@ -46,23 +46,43 @@ Install and use it in code just like `python-dotenv`.
46
46
  ```sh
47
47
  pip install python-dotenvx
48
48
  ```
49
+
50
+ Then run `dotenvx-postinstall` to install the `dotenvx` binary (python-dotenvx is a wrapper).
51
+
52
+ ```sh
53
+ dotenvx-postinstall
54
+ ```
55
+
56
+ Then use it in code.
57
+
49
58
  ```python
50
59
  # main.py
51
60
  import os
52
61
  from dotenvx import load_dotenvx
53
- load_dotenvx() # take environment variables from .env.
62
+ load_dotenvx() # take environment variables from .env.
54
63
 
55
64
  print(os.getenv("S3_BUCKET"))
56
65
  ```
57
66
 
58
67
  &nbsp;
59
68
 
60
-
61
69
  # Changelog
62
70
 
63
71
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
64
72
 
65
- ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.1...main)
73
+ ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.3...main)
74
+
75
+ ## [0.2.3](https://github.com/dotenvx/dotenvx/compare/v0.2.2...v0.2.3)
76
+
77
+ ### Changed
78
+
79
+ * Patch `dotenvx` binary install across multiple edge cases
80
+
81
+ ## [0.2.2](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.2)
82
+
83
+ ### Changed
84
+
85
+ * Adjust installation of `dotenvx` binary on demand
66
86
 
67
87
  ## [0.2.1](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.1)
68
88
 
@@ -7,7 +7,9 @@ setup.py
7
7
  src/dotenvx/__init__.py
8
8
  src/dotenvx/__version__.py
9
9
  src/dotenvx/main.py
10
+ src/dotenvx/bin/dotenvx
10
11
  src/python_dotenvx.egg-info/PKG-INFO
11
12
  src/python_dotenvx.egg-info/SOURCES.txt
12
13
  src/python_dotenvx.egg-info/dependency_links.txt
14
+ src/python_dotenvx.egg-info/entry_points.txt
13
15
  src/python_dotenvx.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ dotenvx-postinstall = dotenvx.main:postinstall
@@ -1 +0,0 @@
1
- include CHANGELOG.md
@@ -1,2 +0,0 @@
1
- def load_dotenvx():
2
- raise NotImplementedError("go to [github.com/dotenvx/dotenvx] and follow python directions there")
File without changes
File without changes