| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: giturlparse |
| 3 |
Version: 0.12.0 |
| 4 |
Summary: A Git URL parsing module (supports parsing and rewriting) |
| 5 |
Home-page: https://github.com/nephila/giturlparse |
| 6 |
Author: Aaron O Mullan |
| 7 |
Author-email: [email protected] |
| 8 |
Maintainer: Iacopo Spalletti |
| 9 |
Maintainer-email: [email protected] |
| 10 |
License: Apache v2 |
| 11 |
Keywords: giturlparse |
| 12 |
Classifier: Development Status :: 5 - Production/Stable |
| 13 |
Classifier: Framework :: Django |
| 14 |
Classifier: Intended Audience :: Developers |
| 15 |
Classifier: License :: OSI Approved :: Apache Software License |
| 16 |
Classifier: Natural Language :: English |
| 17 |
Classifier: Programming Language :: Python :: 3.8 |
| 18 |
Classifier: Programming Language :: Python :: 3.9 |
| 19 |
Classifier: Programming Language :: Python :: 3.10 |
| 20 |
Classifier: Programming Language :: Python :: 3.11 |
| 21 |
Requires-Python: >=3.8 |
| 22 |
Description-Content-Type: text/x-rst |
| 23 |
License-File: LICENSE |
| 24 |
|
| 25 |
=========== |
| 26 |
giturlparse |
| 27 |
=========== |
| 28 |
|
| 29 |
Parse & rewrite git urls (supports GitHub, Bitbucket, FriendCode, Assembla, Gitlab ...) |
| 30 |
|
| 31 |
This is a fork of giturlparse.py with updated parsers. |
| 32 |
|
| 33 |
Original project can be found at https://github.com/FriendCode/giturlparse.py |
| 34 |
|
| 35 |
************ |
| 36 |
Installing |
| 37 |
************ |
| 38 |
|
| 39 |
:: |
| 40 |
|
| 41 |
pip install giturlparse |
| 42 |
|
| 43 |
****************** |
| 44 |
Examples |
| 45 |
****************** |
| 46 |
|
| 47 |
Exposed attributes |
| 48 |
================== |
| 49 |
|
| 50 |
* ``platform``: platform codename |
| 51 |
* ``host``: server hostname |
| 52 |
* ``resource``: same as ``host`` |
| 53 |
* ``port``: URL port (only if explicitly defined in URL) |
| 54 |
* ``protocol``: URL protocol (git, ssh, http/https) |
| 55 |
* ``protocols``: list of protocols explicitly defined in URL |
| 56 |
* ``user``: repository user |
| 57 |
* ``owner``: repository owner (user or organization) |
| 58 |
* ``repo``: repository name |
| 59 |
* ``name``: same as ``repo`` |
| 60 |
* ``groups``: list of groups - gitlab only |
| 61 |
* ``path``: path to file or directory (includes the branch name) - gitlab / github only |
| 62 |
* ``path_raw``: raw path starting from the repo name (might include platform keyword) - gitlab / github only |
| 63 |
* ``branch``: branch name (when parseable) - gitlab / github only |
| 64 |
* ``username``: username from ``<username>:<access_token>@<url>`` gitlab / github urls |
| 65 |
* ``access_token``: access token from ``<username>:<access_token>@<url>`` gitlab / github urls |
| 66 |
|
| 67 |
Parse |
| 68 |
================== |
| 69 |
|
| 70 |
:: |
| 71 |
|
| 72 |
from giturlparse import parse |
| 73 |
|
| 74 |
p = parse('[email protected]:AaronO/some-repo.git') |
| 75 |
|
| 76 |
p.host, p.owner, p.repo |
| 77 |
|
| 78 |
# => ('bitbucket.org', 'AaronO', 'some-repo') |
| 79 |
|
| 80 |
|
| 81 |
Rewrite |
| 82 |
================== |
| 83 |
|
| 84 |
:: |
| 85 |
|
| 86 |
from giturlparse import parse |
| 87 |
|
| 88 |
url = '[email protected]:Org/Private-repo.git' |
| 89 |
|
| 90 |
p = parse(url) |
| 91 |
|
| 92 |
p.url2ssh, p.url2https, p.url2git, p.url2http |
| 93 |
# => ('[email protected]:Org/Private-repo.git', 'https://github.com/Org/Private-repo.git', 'git://github.com/Org/Private-repo.git', None) |
| 94 |
|
| 95 |
URLS |
| 96 |
================== |
| 97 |
|
| 98 |
Alternative URLs for same repo:: |
| 99 |
|
| 100 |
from giturlparse import parse |
| 101 |
|
| 102 |
url = '[email protected]:Org/Private-repo.git' |
| 103 |
|
| 104 |
parse(url).urls |
| 105 |
# => { |
| 106 |
# 'ssh': '[email protected]:Org/Private-repo.git', |
| 107 |
# 'https': 'https://github.com/Org/Private-repo.git', |
| 108 |
# 'git': 'git://github.com/Org/Private-repo.git' |
| 109 |
# } |
| 110 |
|
| 111 |
Validate |
| 112 |
================== |
| 113 |
|
| 114 |
:: |
| 115 |
|
| 116 |
from giturlparse import parse, validate |
| 117 |
|
| 118 |
url = '[email protected]:Org/Private-repo.git' |
| 119 |
|
| 120 |
parse(url).valid |
| 121 |
# => True |
| 122 |
|
| 123 |
# Or |
| 124 |
|
| 125 |
validate(url) |
| 126 |
# => True |
| 127 |
|
| 128 |
Tests |
| 129 |
================== |
| 130 |
|
| 131 |
:: |
| 132 |
|
| 133 |
python -munittest |
| 134 |
|
| 135 |
License |
| 136 |
================== |
| 137 |
|
| 138 |
Apache v2 (Check out LICENSE file) |
| 139 |
|
| 140 |
.. :changelog: |
| 141 |
|
| 142 |
******* |
| 143 |
History |
| 144 |
******* |
| 145 |
|
| 146 |
.. towncrier release notes start |
| 147 |
|
| 148 |
0.12.0 (2023-09-24) |
| 149 |
=================== |
| 150 |
|
| 151 |
Features |
| 152 |
-------- |
| 153 |
|
| 154 |
- Add github/gitlab username:access_token parse support (#21) |
| 155 |
- Migrate to bump-my-version (#79) |
| 156 |
|
| 157 |
|
| 158 |
Bugfixes |
| 159 |
-------- |
| 160 |
|
| 161 |
- Fix Gitlab URLs with branch (#42) |
| 162 |
- Align tox.ini with github actions (#71) |
| 163 |
|
| 164 |
|
| 165 |
0.11.1 (2023-08-04) |
| 166 |
=================== |
| 167 |
|
| 168 |
Bugfixes |
| 169 |
-------- |
| 170 |
|
| 171 |
- Remove debug print statements (#66) |
| 172 |
|
| 173 |
|
| 174 |
0.11.0 (2023-08-03) |
| 175 |
=================== |
| 176 |
|
| 177 |
Features |
| 178 |
-------- |
| 179 |
|
| 180 |
- Add parsing variable for user to gitlab parser (#47) |
| 181 |
- Add support for Python 3.8+ (#48) |
| 182 |
|
| 183 |
|
| 184 |
Bugfixes |
| 185 |
-------- |
| 186 |
|
| 187 |
- Update tests invocation method to avoid future breakages (#29) |
| 188 |
- Update linting tools and fix code style (#34) |
| 189 |
- Add more github use cases (#43) |
| 190 |
- Fix parsing generic git url (#46) |
| 191 |
|
| 192 |
|
| 193 |
0.10.0 (2020-12-05) |
| 194 |
=================== |
| 195 |
|
| 196 |
Features |
| 197 |
-------- |
| 198 |
|
| 199 |
- General matching improvements (#18) |
| 200 |
- Update tooling, drop python2 (#10213) |
| 201 |
|
| 202 |
0.9.2 (2018-10-27) |
| 203 |
================== |
| 204 |
|
| 205 |
* Removed "s" from the base platform regex |
| 206 |
* Fix license classifier in setup.py |
| 207 |
* Update meta files |
| 208 |
|
| 209 |
0.9.1 (2018-01-20) |
| 210 |
================== |
| 211 |
|
| 212 |
* First fork release |