python-dotenvx 0.2.2__tar.gz → 0.2.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.
@@ -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.2...main)
5
+ ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.4...main)
6
+
7
+ ## [0.2.4](https://github.com/dotenvx/dotenvx/compare/v0.2.3...v0.2.4)
8
+
9
+ ### Added
10
+
11
+ * Add the ability to specify the `os` and `arch` on `dotenvx-postinstall`
12
+
13
+ ## [0.2.3](https://github.com/dotenvx/dotenvx/compare/v0.2.2...v0.2.3)
14
+
15
+ ### Changed
16
+
17
+ * Patch `dotenvx` binary install across multiple edge cases
6
18
 
7
19
  ## [0.2.2](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.2)
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.2
3
+ Version: 0.2.4
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,46 @@ 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
+ # or to specify the os-arch – useful for building binaries to a specific target such as linux-x86_64 on aws lambda
56
+ dotenvx-postinstall --os linux --arch x86_64
57
+ ```
58
+
59
+ Then use it in code.
60
+
49
61
  ```python
50
62
  # main.py
51
63
  import os
52
64
  from dotenvx import load_dotenvx
53
- load_dotenvx() # take environment variables from .env.
65
+ load_dotenvx() # take environment variables from .env.
54
66
 
55
67
  print(os.getenv("S3_BUCKET"))
56
68
  ```
57
69
 
58
70
   
59
71
 
60
-
61
72
  # Changelog
62
73
 
63
74
  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
75
 
65
- ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.2...main)
76
+ ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.4...main)
77
+
78
+ ## [0.2.4](https://github.com/dotenvx/dotenvx/compare/v0.2.3...v0.2.4)
79
+
80
+ ### Added
81
+
82
+ * Add the ability to specify the `os` and `arch` on `dotenvx-postinstall`
83
+
84
+ ## [0.2.3](https://github.com/dotenvx/dotenvx/compare/v0.2.2...v0.2.3)
85
+
86
+ ### Changed
87
+
88
+ * Patch `dotenvx` binary install across multiple edge cases
66
89
 
67
90
  ## [0.2.2](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.2)
68
91
 
@@ -25,14 +25,25 @@ 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
+ # or to specify the os-arch – useful for building binaries to a specific target such as linux-x86_64 on aws lambda
35
+ dotenvx-postinstall --os linux --arch x86_64
36
+ ```
37
+
38
+ Then use it in code.
39
+
28
40
  ```python
29
41
  # main.py
30
42
  import os
31
43
  from dotenvx import load_dotenvx
32
- load_dotenvx() # take environment variables from .env.
44
+ load_dotenvx() # take environment variables from .env.
33
45
 
34
46
  print(os.getenv("S3_BUCKET"))
35
47
  ```
36
48
 
