ptgit 1.0.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,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
ptgit-1.0.0/.gitignore ADDED
@@ -0,0 +1,181 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ # Cursor
177
+ # Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
178
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
179
+ # refer to https://docs.cursor.com/context/ignore-files
180
+ .cursorignore
181
+ .cursorindexingignore
ptgit-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Char
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
ptgit-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: ptgit
3
+ Version: 1.0.0
4
+ Summary: Pip Through Git is a way to install python packages through git.
5
+ Project-URL: Homepage, https://github.com/CharGoldenYT/ptgit
6
+ Project-URL: Issues, https://github.com/CharGoldenYT/ptgit/issues
7
+ Author: CharGoldenYT
8
+ License-Expression: GPL-3.0-or-later
9
+ License-File: LICENSE
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.12
13
+ Requires-Dist: gitpython
14
+ Description-Content-Type: text/markdown
15
+
16
+ # Python Packages through git repositories! | PTGit
17
+
18
+ PTGit (Pip through Git) is an alternative pip install method that allows you to install python packages directly through a git repository
19
+
20
+
21
+ ## Adding better compatibility with this tool
22
+
23
+ If you would like the tool to be able to run smoother with YOUR project, simply include a built package with the following structure in your project
24
+
25
+ ```
26
+ Root
27
+ |
28
+ | packaged
29
+ |
30
+ |___ pgit.tar.gz
31
+ |
32
+ |___ pgit_details.whl (optional)
33
+ ```
34
+
35
+ ## Useage
36
+
37
+ `python -m ptgit packagename sourceURL`
38
+
39
+ Installs `packagename` from `sourceURL`
ptgit-1.0.0/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Python Packages through git repositories! | PTGit
2
+
3
+ PTGit (Pip through Git) is an alternative pip install method that allows you to install python packages directly through a git repository
4
+
5
+
6
+ ## Adding better compatibility with this tool
7
+
8
+ If you would like the tool to be able to run smoother with YOUR project, simply include a built package with the following structure in your project
9
+
10
+ ```
11
+ Root
12
+ |
13
+ | packaged
14
+ |
15
+ |___ pgit.tar.gz
16
+ |
17
+ |___ pgit_details.whl (optional)
18
+ ```
19
+
20
+ ## Useage
21
+
22
+ `python -m ptgit packagename sourceURL`
23
+
24
+ Installs `packagename` from `sourceURL`
@@ -0,0 +1,50 @@
1
+ import os
2
+ import json
3
+ from typing import Any
4
+ from pathlib import Path
5
+ configuration = {"AllowPackagedFiles": False, "IgnoreWarning": False}
6
+
7
+ def checkOS()->str:
8
+ if (os.getenv("HOME") is None):
9
+ return "WINDOWS"
10
+
11
+ return "UNIX"
12
+
13
+ def readConfigFile()->configuration:
14
+ curOS = checkOS()
15
+ path = ""
16
+ if (curOS == "WINDOWS"):
17
+ path += os.getenv("APPDATA")
18
+ else:
19
+ path += os.getenv("HOME")
20
+ if (not Path(path + "/ptgit_config").exists()):
21
+ os.mkdir(path + "/ptgit_config")
22
+ writeConfigFile(configuration)
23
+ if (not Path(path + '/ptgit_config/config.json').exists()):
24
+ writeConfigFile(configuration)
25
+ file = open(path + "/ptgit_config/config.json", "r")
26
+ rawJson = file.read()
27
+ print(f"RawJson: {rawJson}")
28
+
29
+ return json.loads(rawJson)["config"]
30
+
31
+ def writeConfigFile(config:configuration):
32
+ curOS = checkOS()
33
+ path = ""
34
+ if (curOS == "WINDOWS"):
35
+ path += os.getenv("APPDATA")
36
+ else:
37
+ path += os.getenv("HOME")
38
+ file = open(path + "/ptgit_config/config.json", "w")
39
+ file.write(json.dumps({"config": config}, indent="\t"))
40
+ file.close()
41
+
42
+
43
+ def setConfig(name:str, newValue:Any):
44
+ config = readConfigFile()
45
+ value = config["name"]
46
+ if (value is None):
47
+ return
48
+
49
+ config[name] = newValue
50
+ writeConfigFile(config)
@@ -0,0 +1 @@
1
+ # Nothin here!
@@ -0,0 +1,228 @@
1
+ import sys
2
+ import os
3
+ from typing import Any
4
+ from urllib.parse import urlparse as parse
5
+ from .__configReader__ import readConfigFile, setConfig, checkOS
6
+ from subprocess import run
7
+ from pathlib import Path
8
+ from git import Repo
9
+
10
+ global packName
11
+ global URL
12
+ global branch
13
+ global build
14
+ global allowPrePackaged
15
+
16
+ packName = ""
17
+ URL = ""
18
+ branch = ""
19
+ build = False
20
+ allowPrePackaged = False
21
+
22
+ def processArg(arg:str, base:str = "") -> Any:
23
+ if (arg.lower() == "help"):
24
+ print("""PTGit (Pip Through Git)
25
+
26
+ Useage:
27
+
28
+ ptgit packagename packageURL <arguments> - Install a package from git.
29
+
30
+ Arguments:
31
+ --help: Displays this message
32
+ --branch="branchName" Determines which branch to install from
33
+ --autoinstall="[<packagenames>]" calls pip to install these packages if they are not included as a requirement in the package's repo
34
+ --config starts the configuration script""")
35
+ exit(0)
36
+
37
+
38
+ if (arg.lower().startswith("branch=")):
39
+ return arg.split("=")[1]
40
+
41
+
42
+ print(f"Not a valid argument {base}{arg}! Use --help for information!")
43
+
44
+ def checkArgs():
45
+ arg_array = []
46
+ for item in args:
47
+ if (arg_array.__contains__(item) and ["--branch"].__contains__(item)):
48
+ print(f"You cannot call {item} twice!")
49
+ processArg("help")
50
+ arg_array.append(item)
51
+
52
+ def runConfigScript():
53
+ configFile = readConfigFile()
54
+ validOptions = {"1": "AllowPackagedFiles"}
55
+ result = input("From the following options choose one to switch\n1: Allow Potentially Unsafe Pre-Packaged files from git repositories: " + str(configFile["AllowPackagedFiles"]))
56
+
57
+ if (result == "1"):
58
+ setConfig("AllowPackagedFiles", (not configFile["AllowPackagedFiles"]))
59
+
60
+ if (not validOptions.__contains__(result)):
61
+ print("Invalid Option!")
62
+ runConfigScript()
63
+
64
+ print("Configuration saved! " + validOptions[result] + " set to " + configFile[validOptions[result]])
65
+ exit(0)
66
+
67
+ args = sys.argv
68
+ if (args[0].endswith(".py") or args[0] == "ptgit"):
69
+ args.remove(args[0])
70
+
71
+ if (args.__contains__("--config")):
72
+ runConfigScript()
73
+
74
+ if (args.__len__() < 2):
75
+ print("Invalid number of arguments!")
76
+ processArg("help")
77
+
78
+ config = readConfigFile()
79
+ if (config["AllowPackagedFiles"]):
80
+ i = input("WARNING: unsafe switch \"AllowPackagedFiles\" is enabled!\nThis may make it easy for malicious actors to install fake packages that comprimise your system!\nAlways check official sources before installng from a git repo!\nPress ENTER to continue, type IGNORE to permanently remove this warning.")
81
+ if (i.upper() == "IGNORE"):
82
+ setConfig("IgnoreWarning", True)
83
+
84
+ checkArgs()
85
+
86
+ result = parse(args[0])
87
+
88
+ if (all([result.scheme, result.netloc])):
89
+ print("Invalid arguments!")
90
+ processArg("help")
91
+ else:
92
+ packName = args[0]
93
+
94
+ result = parse(args[1])
95
+
96
+ if (not all([result.scheme, result.netloc])):
97
+ print("Invalid arguments!")
98
+ processArg("help")
99
+ else:
100
+ URL = args[1]
101
+
102
+ for item in args:
103
+ if (item.startswith("--")):
104
+ result = processArg(item.removeprefix("--"), "--")
105
+ if (isinstance(result, str)):
106
+ branch = result
107
+ if (isinstance(result, bool)):
108
+ build = True
109
+
110
+
111
+
112
+ br = ""
113
+ if (branch.__len__() > 0):
114
+ br = f" at branch {branch}"
115
+
116
+ curOS = checkOS()
117
+
118
+ path = ""
119
+
120
+ if (curOS == "WINDOWS"):
121
+ path += os.getenv("LOCALAPPDATA")
122
+ else:
123
+ path += os.getenv("HOME")
124
+
125
+ def showProg(op_code, cur_count, max_count=None, message=''):
126
+ finalStr = ""
127
+
128
+ match op_code:
129
+ case 0:
130
+ finalStr += "[Beginning Clone]: "
131
+ case 1:
132
+ finalStr += "[Finished Cloning]: "
133
+ case 2:
134
+ finalStr += "[Counting Objects]: "
135
+ case 3:
136
+ finalStr += "[Compressing Objects]: "
137
+ case 4:
138
+ finalStr += "[Writing objects]: "
139
+ case 5:
140
+ finalStr += "[Recieving Objects]: "
141
+ case 6:
142
+ finalStr += "[Unimplemented Code]: "
143
+ case 7:
144
+ finalStr += "[Unimplemented Code]:"
145
+ case 8:
146
+ finalStr += "[Checking Out Branch]"
147
+
148
+ finalStr += " | " + str(cur_count)
149
+ if (max_count is not None):
150
+ finalStr += " / " + str(max_count)
151
+ else:
152
+ finalStr += " / ?"
153
+
154
+ if (message is not None and message.__len__() > 0):
155
+ finalStr += "\n" + message
156
+
157
+ if (curOS == "WINDOWS"):
158
+ os.system("cls")
159
+ else:
160
+ os.system("clear")
161
+
162
+ print(f"Getting package {packName} from {URL}{br}.")
163
+ print(finalStr)
164
+
165
+
166
+
167
+ fullPath = path + "/Temp_ptgit/" + packName
168
+
169
+ if (Path(fullPath).exists()):
170
+ import shutil
171
+ shutil.rmtree(fullPath)
172
+
173
+ repo = Repo.clone_from(URL, fullPath, showProg)
174
+
175
+ zip_path = fullPath + "/" + packName + ".zip"
176
+
177
+ print(f'zip {zip_path} {os.curdir}')
178
+ os.chdir(fullPath)
179
+ if curOS == "WINDOWS":
180
+ input("You MUST have 7zip installed for this command to work, press ENTER to continue")
181
+ zip_process = run(["7z", "a", "-tzip", zip_path, ".\\"])
182
+
183
+ while zip_process.returncode is None:
184
+ from time import sleep
185
+ if (curOS == "WINDOWS"):
186
+ os.system("cls")
187
+ else:
188
+ os.system("clear")
189
+
190
+ print(zip_path.stdout.read())
191
+
192
+ sleep(0.01)
193
+
194
+ print(zip_process.returncode)
195
+ else:
196
+ zip_process = run(['zip', '-r', zip_path, "./"])
197
+
198
+ while zip_process.returncode is None:
199
+ from time import sleep
200
+ if (curOS == "WINDOWS"):
201
+ os.system("cls")
202
+ else:
203
+ os.system("clear")
204
+
205
+ print(zip_path.stdout.read())
206
+
207
+ sleep(0.01)
208
+
209
+ print(zip_process.returncode)
210
+
211
+ process = run(['pip', 'install', Path(zip_path).resolve().__str__()])
212
+
213
+ while process.returncode is None:
214
+ from time import sleep
215
+ if (curOS == "WINDOWS"):
216
+ os.system("cls")
217
+ else:
218
+ os.system("clear")
219
+
220
+ print(process.stdout.read())
221
+
222
+ sleep(0.01)
223
+
224
+
225
+ print("Cleaning up!")
226
+
227
+ import shutil
228
+ shutil.rmtree(path + "/Temp_ptgit/") # Remove any git dirs leftover.
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["hatchling >= 1.26"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ dependencies= [
7
+ "gitpython"
8
+ ]
9
+ name="ptgit"
10
+ version="1.0.0"
11
+ authors=[{name="CharGoldenYT", email=""}]
12
+ description="Pip Through Git is a way to install python packages through git."
13
+ readme="README.md"
14
+ requires-python = ">=3.12"
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ license = "GPL-3.0-or-later"
20
+ license-files = ["LICEN[CS]E*"]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/CharGoldenYT/ptgit"
24
+ Issues = "https://github.com/CharGoldenYT/ptgit/issues"
ptgit-1.0.0/readme.md ADDED
@@ -0,0 +1,24 @@
1
+ # Python Packages through git repositories! | PTGit
2
+
3
+ PTGit (Pip through Git) is an alternative pip install method that allows you to install python packages directly through a git repository
4
+
5
+
6
+ ## Adding better compatibility with this tool
7
+
8
+ If you would like the tool to be able to run smoother with YOUR project, simply include a built package with the following structure in your project
9
+
10
+ ```
11
+ Root
12
+ |
13
+ | packaged
14
+ |
15
+ |___ pgit.tar.gz
16
+ |
17
+ |___ pgit_details.whl (optional)
18
+ ```
19
+
20
+ ## Useage
21
+
22
+ `python -m ptgit packagename sourceURL`
23
+
24
+ Installs `packagename` from `sourceURL`