pkgcheck-cli 0.1.0__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,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: pkgcheck-cli
3
+ Version: 0.1.0
4
+ Summary: Check a Python package name for risk before you pip install it
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+
8
+ # pkgcheck-cli
9
+
10
+ A learning project: a command that checks a Python package **name** for risk before you install it.
11
+
12
+ pip install pkgcheck-cli
13
+ pkgcheck requests
14
+
15
+ Example output:
16
+
17
+ requests SAFE
18
+ reqeusts RISKY - name is very similar to popular package 'requests'
19
+
20
+ ## How it works
21
+
22
+ The command sends the package name to a small web server (FastAPI). The server runs a Random Forest model and answers SAFE or RISKY, with a plain-English reason.
23
+
24
+ ## Important limits (please read)
25
+
26
+ - **This is a learning project, not a security tool.** Do not rely on it to decide what is safe to install.
27
+ - The model uses **name-only clues**: name length, digits, dashes, and similarity to popular package names.
28
+ - On held-out test data it finds about **63%** of bad packages, and when it says RISKY it is right about **51%** of the time. The test data had far more bad packages than real PyPI has, so real-world precision would be lower.
29
+ - The 500 most popular packages are always answered SAFE.
30
+ - Bad examples come from the DataDog malicious-software-packages dataset. Safe examples are popular PyPI packages, which is not a perfect picture of the real world.
31
+ - The server runs on a free plan. The first request after a quiet period can take up to a minute, and the server may go offline.
32
+
33
+ ## Privacy
34
+
35
+ Only the package name you type is sent to the server. The server stores the name and its answer in a database.
36
+
37
+ ## Source code
38
+
39
+ https://github.com/meenakshitha2008-hue/pkgcheck
@@ -0,0 +1,32 @@
1
+ # pkgcheck-cli
2
+
3
+ A learning project: a command that checks a Python package **name** for risk before you install it.
4
+
5
+ pip install pkgcheck-cli
6
+ pkgcheck requests
7
+
8
+ Example output:
9
+
10
+ requests SAFE
11
+ reqeusts RISKY - name is very similar to popular package 'requests'
12
+
13
+ ## How it works
14
+
15
+ The command sends the package name to a small web server (FastAPI). The server runs a Random Forest model and answers SAFE or RISKY, with a plain-English reason.
16
+
17
+ ## Important limits (please read)
18
+
19
+ - **This is a learning project, not a security tool.** Do not rely on it to decide what is safe to install.
20
+ - The model uses **name-only clues**: name length, digits, dashes, and similarity to popular package names.
21
+ - On held-out test data it finds about **63%** of bad packages, and when it says RISKY it is right about **51%** of the time. The test data had far more bad packages than real PyPI has, so real-world precision would be lower.
22
+ - The 500 most popular packages are always answered SAFE.
23
+ - Bad examples come from the DataDog malicious-software-packages dataset. Safe examples are popular PyPI packages, which is not a perfect picture of the real world.
24
+ - The server runs on a free plan. The first request after a quiet period can take up to a minute, and the server may go offline.
25
+
26
+ ## Privacy
27
+
28
+ Only the package name you type is sent to the server. The server stores the name and its answer in a database.
29
+
30
+ ## Source code
31
+
32
+ https://github.com/meenakshitha2008-hue/pkgcheck
File without changes
@@ -0,0 +1,30 @@
1
+ import json
2
+ import os
3
+ import sys
4
+ import urllib.parse
5
+ import urllib.request
6
+
7
+ BASE_URL = os.getenv("PKGCHECK_URL", "https://pkgcheck.onrender.com")
8
+
9
+
10
+ def main():
11
+ if len(sys.argv) < 2:
12
+ print("Usage: pkgcheck <package-name>")
13
+ return
14
+ name = sys.argv[1]
15
+ url = BASE_URL + "/check?" + urllib.parse.urlencode({"name": name})
16
+ try:
17
+ with urllib.request.urlopen(url, timeout=90) as r:
18
+ data = json.load(r)
19
+ except Exception as e:
20
+ print("Could not reach the pkgcheck server:", e)
21
+ print("If the server was idle, wait a minute and try again.")
22
+ return
23
+ line = f"{data['name']} {data['verdict']}"
24
+ if data["verdict"] == "RISKY" and data["reasons"]:
25
+ line += " - " + "; ".join(data["reasons"])
26
+ print(line)
27
+
28
+
29
+ if __name__ == "__main__":
30
+ main()
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: pkgcheck-cli
3
+ Version: 0.1.0
4
+ Summary: Check a Python package name for risk before you pip install it
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+
8
+ # pkgcheck-cli
9
+
10
+ A learning project: a command that checks a Python package **name** for risk before you install it.
11
+
12
+ pip install pkgcheck-cli
13
+ pkgcheck requests
14
+
15
+ Example output:
16
+
17
+ requests SAFE
18
+ reqeusts RISKY - name is very similar to popular package 'requests'
19
+
20
+ ## How it works
21
+
22
+ The command sends the package name to a small web server (FastAPI). The server runs a Random Forest model and answers SAFE or RISKY, with a plain-English reason.
23
+
24
+ ## Important limits (please read)
25
+
26
+ - **This is a learning project, not a security tool.** Do not rely on it to decide what is safe to install.
27
+ - The model uses **name-only clues**: name length, digits, dashes, and similarity to popular package names.
28
+ - On held-out test data it finds about **63%** of bad packages, and when it says RISKY it is right about **51%** of the time. The test data had far more bad packages than real PyPI has, so real-world precision would be lower.
29
+ - The 500 most popular packages are always answered SAFE.
30
+ - Bad examples come from the DataDog malicious-software-packages dataset. Safe examples are popular PyPI packages, which is not a perfect picture of the real world.
31
+ - The server runs on a free plan. The first request after a quiet period can take up to a minute, and the server may go offline.
32
+
33
+ ## Privacy
34
+
35
+ Only the package name you type is sent to the server. The server stores the name and its answer in a database.
36
+
37
+ ## Source code
38
+
39
+ https://github.com/meenakshitha2008-hue/pkgcheck
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ pkgcheck_cli/__init__.py
4
+ pkgcheck_cli/main.py
5
+ pkgcheck_cli.egg-info/PKG-INFO
6
+ pkgcheck_cli.egg-info/SOURCES.txt
7
+ pkgcheck_cli.egg-info/dependency_links.txt
8
+ pkgcheck_cli.egg-info/entry_points.txt
9
+ pkgcheck_cli.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pkgcheck = pkgcheck_cli.main:main
@@ -0,0 +1 @@
1
+ pkgcheck_cli
@@ -0,0 +1,14 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pkgcheck-cli"
7
+ version = "0.1.0"
8
+ description = "Check a Python package name for risk before you pip install it"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ dependencies = []
12
+
13
+ [project.scripts]
14
+ pkgcheck = "pkgcheck_cli.main:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+