37
49
   
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,25 +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
- print("installing dotenvx........")
23
-
24
- bin_dir = os.path.join(dir, 'src', 'dotenvx', 'bin')
25
- os.makedirs(bin_dir, exist_ok=True)
26
-
27
- # install dotenvx binary using your install script into bin/
28
- subprocess.run(
29
- ['sh', '-c', f'curl -sfS "https://dotenvx.sh?directory={bin_dir}" | sh'],
30
- check=True,
31
- stdout=None,
32
- stderr=None
33
- )
34
-
35
- print("installed dotenvx........")
36
-
37
- super().run()
38
-
39
18
  setup(
40
19
  name='python-dotenvx',
41
20
  description=src['__description__'],
@@ -45,6 +24,7 @@ setup(
45
24
  license=src['__license__'],
46
25
  author=src['__author__'],
47
26
  author_email=src['__author_email__'],
27
+ include_package_data=True,
48
28
  packages=find_packages('src'),
49
29
  package_dir={'': 'src'},
50
30
  url=src['__url__'],
@@ -61,5 +41,9 @@ setup(
61
41
  ],
62
42
  install_requires=[
63
43
  ],
64
- cmdclass={'install': InstallBinary},
44
+ entry_points={
45
+ 'console_scripts': [
46
+ 'dotenvx-postinstall=dotenvx.main:postinstall',
47
+ ],
48
+ }
65
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.2"
4
+ __version__ = "0.2.4"
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,73 @@
1
+ import os
2
+ import json
3
+ import shutil
4
+ import subprocess
5
+ import argparse
6
+
7
+ from dotenvx import __file__ as package_path
8
+
9
+ ERROR_MISSING_BINARY = "[MISSING_BINARY] missing dotenvx binary\n[MISSING_BINARY] https://github.com/dotenvx/dotenvx/issues/576"
10
+
11
+ def load_dotenvx():
12
+ output = get()
13
+
14
+ try:
15
+ parsed = json.loads(output)
16
+ for key, value in parsed.items():
17
+ os.environ[key] = value
18
+ return parsed
19
+ except Exception as e:
20
+ raise RuntimeError(f"Failed to parse dotenvx output: {e}")
21
+
22
+ def get():
23
+ binpath = binary()
24
+ output = subprocess.run(
25
+ [binpath, "get", "-pp"],
26
+ capture_output=True,
27
+ text=True,
28
+ check=True
29
+ )
30
+ return output.stdout.strip()
31
+
32
+ def binary():
33
+ local_bin = os.path.join(os.path.dirname(package_path), "bin", "dotenvx")
34
+ candidates = [local_bin, shutil.which("dotenvx")]
35
+
36
+ for candidate in candidates:
37
+ if candidate and os.path.isfile(candidate) and os.access(candidate, os.X_OK):
38
+ if is_stub_file(candidate):
39
+ continue
40
+ return candidate
41
+
42
+ print("[MISSING_BINARY] missing dotenvx binary")
43
+ print("[MISSING_BINARY] https://github.com/dotenvx/dotenvx/issues/576")
44
+ raise SystemExit(1)
45
+
46
+ def is_stub_file(path, max_stub_size=1024):
47
+ try:
48
+ return os.path.getsize(path) < max_stub_size
49
+ except OSError:
50
+ return False
51
+
52
+ def postinstall():
53
+ parser = argparse.ArgumentParser()
54
+ parser.add_argument("--os", help="Override OS", default="")
55
+ parser.add_argument("--arch", help="Override architecture", default="")
56
+ args = parser.parse_args()
57
+
58
+ bin_dir = os.path.join(os.path.dirname(__file__), "bin")
59
+ os.makedirs(bin_dir, exist_ok=True)
60
+
61
+ url = f"https://dotenvx.sh?directory={bin_dir}"
62
+ if args.os:
63
+ url += f"&os={args.os}"
64
+ if args.arch:
65
+ url += f"&arch={args.arch}"
66
+
67
+ try:
68
+ subprocess.run(
69
+ ["sh", "-c", f'curl -sfS "{url}" | sh'],
70
+ check=True
71
+ )
72
+ except subprocess.CalledProcessError as e:
73
+ raise SystemExit(e.returncode)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-dotenvx
3
- Version: 0.2.2
3
+ Version: 0.2.4
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,46 @@ 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
+ # or to specify the os-arch – useful for building binaries to a specific target such as linux-x86_64 on aws lambda
56
+ dotenvx-postinstall --os linux --arch x86_64
57
+ ```
58
+
59
+ Then use it in code.
60
+
49
61
  ```python
50
62
  # main.py
51
63
  import os
52
64
  from dotenvx import load_dotenvx
53
- load_dotenvx() # take environment variables from .env.
65
+ load_dotenvx() # take environment variables from .env.
54
66
 
55
67
  print(os.getenv("S3_BUCKET"))
56
68
  ```
57
69
 
58
70
  &nbsp;
59
71
 
60
-
61
72
  # Changelog
62
73
 
63
74
  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
75
 
65
- ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.2...main)
76
+ ## [Unreleased](https://github.com/dotenvx/python-dotenvx/compare/v0.2.4...main)
77
+
78
+ ## [0.2.4](https://github.com/dotenvx/dotenvx/compare/v0.2.3...v0.2.4)
79
+
80
+ ### Added
81
+
82
+ * Add the ability to specify the `os` and `arch` on `dotenvx-postinstall`
83
+
84
+ ## [0.2.3](https://github.com/dotenvx/dotenvx/compare/v0.2.2...v0.2.3)
85
+
86
+ ### Changed
87
+
88
+ * Patch `dotenvx` binary install across multiple edge cases
66
89
 
67
90
  ## [0.2.2](https://github.com/dotenvx/dotenvx/compare/v0.2.1...v0.2.2)
68
91
 
@@ -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