antkit 0.0.1__tar.gz → 0.0.2__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.
- antkit-0.0.2/LICENSE +21 -0
- antkit-0.0.2/PKG-INFO +59 -0
- antkit-0.0.2/README.md +39 -0
- antkit-0.0.2/pyproject.toml +37 -0
- antkit-0.0.2/src/antkit/__init__.py +68 -0
- antkit-0.0.2/src/antkit/py.typed +0 -0
- antkit-0.0.2/tests/test_antkit.py +54 -0
- antkit-0.0.1/MANIFEST.in +0 -1
- antkit-0.0.1/PKG-INFO +0 -59
- antkit-0.0.1/README.md +0 -18
- antkit-0.0.1/antkit/__init__.py +0 -5
- antkit-0.0.1/antkit.egg-info/PKG-INFO +0 -59
- antkit-0.0.1/antkit.egg-info/SOURCES.txt +0 -11
- antkit-0.0.1/antkit.egg-info/dependency_links.txt +0 -1
- antkit-0.0.1/antkit.egg-info/entry_points.txt +0 -2
- antkit-0.0.1/antkit.egg-info/requires.txt +0 -13
- antkit-0.0.1/antkit.egg-info/top_level.txt +0 -1
- antkit-0.0.1/requirements.txt +0 -5
- antkit-0.0.1/setup.cfg +0 -4
- antkit-0.0.1/setup.py +0 -190
antkit-0.0.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lqxnjk
|
|
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.
|
antkit-0.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: antkit
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Cryptographically secure tokens and passwords.
|
|
5
|
+
Project-URL: Homepage, https://github.com/lqxnjk/antkit
|
|
6
|
+
Author: lqxnjk
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: password,random,secrets,security,token
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# antkit
|
|
22
|
+
|
|
23
|
+
Generate tokens and passwords with `secrets` — never with `random`.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```console
|
|
28
|
+
pip install antkit
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from antkit import password, token
|
|
35
|
+
|
|
36
|
+
token() # 22-char URL-safe string, 16 bytes of entropy
|
|
37
|
+
token(m_bytes=32) # longer
|
|
38
|
+
token(n_urlsafe=False) # hex instead
|
|
39
|
+
|
|
40
|
+
password() # 16 chars, all four classes
|
|
41
|
+
password(24, n_symbols=False)
|
|
42
|
+
password(12, n_lower=False, n_upper=False) # digits + symbols only
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Guarantees
|
|
46
|
+
|
|
47
|
+
| Function | Guarantee |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| `token` | `secrets`-backed, URL-safe by default |
|
|
50
|
+
| `password` | at least one character from every enabled class |
|
|
51
|
+
| `password` | order shuffled, guaranteed chars are not prefix-stuck |
|
|
52
|
+
| both | `ValueError` on impossible requests |
|
|
53
|
+
|
|
54
|
+
`random` is not used anywhere: it is seeded predictably and is the wrong tool
|
|
55
|
+
for anything a user must not guess.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
antkit-0.0.2/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# antkit
|
|
2
|
+
|
|
3
|
+
Generate tokens and passwords with `secrets` — never with `random`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```console
|
|
8
|
+
pip install antkit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from antkit import password, token
|
|
15
|
+
|
|
16
|
+
token() # 22-char URL-safe string, 16 bytes of entropy
|
|
17
|
+
token(m_bytes=32) # longer
|
|
18
|
+
token(n_urlsafe=False) # hex instead
|
|
19
|
+
|
|
20
|
+
password() # 16 chars, all four classes
|
|
21
|
+
password(24, n_symbols=False)
|
|
22
|
+
password(12, n_lower=False, n_upper=False) # digits + symbols only
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Guarantees
|
|
26
|
+
|
|
27
|
+
| Function | Guarantee |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `token` | `secrets`-backed, URL-safe by default |
|
|
30
|
+
| `password` | at least one character from every enabled class |
|
|
31
|
+
| `password` | order shuffled, guaranteed chars are not prefix-stuck |
|
|
32
|
+
| both | `ValueError` on impossible requests |
|
|
33
|
+
|
|
34
|
+
`random` is not used anywhere: it is seeded predictably and is the wrong tool
|
|
35
|
+
for anything a user must not guess.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
MIT
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "antkit"
|
|
7
|
+
version = "0.0.2"
|
|
8
|
+
description = "Cryptographically secure tokens and passwords."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "lqxnjk" }]
|
|
13
|
+
keywords = ["token", "password", "secrets", "random", "security"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
dependencies = []
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/lqxnjk/antkit"
|
|
28
|
+
|
|
29
|
+
[tool.pytest.ini_options]
|
|
30
|
+
pythonpath = ["src"]
|
|
31
|
+
testpaths = ["tests"]
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.wheel]
|
|
34
|
+
packages = ["src/antkit"]
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.targets.sdist]
|
|
37
|
+
include = ["src/antkit", "tests", "README.md", "LICENSE"]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: lqxnjk <lqxnjk@qq.com>
|
|
3
|
+
Created: 2026-10-23 10:25
|
|
4
|
+
Modified: 2026-10-23 10:25
|
|
5
|
+
Python Version: 3.10
|
|
6
|
+
Secure random tokens and passwords.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import secrets
|
|
12
|
+
import string
|
|
13
|
+
|
|
14
|
+
__all__ = ["token", "password"]
|
|
15
|
+
|
|
16
|
+
_LOWER = string.ascii_lowercase
|
|
17
|
+
_UPPER = string.ascii_uppercase
|
|
18
|
+
_DIGITS = string.digits
|
|
19
|
+
_SYMBOLS = "!@#$%^&*()-_=+[]{};:,.?"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def token(m_bytes: int = 16, n_urlsafe: bool = True) -> str:
|
|
23
|
+
"""Return a URL-safe token carrying ``m_bytes`` of entropy.
|
|
24
|
+
|
|
25
|
+
Built on :mod:`secrets`, so it is suitable for session IDs, API keys and
|
|
26
|
+
reset links. Length is longer than ``m_bytes`` because base64 expands.
|
|
27
|
+
"""
|
|
28
|
+
if m_bytes < 1:
|
|
29
|
+
raise ValueError(f"m_bytes must be >= 1, got {m_bytes}")
|
|
30
|
+
if n_urlsafe:
|
|
31
|
+
return secrets.token_urlsafe(m_bytes)
|
|
32
|
+
return secrets.token_hex(m_bytes)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def password(
|
|
36
|
+
m_length: int = 16,
|
|
37
|
+
n_lower: bool = True,
|
|
38
|
+
n_upper: bool = True,
|
|
39
|
+
n_digits: bool = True,
|
|
40
|
+
n_symbols: bool = True,
|
|
41
|
+
) -> str:
|
|
42
|
+
"""Return a random password that is guaranteed to use every enabled class.
|
|
43
|
+
|
|
44
|
+
At least one character from each enabled class is always present, then the
|
|
45
|
+
result is shuffled with :func:`secrets.randbelow` so the guaranteed
|
|
46
|
+
characters are not stuck at the front.
|
|
47
|
+
"""
|
|
48
|
+
pools: list[str] = []
|
|
49
|
+
if n_lower:
|
|
50
|
+
pools.append(_LOWER)
|
|
51
|
+
if n_upper:
|
|
52
|
+
pools.append(_UPPER)
|
|
53
|
+
if n_digits:
|
|
54
|
+
pools.append(_DIGITS)
|
|
55
|
+
if n_symbols:
|
|
56
|
+
pools.append(_SYMBOLS)
|
|
57
|
+
if not pools:
|
|
58
|
+
raise ValueError("at least one character class must be enabled")
|
|
59
|
+
if m_length < len(pools):
|
|
60
|
+
raise ValueError(f"m_length must be >= {len(pools)} for {len(pools)} class(es)")
|
|
61
|
+
|
|
62
|
+
alphabet = "".join(pools)
|
|
63
|
+
chars = [secrets.choice(pool) for pool in pools]
|
|
64
|
+
chars.extend(secrets.choice(alphabet) for _ in range(m_length - len(chars)))
|
|
65
|
+
for index in range(len(chars) - 1, 0, -1):
|
|
66
|
+
swap = secrets.randbelow(index + 1)
|
|
67
|
+
chars[index], chars[swap] = chars[swap], chars[index]
|
|
68
|
+
return "".join(chars)
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: lqxnjk <lqxnjk@qq.com>
|
|
3
|
+
Created: 2026-10-23 10:25
|
|
4
|
+
Modified: 2026-10-23 10:25
|
|
5
|
+
Python Version: 3.10
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import string
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
|
|
12
|
+
from antkit import password, token
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_token_length_and_charset() -> None:
|
|
16
|
+
value = token(16)
|
|
17
|
+
assert len(value) >= 16
|
|
18
|
+
assert all(char in string.ascii_letters + string.digits + "-_" for char in value)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_token_uniqueness() -> None:
|
|
22
|
+
assert len({token() for _ in range(200)}) == 200
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_token_hex() -> None:
|
|
26
|
+
value = token(8, n_urlsafe=False)
|
|
27
|
+
assert len(value) == 16
|
|
28
|
+
int(value, 16)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_password_uses_all_classes() -> None:
|
|
32
|
+
value = password(16)
|
|
33
|
+
assert any(char in string.ascii_lowercase for char in value)
|
|
34
|
+
assert any(char in string.ascii_uppercase for char in value)
|
|
35
|
+
assert any(char in string.digits for char in value)
|
|
36
|
+
assert any(not char.isalnum() for char in value)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_password_respects_disabled_classes() -> None:
|
|
40
|
+
value = password(12, n_symbols=False)
|
|
41
|
+
assert value.isalnum()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_password_length() -> None:
|
|
45
|
+
assert len(password(24)) == 24
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_impossible_requests() -> None:
|
|
49
|
+
with pytest.raises(ValueError):
|
|
50
|
+
password(4, n_lower=False, n_upper=False, n_digits=False, n_symbols=False)
|
|
51
|
+
with pytest.raises(ValueError):
|
|
52
|
+
password(1)
|
|
53
|
+
with pytest.raises(ValueError):
|
|
54
|
+
token(0)
|
antkit-0.0.1/MANIFEST.in
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
include requirements.txt
|
antkit-0.0.1/PKG-INFO
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: antkit
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: A Python package for intelligent information bagging system
|
|
5
|
-
Home-page: https://github.com/lqxnjk/antkit
|
|
6
|
-
Author: lqxnjk
|
|
7
|
-
Author-email: lqxnjk@qq.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Project-URL: Bug Reports, https://github.com/lqxnjk/antkit/issues
|
|
10
|
-
Project-URL: Source, https://github.com/lqxnjk/antkit
|
|
11
|
-
Keywords: ii,etls,lqxnjk,data
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Intended Audience :: Science/Research
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
-
Classifier: Operating System :: OS Independent
|
|
18
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
-
Classifier: Topic :: Scientific/Engineering
|
|
20
|
-
Requires-Python: >=3.7
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: typing-extensions; python_version < "3.8"
|
|
23
|
-
Provides-Extra: dev
|
|
24
|
-
Provides-Extra: plot
|
|
25
|
-
Provides-Extra: gpu
|
|
26
|
-
Provides-Extra: all
|
|
27
|
-
Requires-Dist: antkit[dev]; extra == "all"
|
|
28
|
-
Requires-Dist: antkit[plot]; extra == "all"
|
|
29
|
-
Dynamic: author
|
|
30
|
-
Dynamic: author-email
|
|
31
|
-
Dynamic: classifier
|
|
32
|
-
Dynamic: description
|
|
33
|
-
Dynamic: description-content-type
|
|
34
|
-
Dynamic: home-page
|
|
35
|
-
Dynamic: keywords
|
|
36
|
-
Dynamic: license
|
|
37
|
-
Dynamic: project-url
|
|
38
|
-
Dynamic: provides-extra
|
|
39
|
-
Dynamic: requires-python
|
|
40
|
-
Dynamic: summary
|
|
41
|
-
|
|
42
|
-
## 构建依赖包
|
|
43
|
-
|
|
44
|
-
```基础命令
|
|
45
|
-
python -m pip install twine -i https://mirrors.tencent.com/pypi/simple
|
|
46
|
-
pip install wheel setuptools -i https://mirrors.tencent.com/pypi/simple
|
|
47
|
-
python setup.py sdist bdist_wheel
|
|
48
|
-
python -m build
|
|
49
|
-
pip install .
|
|
50
|
-
pip install -e .
|
|
51
|
-
pip install -e .[dev]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
```shell 构建命令
|
|
55
|
-
#rm -rf './dist'
|
|
56
|
-
#python -m build
|
|
57
|
-
python setup.py sdist bdist_wheel
|
|
58
|
-
python -m twine upload dist/*
|
|
59
|
-
```
|
antkit-0.0.1/README.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
## 构建依赖包
|
|
2
|
-
|
|
3
|
-
```基础命令
|
|
4
|
-
python -m pip install twine -i https://mirrors.tencent.com/pypi/simple
|
|
5
|
-
pip install wheel setuptools -i https://mirrors.tencent.com/pypi/simple
|
|
6
|
-
python setup.py sdist bdist_wheel
|
|
7
|
-
python -m build
|
|
8
|
-
pip install .
|
|
9
|
-
pip install -e .
|
|
10
|
-
pip install -e .[dev]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
```shell 构建命令
|
|
14
|
-
#rm -rf './dist'
|
|
15
|
-
#python -m build
|
|
16
|
-
python setup.py sdist bdist_wheel
|
|
17
|
-
python -m twine upload dist/*
|
|
18
|
-
```
|
antkit-0.0.1/antkit/__init__.py
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: antkit
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: A Python package for intelligent information bagging system
|
|
5
|
-
Home-page: https://github.com/lqxnjk/antkit
|
|
6
|
-
Author: lqxnjk
|
|
7
|
-
Author-email: lqxnjk@qq.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Project-URL: Bug Reports, https://github.com/lqxnjk/antkit/issues
|
|
10
|
-
Project-URL: Source, https://github.com/lqxnjk/antkit
|
|
11
|
-
Keywords: ii,etls,lqxnjk,data
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Intended Audience :: Science/Research
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
-
Classifier: Operating System :: OS Independent
|
|
18
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
-
Classifier: Topic :: Scientific/Engineering
|
|
20
|
-
Requires-Python: >=3.7
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: typing-extensions; python_version < "3.8"
|
|
23
|
-
Provides-Extra: dev
|
|
24
|
-
Provides-Extra: plot
|
|
25
|
-
Provides-Extra: gpu
|
|
26
|
-
Provides-Extra: all
|
|
27
|
-
Requires-Dist: antkit[dev]; extra == "all"
|
|
28
|
-
Requires-Dist: antkit[plot]; extra == "all"
|
|
29
|
-
Dynamic: author
|
|
30
|
-
Dynamic: author-email
|
|
31
|
-
Dynamic: classifier
|
|
32
|
-
Dynamic: description
|
|
33
|
-
Dynamic: description-content-type
|
|
34
|
-
Dynamic: home-page
|
|
35
|
-
Dynamic: keywords
|
|
36
|
-
Dynamic: license
|
|
37
|
-
Dynamic: project-url
|
|
38
|
-
Dynamic: provides-extra
|
|
39
|
-
Dynamic: requires-python
|
|
40
|
-
Dynamic: summary
|
|
41
|
-
|
|
42
|
-
## 构建依赖包
|
|
43
|
-
|
|
44
|
-
```基础命令
|
|
45
|
-
python -m pip install twine -i https://mirrors.tencent.com/pypi/simple
|
|
46
|
-
pip install wheel setuptools -i https://mirrors.tencent.com/pypi/simple
|
|
47
|
-
python setup.py sdist bdist_wheel
|
|
48
|
-
python -m build
|
|
49
|
-
pip install .
|
|
50
|
-
pip install -e .
|
|
51
|
-
pip install -e .[dev]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
```shell 构建命令
|
|
55
|
-
#rm -rf './dist'
|
|
56
|
-
#python -m build
|
|
57
|
-
python setup.py sdist bdist_wheel
|
|
58
|
-
python -m twine upload dist/*
|
|
59
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
MANIFEST.in
|
|
2
|
-
README.md
|
|
3
|
-
requirements.txt
|
|
4
|
-
setup.py
|
|
5
|
-
antkit/__init__.py
|
|
6
|
-
antkit.egg-info/PKG-INFO
|
|
7
|
-
antkit.egg-info/SOURCES.txt
|
|
8
|
-
antkit.egg-info/dependency_links.txt
|
|
9
|
-
antkit.egg-info/entry_points.txt
|
|
10
|
-
antkit.egg-info/requires.txt
|
|
11
|
-
antkit.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
antkit
|
antkit-0.0.1/requirements.txt
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
--extra-index-url https://mirrors.tencent.com/pypi/simple
|
|
2
|
-
# python 3.7.9
|
|
3
|
-
# pip install -r ./requirements.txt -i https://mirrors.tencent.com/pypi/simple
|
|
4
|
-
# --default-timeout=100
|
|
5
|
-
#------------------------------------------------------------------------------------------------------------
|
antkit-0.0.1/setup.cfg
DELETED
antkit-0.0.1/setup.py
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import os.path
|
|
2
|
-
|
|
3
|
-
from setuptools import setup, find_packages
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
import re
|
|
6
|
-
|
|
7
|
-
# ========== Configuration Variables ==========
|
|
8
|
-
# Basic package info
|
|
9
|
-
ROOT_DIR = Path(__file__).absolute().parent
|
|
10
|
-
PACKAGE_NAME = Path(__file__).absolute().parent.name.split("_")[-1].split("-")[-1]
|
|
11
|
-
|
|
12
|
-
AUTHOR = "lqxnjk"
|
|
13
|
-
AUTHOR_EMAIL = "lqxnjk@qq.com"
|
|
14
|
-
DESCRIPTION = "A Python package for intelligent information bagging system"
|
|
15
|
-
LICENSE = "MIT"
|
|
16
|
-
PYTHON_REQUIRES = ">=3.7"
|
|
17
|
-
URL = f"https://github.com/lqxnjk/{PACKAGE_NAME}"
|
|
18
|
-
PROJECT_URLS = {
|
|
19
|
-
'Bug Reports': f'{URL}/issues',
|
|
20
|
-
'Source': URL,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# Package discovery
|
|
24
|
-
PACKAGE_EXCLUDES = ['tests*', 'docs*', 'examples*']
|
|
25
|
-
|
|
26
|
-
# Classifiers
|
|
27
|
-
CLASSIFIERS = [
|
|
28
|
-
"Development Status :: 3 - Alpha",
|
|
29
|
-
"Intended Audience :: Developers",
|
|
30
|
-
"Intended Audience :: Science/Research",
|
|
31
|
-
"Programming Language :: Python :: 3.7",
|
|
32
|
-
"License :: OSI Approved :: MIT License",
|
|
33
|
-
"Operating System :: OS Independent",
|
|
34
|
-
"Topic :: Software Development :: Libraries",
|
|
35
|
-
"Topic :: Scientific/Engineering",
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
# Keywords
|
|
39
|
-
KEYWORDS = ["ii", "etls", "lqxnjk", "data"]
|
|
40
|
-
|
|
41
|
-
# Package data
|
|
42
|
-
PACKAGE_DATA = {
|
|
43
|
-
PACKAGE_NAME: ['data/*.json', 'data/*.csv'],
|
|
44
|
-
}
|
|
45
|
-
# Entry points
|
|
46
|
-
ENTRY_POINTS = {
|
|
47
|
-
'hello': [
|
|
48
|
-
f'{PACKAGE_NAME}_version = {PACKAGE_NAME}.__init__:version',
|
|
49
|
-
],
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# ========== Dynamic Value Functions ==========
|
|
54
|
-
def get_long_description():
|
|
55
|
-
"""Read README.md content as long description."""
|
|
56
|
-
with open('README.md', 'r', encoding='utf-8') as f:
|
|
57
|
-
return f.read()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def get_version():
|
|
61
|
-
"""Read version from package __init__.py file."""
|
|
62
|
-
init_file = f"./{PACKAGE_NAME}/__init__.py"
|
|
63
|
-
if not os.path.exists(init_file):
|
|
64
|
-
init_file = f"./demo/__init__.py"
|
|
65
|
-
with open(init_file, 'r', encoding='utf-8') as f:
|
|
66
|
-
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M)
|
|
67
|
-
if version_match:
|
|
68
|
-
return version_match.group(1)
|
|
69
|
-
raise RuntimeError("Unable to find version string.")
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def get_requirements():
|
|
73
|
-
"""Read requirements from requirements.txt."""
|
|
74
|
-
with open(ROOT_DIR / 'requirements.txt', 'r', encoding='utf-8') as f:
|
|
75
|
-
return [
|
|
76
|
-
line.strip() for line in f
|
|
77
|
-
if line.strip()
|
|
78
|
-
and not line.startswith('#')
|
|
79
|
-
and not line.startswith('--')
|
|
80
|
-
]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
REQUIREMENTS = get_requirements()
|
|
84
|
-
|
|
85
|
-
# Optional dependencies
|
|
86
|
-
EXTRAS_REQUIRE = {
|
|
87
|
-
':python_version < "3.8"': ['typing-extensions'],
|
|
88
|
-
'dev': [
|
|
89
|
-
# 'pytest>=6.0',
|
|
90
|
-
# 'pytest-cov>=2.0',
|
|
91
|
-
# 'flake8>=3.9',
|
|
92
|
-
# 'mypy>=0.910',
|
|
93
|
-
# 'sphinx>=4.0',
|
|
94
|
-
],
|
|
95
|
-
'plot': [
|
|
96
|
-
# 'matplotlib>=3.0',
|
|
97
|
-
# 'seaborn>=0.11',
|
|
98
|
-
],
|
|
99
|
-
'gpu': [
|
|
100
|
-
# 'cupy>=10.0'
|
|
101
|
-
],
|
|
102
|
-
'all': [f'{PACKAGE_NAME}[dev]', f'{PACKAGE_NAME}[plot]']
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
# ========== Setup Configuration ==========
|
|
106
|
-
setup(
|
|
107
|
-
name=PACKAGE_NAME,
|
|
108
|
-
version=get_version(),
|
|
109
|
-
packages=find_packages(exclude=PACKAGE_EXCLUDES),
|
|
110
|
-
install_requires=REQUIREMENTS,
|
|
111
|
-
extras_require=EXTRAS_REQUIRE,
|
|
112
|
-
include_package_data=True,
|
|
113
|
-
package_data=PACKAGE_DATA,
|
|
114
|
-
author=AUTHOR,
|
|
115
|
-
author_email=AUTHOR_EMAIL,
|
|
116
|
-
description=DESCRIPTION,
|
|
117
|
-
long_description=get_long_description(),
|
|
118
|
-
long_description_content_type='text/markdown',
|
|
119
|
-
url=URL,
|
|
120
|
-
project_urls=PROJECT_URLS,
|
|
121
|
-
classifiers=CLASSIFIERS,
|
|
122
|
-
python_requires=PYTHON_REQUIRES,
|
|
123
|
-
entry_points=ENTRY_POINTS,
|
|
124
|
-
license=LICENSE,
|
|
125
|
-
keywords=KEYWORDS,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
# ========== Pyproject.toml Generation ==========
|
|
130
|
-
def generate_pyproject_toml():
|
|
131
|
-
"""Generate pyproject.toml from extracted variables."""
|
|
132
|
-
# Format project URLs for TOML
|
|
133
|
-
urls_toml = "\n".join(
|
|
134
|
-
f'{key.replace(" ", "-").lower()} = "{value}"'
|
|
135
|
-
for key, value in PROJECT_URLS.items()
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
# Format extras_require for TOML
|
|
139
|
-
extras_toml = []
|
|
140
|
-
for key, deps in EXTRAS_REQUIRE.items():
|
|
141
|
-
if key.startswith(':python_version'):
|
|
142
|
-
# Handle conditional dependencies
|
|
143
|
-
condition = key.split('"')[1]
|
|
144
|
-
extras_toml.append(
|
|
145
|
-
f'python_version_lt_{condition.replace(".", "_")} = {deps}'
|
|
146
|
-
)
|
|
147
|
-
else:
|
|
148
|
-
extras_toml.append(f'{key} = {deps}')
|
|
149
|
-
extras_toml_str = "\n".join(extras_toml)
|
|
150
|
-
PACKAGE_DATA_STR = "{" + ",\n".join([f'"{k}" = {v}' for k, v in PACKAGE_DATA.items()]) + "}"
|
|
151
|
-
pyproject_content = f"""[build-system]
|
|
152
|
-
requires = ["setuptools>=42", "wheel"]
|
|
153
|
-
build-backend = "setuptools.build_meta"
|
|
154
|
-
|
|
155
|
-
[project]
|
|
156
|
-
name = "{PACKAGE_NAME}"
|
|
157
|
-
version = "{get_version()}"
|
|
158
|
-
description = "{DESCRIPTION}"
|
|
159
|
-
readme = "README.md"
|
|
160
|
-
requires-python = "{PYTHON_REQUIRES}"
|
|
161
|
-
authors = [
|
|
162
|
-
{{ name = "{AUTHOR}", email = "{AUTHOR_EMAIL}" }},
|
|
163
|
-
]
|
|
164
|
-
license = {{ text = "{LICENSE}" }}
|
|
165
|
-
keywords = {KEYWORDS}
|
|
166
|
-
classifiers = {CLASSIFIERS}
|
|
167
|
-
dependencies = {REQUIREMENTS}
|
|
168
|
-
|
|
169
|
-
[project.urls]
|
|
170
|
-
homepage = "{URL}"
|
|
171
|
-
{urls_toml}
|
|
172
|
-
|
|
173
|
-
[project.optional-dependencies]
|
|
174
|
-
{extras_toml_str}
|
|
175
|
-
|
|
176
|
-
[tool.setuptools]
|
|
177
|
-
packages = {find_packages(exclude=PACKAGE_EXCLUDES)}
|
|
178
|
-
package-data = {PACKAGE_DATA_STR}
|
|
179
|
-
include-package-data = true
|
|
180
|
-
|
|
181
|
-
[tool.setuptools.dynamic]
|
|
182
|
-
version = {{ attr = "{PACKAGE_NAME}.__version__" }}
|
|
183
|
-
readme = {{ file = ["README.md"] }}
|
|
184
|
-
"""
|
|
185
|
-
|
|
186
|
-
with open("pyproject.toml", "w", encoding="utf-8") as f:
|
|
187
|
-
f.write(pyproject_content)
|
|
188
|
-
print("pyproject.toml generated successfully!")
|
|
189
|
-
|
|
190
|
-
# generate_pyproject_toml()
|