pipslim 0.1.1__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.
@@ -0,0 +1,4 @@
1
+ venv/
2
+ *.pyc
3
+ */__pycache__
4
+ *.egg-info
pipslim-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.4
2
+ Name: pipslim
3
+ Version: 0.1.1
4
+ Summary: Create high-order dependency requirement.txt files
5
+ Author-email: Mitch Naake <mitch@neutron.au>
6
+ Project-URL: Homepage, http://github.com/mitch0s/pipslim
7
+ Project-URL: Bug Tracker, https://github.com/mitch0s/pipslim/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: setuptools>=61.0
14
+
15
+ # pipslim
16
+ Lightweight Python package used for generating requirements.txt files containing only the "top level" dependencies.
@@ -0,0 +1,2 @@
1
+ # pipslim
2
+ Lightweight Python package used for generating requirements.txt files containing only the "top level" dependencies.
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "setuptools_scm>=8"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project.scripts]
6
+ pipslim = "pipslim:main"
7
+
8
+ [tool.setuptools.packages.find]
9
+ where = ["src"]
10
+
11
+ [tool.setuptools.package-data]
12
+ "pipslim" = ["*.ps1"]
13
+
14
+ [project]
15
+ name = "pipslim"
16
+ version = "v0.1.1"
17
+ # dynamic = ["version"]
18
+ authors = [
19
+ { name="Mitch Naake", email="mitch@neutron.au" }
20
+ ]
21
+ description = "Create high-order dependency requirement.txt files"
22
+ readme = "README.md"
23
+ requires-python = ">=3.10"
24
+ classifiers = [
25
+ "Programming Language :: Python :: 3",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Operating System :: OS Independent",
28
+ ]
29
+ dependencies = [
30
+ "setuptools>=61.0"
31
+ ]
32
+
33
+ # [tool.setuptools_scm]
34
+
35
+ [project.urls]
36
+ "Homepage" = "http://github.com/mitch0s/pipslim"
37
+ "Bug Tracker" = "https://github.com/mitch0s/pipslim/issues"
File without changes
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,13 @@
1
+ import sys
2
+ import pipslim
3
+
4
+ def main():
5
+ """
6
+ Program entry point
7
+ """
8
+ for package in pipslim.util.list_packages():
9
+ if len(pipslim.list_package_dependencies(package['name'])) == 0:
10
+ print(f"{package['name']}=={package['version']}")
11
+
12
+ if __name__ == '__main__':
13
+ main()
@@ -0,0 +1 @@
1
+ from .util import *
@@ -0,0 +1,32 @@
1
+
2
+ import sys
3
+ import subprocess
4
+ import json
5
+
6
+ def in_venv():
7
+ # Check for sys.real_prefix for older virtualenv compatibility
8
+ if hasattr(sys, 'real_prefix'):
9
+ return True
10
+
11
+
12
+ def list_packages() -> list[dict]:
13
+ """
14
+ fetch a list of packages and their installed version.
15
+ """
16
+ # pip list --format json
17
+ result = subprocess.run(['pip', 'list', '--format', 'json'], capture_output=True, text=True)
18
+ return json.loads(result.stdout)
19
+
20
+
21
+ def list_package_dependencies(package:str=None) -> list[dict]:
22
+ """
23
+ returns a list of higher-order packages that depend on this package.
24
+ """
25
+ result = subprocess.run(['pip', 'show', package], capture_output=True, text=True).stdout
26
+ for line in result.split('\n'):
27
+ if line.startswith('Required-by:'):
28
+ line = line.replace(' ', '')
29
+ line = line.replace('Required-by:', '')
30
+ deps = list(filter(lambda dep: dep != '', line.split(',')))
31
+ return deps
32
+ return []
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.4
2
+ Name: pipslim
3
+ Version: 0.1.1
4
+ Summary: Create high-order dependency requirement.txt files
5
+ Author-email: Mitch Naake <mitch@neutron.au>
6
+ Project-URL: Homepage, http://github.com/mitch0s/pipslim
7
+ Project-URL: Bug Tracker, https://github.com/mitch0s/pipslim/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: setuptools>=61.0
14
+
15
+ # pipslim
16
+ Lightweight Python package used for generating requirements.txt files containing only the "top level" dependencies.
@@ -0,0 +1,13 @@
1
+ .gitignore
2
+ README.md
3
+ pyproject.toml
4
+ requirements.txt
5
+ src/main.py
6
+ src/pipslim/__init__.py
7
+ src/pipslim/util.py
8
+ src/pipslim.egg-info/PKG-INFO
9
+ src/pipslim.egg-info/SOURCES.txt
10
+ src/pipslim.egg-info/dependency_links.txt
11
+ src/pipslim.egg-info/entry_points.txt
12
+ src/pipslim.egg-info/requires.txt
13
+ src/pipslim.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pipslim = pipslim:main
@@ -0,0 +1 @@
1
+ setuptools>=61.0
@@ -0,0 +1 @@
1
+ pipslim