reserver 0.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.
- reserver-0.0.0/AUTHORS.md +11 -0
- reserver-0.0.0/LICENSE +21 -0
- reserver-0.0.0/PKG-INFO +27 -0
- reserver-0.0.0/README.md +117 -0
- reserver-0.0.0/reserver/__init__.py +6 -0
- reserver-0.0.0/reserver/reserver_func.py +93 -0
- reserver-0.0.0/reserver/reserver_obj.py +95 -0
- reserver-0.0.0/reserver/reserver_param.py +7 -0
- reserver-0.0.0/reserver.egg-info/PKG-INFO +27 -0
- reserver-0.0.0/reserver.egg-info/SOURCES.txt +14 -0
- reserver-0.0.0/reserver.egg-info/dependency_links.txt +1 -0
- reserver-0.0.0/reserver.egg-info/top_level.txt +1 -0
- reserver-0.0.0/reserver_setup.py +45 -0
- reserver-0.0.0/setup.cfg +4 -0
- reserver-0.0.0/setup.py +69 -0
- reserver-0.0.0/tests/test_reserver.py +34 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Authors #
|
|
2
|
+
|
|
3
|
+
----------
|
|
4
|
+
- AmirHosein Rostami - Open Science Laboratory ([Github](https://github.com/AHReccese)) **
|
|
5
|
+
- Sepand Haghighi - Open Science Laboratory ([Github](https://github.com/sepandhaghighi))
|
|
6
|
+
|
|
7
|
+
** **Maintainer**
|
|
8
|
+
|
|
9
|
+
# Other Contributors #
|
|
10
|
+
----------
|
|
11
|
+
|
reserver-0.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OpenSciLab
|
|
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.
|
reserver-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: reserver
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: This name has been reserved using Reserver
|
|
5
|
+
Home-page: https://url.com
|
|
6
|
+
Download-URL: https://download_url.com
|
|
7
|
+
Author: Development Team
|
|
8
|
+
Author-email: test@test.com
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Source, https://github.com/source
|
|
11
|
+
Keywords: python3 python reserve reserver reserved
|
|
12
|
+
Classifier: Development Status :: 1 - Planning
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.6
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: AUTHORS.md
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
This name has been reserved using [Reserver](https://github.com/openscilab/reserver).
|
|
27
|
+
|
reserver-0.0.0/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://github.com/openscilab/reserver/raw/main/otherfiles/logo.png" width="300" height="300">
|
|
3
|
+
<br/>
|
|
4
|
+
<br/>
|
|
5
|
+
<a href="https://codecov.io/gh/openscilab/reserver">
|
|
6
|
+
<img src="https://codecov.io/gh/openscilab/reserver/branch/main/graph/badge.svg" alt="Codecov"/>
|
|
7
|
+
</a>
|
|
8
|
+
<a href="TODO">
|
|
9
|
+
<img src="TODO" alt="PyPI version" height="18">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.python.org/">
|
|
12
|
+
<img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://discord.gg/RD2y6SGuY3">
|
|
15
|
+
<img src="https://img.shields.io/discord/1064533716615049236.svg" alt="Discord Channel">
|
|
16
|
+
</a>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
----------
|
|
20
|
+
|
|
21
|
+
## Table of contents
|
|
22
|
+
|
|
23
|
+
* [Overview](https://github.com/openscilab/reserver#overview)
|
|
24
|
+
* [Installation](https://github.com/openscilab/reserver#installation)
|
|
25
|
+
* [Usage](https://github.com/openscilab/reserver#usage)
|
|
26
|
+
* [Issues & Bug Reports](https://github.com/openscilab/reserver#issues--bug-reports)
|
|
27
|
+
* [Todo](https://github.com/openscilab/reserver/blob/main/TODO.md)
|
|
28
|
+
* [Contribution](https://github.com/openscilab/reserver/blob/main/.github/CONTRIBUTING.md)
|
|
29
|
+
* [Authors](https://github.com/openscilab/reserver/blob/main/AUTHORS.md)
|
|
30
|
+
* [License](https://github.com/openscilab/reserver/blob/main/LICENSE)
|
|
31
|
+
* [Show Your Support](https://github.com/openscilab/reserver#show-your-support)
|
|
32
|
+
* [Changelog](https://github.com/openscilab/reserver/blob/main/CHANGELOG.md)
|
|
33
|
+
* [Code of Conduct](https://github.com/openscilab/reserver/blob/main/.github/CODE_OF_CONDUCT.md)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
<p align="justify">
|
|
38
|
+
Reserver is an open source Python package that provides functionality to easily reserve a pypi package name. Have an idea? Reserve the package name instantly before it gets taken!
|
|
39
|
+
</p>
|
|
40
|
+
<table>
|
|
41
|
+
<tr>
|
|
42
|
+
<td align="center">PyPI Counter</td>
|
|
43
|
+
<td align="center">
|
|
44
|
+
<a href="http://pepy.tech/project/reserver">
|
|
45
|
+
<img src="http://pepy.tech/badge/reserver">
|
|
46
|
+
</a>
|
|
47
|
+
</td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<td align="center">Github Stars</td>
|
|
51
|
+
<td align="center">
|
|
52
|
+
<a href="https://github.com/openscilab/reserver">
|
|
53
|
+
<img src="https://img.shields.io/github/stars/openscilab/reserver.svg?style=social&label=Stars">
|
|
54
|
+
</a>
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
</table>
|
|
58
|
+
<table>
|
|
59
|
+
<tr>
|
|
60
|
+
<td align="center">Branch</td>
|
|
61
|
+
<td align="center">main</td>
|
|
62
|
+
<td align="center">dev</td>
|
|
63
|
+
</tr>
|
|
64
|
+
<tr>
|
|
65
|
+
<td align="center">CI</td>
|
|
66
|
+
<td align="center">
|
|
67
|
+
<img src="https://github.com/openscilab/reserver/workflows/CI/badge.svg?branch=main">
|
|
68
|
+
</td>
|
|
69
|
+
<td align="center">
|
|
70
|
+
<img src="https://github.com/openscilab/reserver/workflows/CI/badge.svg?branch=dev">
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
### PyPI
|
|
79
|
+
|
|
80
|
+
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
81
|
+
- Run `pip install reserver==0.1`
|
|
82
|
+
### Source code
|
|
83
|
+
- Download [Version 0.1](https://github.com/openscilab/reserver/archive/v0.1.zip) or [Latest Source](https://github.com/openscilab/reserver/archive/dev.zip)
|
|
84
|
+
- Run `pip install .`
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
### Secure your desired PyPI package name!
|
|
88
|
+
```python
|
|
89
|
+
from reserver import Uploader
|
|
90
|
+
uploader = Uploader(PYPI_API_TOKEN, is_test_pypi_account= False)
|
|
91
|
+
uploader.upload_to_pypi("CONSIDERED_NAME_FOR_YOUR_PACKAGE")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Issues & bug reports
|
|
95
|
+
|
|
96
|
+
Just fill an issue and describe it. We'll check it ASAP! or send an email to [info@openscilab.com](mailto:info@openscilab.com "info@openscilab.com").
|
|
97
|
+
|
|
98
|
+
- Please complete the issue template
|
|
99
|
+
|
|
100
|
+
You can also join our discord server
|
|
101
|
+
|
|
102
|
+
<a href="https://discord.gg/RD2y6SGuY3">
|
|
103
|
+
<img src="https://img.shields.io/discord/1064533716615049236.svg?style=for-the-badge" alt="Discord Channel">
|
|
104
|
+
</a>
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## Show Your Support
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Star this repo
|
|
111
|
+
|
|
112
|
+
Give a ⭐️ if this project helped you!
|
|
113
|
+
|
|
114
|
+
### Donate to our project
|
|
115
|
+
If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .
|
|
116
|
+
|
|
117
|
+
<a href="https://openscilab.com/#donation" target="_blank"><img src="https://github.com/openscilab/reserver/raw/main/otherfiles/donation.png" height="90px" width="270px" alt="Reserver Donation"></a>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Reserver Functions."""
|
|
3
|
+
from requests import get
|
|
4
|
+
from .reserver_param import PYPI_TEST_URL, PYPI_MAIN_URL
|
|
5
|
+
from hashlib import sha256
|
|
6
|
+
from time import time
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_random_name():
|
|
10
|
+
"""
|
|
11
|
+
Generate a random str based on current timestamp.
|
|
12
|
+
|
|
13
|
+
:return: str
|
|
14
|
+
"""
|
|
15
|
+
return sha256(str(time()).encode("utf-8")).hexdigest()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def does_package_exist(suggested_name, test_pypi):
|
|
19
|
+
"""
|
|
20
|
+
Check whether a package with the given name exists or not.
|
|
21
|
+
|
|
22
|
+
:param suggested_name: given name to search in pypi(or test.pypi)
|
|
23
|
+
:type suggested_name: str
|
|
24
|
+
:param test_pypi: indicates to search in test.pypi or not
|
|
25
|
+
:type test_pypi: bool
|
|
26
|
+
:return: whether given name does exist in the pypi or not(as a boolean value)
|
|
27
|
+
"""
|
|
28
|
+
if not isinstance(suggested_name, str):
|
|
29
|
+
suggested_name = str(suggested_name)
|
|
30
|
+
if test_pypi:
|
|
31
|
+
url = PYPI_TEST_URL + "/" + suggested_name + "/"
|
|
32
|
+
else:
|
|
33
|
+
url = PYPI_MAIN_URL + "/" + suggested_name + "/"
|
|
34
|
+
response = get(url, timeout=5)
|
|
35
|
+
return not response.status_code == 404
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def generate_template_setup_py(package_name):
|
|
39
|
+
"""
|
|
40
|
+
Generate a template `setup.py` file for given package name.
|
|
41
|
+
|
|
42
|
+
:param package_name: given name to generate template `setup.py` for it.
|
|
43
|
+
:type package_name: str
|
|
44
|
+
:return: None
|
|
45
|
+
"""
|
|
46
|
+
setup_py_content = """
|
|
47
|
+
import sys
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
from setuptools import setup
|
|
51
|
+
except ImportError:
|
|
52
|
+
from distutils.core import setup
|
|
53
|
+
|
|
54
|
+
# invalid email
|
|
55
|
+
# download url
|
|
56
|
+
# url
|
|
57
|
+
# project urls
|
|
58
|
+
|
|
59
|
+
setup(
|
|
60
|
+
name =""" + "\"" + package_name + "\"" + """,
|
|
61
|
+
packages=[],
|
|
62
|
+
version='0.0.0',
|
|
63
|
+
description='This name has been reserved using Reserver',
|
|
64
|
+
long_description=\"\"\"
|
|
65
|
+
This name has been reserved using [Reserver](https://github.com/openscilab/reserver).
|
|
66
|
+
\"\"\",
|
|
67
|
+
long_description_content_type='text/markdown',
|
|
68
|
+
author='Development Team',
|
|
69
|
+
author_email='test@test.com',
|
|
70
|
+
url='https://url.com',
|
|
71
|
+
download_url='https://download_url.com',
|
|
72
|
+
keywords="python3 python reserve reserver reserved",
|
|
73
|
+
project_urls={
|
|
74
|
+
'Source': 'https://github.com/source',
|
|
75
|
+
},
|
|
76
|
+
install_requires="",
|
|
77
|
+
python_requires='>=3.6',
|
|
78
|
+
classifiers=[
|
|
79
|
+
\'Development Status :: 1 - Planning\',
|
|
80
|
+
\'Programming Language :: Python :: 3.6\',
|
|
81
|
+
\'Programming Language :: Python :: 3.7\',
|
|
82
|
+
\'Programming Language :: Python :: 3.8\',
|
|
83
|
+
\'Programming Language :: Python :: 3.9\',
|
|
84
|
+
\'Programming Language :: Python :: 3.10\',
|
|
85
|
+
\'Programming Language :: Python :: 3.11\',
|
|
86
|
+
\'Programming Language :: Python :: 3.12\',
|
|
87
|
+
],
|
|
88
|
+
license='MIT',
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
"""
|
|
92
|
+
with open(package_name + "_setup.py", "w+") as f:
|
|
93
|
+
f.writelines(setup_py_content)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Reserver modules."""
|
|
3
|
+
from .reserver_func import does_package_exist, generate_template_setup_py
|
|
4
|
+
from os import environ, path, getcwd, remove
|
|
5
|
+
from shutil import rmtree
|
|
6
|
+
from sys import executable
|
|
7
|
+
from subprocess import check_output, CalledProcessError
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Uploader:
|
|
11
|
+
"""
|
|
12
|
+
The Reserver Uploader class reserves a package name by uploading a template repo to pypi account.
|
|
13
|
+
|
|
14
|
+
>>> uploader = Uploader(API_TOKEN, is_test_pypi_account = True) # API_TOKEN refers to pypi(or test pypi)'s account api.
|
|
15
|
+
>>> uploader.upload_to_pypi(PACKAGE_NAME) # uploads package to the given test pypi account.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self, api_token, is_test_pypi_account=False):
|
|
19
|
+
"""
|
|
20
|
+
Initialize the Reserver Uploader instance.
|
|
21
|
+
|
|
22
|
+
:param api_token: pypi account's api token
|
|
23
|
+
:type api_token: str
|
|
24
|
+
:param is_test_pypi_account: indicates the given api_token is for a test.pypi account or not.
|
|
25
|
+
:type is_test_pypi_account: bool
|
|
26
|
+
:return: an instance of the Reserver Uploader
|
|
27
|
+
"""
|
|
28
|
+
self.username = "__token__"
|
|
29
|
+
self.password = api_token
|
|
30
|
+
self.test_pypi = is_test_pypi_account
|
|
31
|
+
|
|
32
|
+
def upload_to_pypi(self, package_name):
|
|
33
|
+
"""
|
|
34
|
+
Upload a template package to pypi or test_pypi.
|
|
35
|
+
|
|
36
|
+
:param package_name: package name
|
|
37
|
+
:type package_name: str
|
|
38
|
+
:return: None
|
|
39
|
+
"""
|
|
40
|
+
if does_package_exist(package_name, self.test_pypi):
|
|
41
|
+
print("This package already exists in PyPI.")
|
|
42
|
+
return False
|
|
43
|
+
|
|
44
|
+
generate_template_setup_py(package_name)
|
|
45
|
+
|
|
46
|
+
environ["TWINE_USERNAME"] = self.username
|
|
47
|
+
environ["TWINE_PASSWORD"] = self.password
|
|
48
|
+
|
|
49
|
+
generated_setup_file_path = path.join(getcwd(), package_name + "_setup.py")
|
|
50
|
+
generated_egginfo_file_path = path.join(getcwd(), package_name + ".egg-info")
|
|
51
|
+
generated_built_folder = path.join(getcwd(), "build")
|
|
52
|
+
generated_dist_folder = path.join(getcwd(), "dist")
|
|
53
|
+
generated_tar_gz_file = path.join(generated_dist_folder, "*.tar.gz")
|
|
54
|
+
generated_wheel_file = path.join(generated_dist_folder, "*.whl")
|
|
55
|
+
# prevent from uploading any other previously build library in this path.
|
|
56
|
+
if path.exists(generated_dist_folder):
|
|
57
|
+
rmtree(generated_dist_folder)
|
|
58
|
+
|
|
59
|
+
commands = [executable + " " + generated_setup_file_path + " sdist bdist_wheel "]
|
|
60
|
+
if self.test_pypi:
|
|
61
|
+
commands += [
|
|
62
|
+
executable + " -m twine upload --repository testpypi " + generated_tar_gz_file,
|
|
63
|
+
executable + " -m twine upload --repository testpypi " + generated_wheel_file,
|
|
64
|
+
]
|
|
65
|
+
else:
|
|
66
|
+
commands += [
|
|
67
|
+
executable + " -m twine upload --verbose " + generated_tar_gz_file,
|
|
68
|
+
executable + " -m twine upload --verbose " + generated_wheel_file,
|
|
69
|
+
]
|
|
70
|
+
# Run the commands
|
|
71
|
+
publish_failed = False
|
|
72
|
+
error = None
|
|
73
|
+
for command in commands:
|
|
74
|
+
print("running this command: ", command)
|
|
75
|
+
try:
|
|
76
|
+
check_output(command, shell=True, text=True)
|
|
77
|
+
except CalledProcessError as e:
|
|
78
|
+
publish_failed = True
|
|
79
|
+
error = e.output
|
|
80
|
+
if command == commands[-2]:
|
|
81
|
+
if "403" in error and "Invalid or non-existent authentication information" in error:
|
|
82
|
+
error = "Invalid or non-existent authentication information(PyPI API Key)."
|
|
83
|
+
break
|
|
84
|
+
|
|
85
|
+
remove(generated_setup_file_path)
|
|
86
|
+
rmtree(generated_egginfo_file_path)
|
|
87
|
+
rmtree(generated_built_folder)
|
|
88
|
+
rmtree(generated_dist_folder)
|
|
89
|
+
|
|
90
|
+
if publish_failed:
|
|
91
|
+
print(f"Publish to PyPI failed because of: ", error)
|
|
92
|
+
return False
|
|
93
|
+
else:
|
|
94
|
+
print("Congratulations! You have successfully reserved the PyPI package: ", package_name)
|
|
95
|
+
return True
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: reserver
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: This name has been reserved using Reserver
|
|
5
|
+
Home-page: https://url.com
|
|
6
|
+
Download-URL: https://download_url.com
|
|
7
|
+
Author: Development Team
|
|
8
|
+
Author-email: test@test.com
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Source, https://github.com/source
|
|
11
|
+
Keywords: python3 python reserve reserver reserved
|
|
12
|
+
Classifier: Development Status :: 1 - Planning
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.6
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: AUTHORS.md
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
This name has been reserved using [Reserver](https://github.com/openscilab/reserver).
|
|
27
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
AUTHORS.md
|
|
2
|
+
LICENSE
|
|
3
|
+
README.md
|
|
4
|
+
reserver_setup.py
|
|
5
|
+
setup.py
|
|
6
|
+
reserver/__init__.py
|
|
7
|
+
reserver/reserver_func.py
|
|
8
|
+
reserver/reserver_obj.py
|
|
9
|
+
reserver/reserver_param.py
|
|
10
|
+
reserver.egg-info/PKG-INFO
|
|
11
|
+
reserver.egg-info/SOURCES.txt
|
|
12
|
+
reserver.egg-info/dependency_links.txt
|
|
13
|
+
reserver.egg-info/top_level.txt
|
|
14
|
+
tests/test_reserver.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from setuptools import setup
|
|
6
|
+
except ImportError:
|
|
7
|
+
from distutils.core import setup
|
|
8
|
+
|
|
9
|
+
# invalid email
|
|
10
|
+
# download url
|
|
11
|
+
# url
|
|
12
|
+
# project urls
|
|
13
|
+
|
|
14
|
+
setup(
|
|
15
|
+
name ="reserver",
|
|
16
|
+
packages=[],
|
|
17
|
+
version='0.0.0',
|
|
18
|
+
description='This name has been reserved using Reserver',
|
|
19
|
+
long_description="""
|
|
20
|
+
This name has been reserved using [Reserver](https://github.com/openscilab/reserver).
|
|
21
|
+
""",
|
|
22
|
+
long_description_content_type='text/markdown',
|
|
23
|
+
author='Development Team',
|
|
24
|
+
author_email='test@test.com',
|
|
25
|
+
url='https://url.com',
|
|
26
|
+
download_url='https://download_url.com',
|
|
27
|
+
keywords="python3 python reserve reserver reserved",
|
|
28
|
+
project_urls={
|
|
29
|
+
'Source': 'https://github.com/source',
|
|
30
|
+
},
|
|
31
|
+
install_requires="",
|
|
32
|
+
python_requires='>=3.6',
|
|
33
|
+
classifiers=[
|
|
34
|
+
'Development Status :: 1 - Planning',
|
|
35
|
+
'Programming Language :: Python :: 3.6',
|
|
36
|
+
'Programming Language :: Python :: 3.7',
|
|
37
|
+
'Programming Language :: Python :: 3.8',
|
|
38
|
+
'Programming Language :: Python :: 3.9',
|
|
39
|
+
'Programming Language :: Python :: 3.10',
|
|
40
|
+
'Programming Language :: Python :: 3.11',
|
|
41
|
+
'Programming Language :: Python :: 3.12',
|
|
42
|
+
],
|
|
43
|
+
license='MIT',
|
|
44
|
+
)
|
|
45
|
+
|
reserver-0.0.0/setup.cfg
ADDED
reserver-0.0.0/setup.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Setup module."""
|
|
3
|
+
try:
|
|
4
|
+
from setuptools import setup
|
|
5
|
+
except ImportError:
|
|
6
|
+
from distutils.core import setup
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_requires():
|
|
10
|
+
"""Read requirements.txt."""
|
|
11
|
+
requirements = open("requirements.txt", "r").read()
|
|
12
|
+
return list(filter(lambda x: x != "", requirements.split()))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def read_description():
|
|
16
|
+
"""Read README.md and CHANGELOG.md."""
|
|
17
|
+
try:
|
|
18
|
+
with open("README.md") as r:
|
|
19
|
+
description = "\n"
|
|
20
|
+
description += r.read()
|
|
21
|
+
with open("CHANGELOG.md") as c:
|
|
22
|
+
description += "\n"
|
|
23
|
+
description += c.read()
|
|
24
|
+
return description
|
|
25
|
+
except Exception:
|
|
26
|
+
return '''PyPI Package Name Reserver'''
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
setup(
|
|
30
|
+
name='reserver',
|
|
31
|
+
packages=[
|
|
32
|
+
'reserver',],
|
|
33
|
+
version='0.1',
|
|
34
|
+
description='PyPI package name reserver',
|
|
35
|
+
long_description=read_description(),
|
|
36
|
+
long_description_content_type='text/markdown',
|
|
37
|
+
author='Reserver Development Team',
|
|
38
|
+
author_email='info@openscilab.com',
|
|
39
|
+
url='https://github.com/openscilab/reserver',
|
|
40
|
+
download_url='https://github.com/openscilab/reserver/tarball/v0.1',
|
|
41
|
+
keywords="python3 python PyPI pip package name reservation",
|
|
42
|
+
project_urls={
|
|
43
|
+
'Source': 'https://github.com/openscilab/reserver',
|
|
44
|
+
},
|
|
45
|
+
install_requires=get_requires(),
|
|
46
|
+
python_requires='>=3.6',
|
|
47
|
+
classifiers=[
|
|
48
|
+
'Development Status :: 3 - Alpha',
|
|
49
|
+
'Intended Audience :: Developers',
|
|
50
|
+
'Natural Language :: English',
|
|
51
|
+
'License :: OSI Approved :: MIT License',
|
|
52
|
+
'Operating System :: OS Independent',
|
|
53
|
+
'Programming Language :: Python :: 3.6',
|
|
54
|
+
'Programming Language :: Python :: 3.7',
|
|
55
|
+
'Programming Language :: Python :: 3.8',
|
|
56
|
+
'Programming Language :: Python :: 3.9',
|
|
57
|
+
'Programming Language :: Python :: 3.10',
|
|
58
|
+
'Programming Language :: Python :: 3.11',
|
|
59
|
+
'Programming Language :: Python :: 3.12',
|
|
60
|
+
'Intended Audience :: Developers',
|
|
61
|
+
'Intended Audience :: Education',
|
|
62
|
+
'Intended Audience :: End Users/Desktop',
|
|
63
|
+
'Intended Audience :: Manufacturing',
|
|
64
|
+
'Intended Audience :: Science/Research',
|
|
65
|
+
'Topic :: Development/Kit :: Package name reservation',
|
|
66
|
+
|
|
67
|
+
],
|
|
68
|
+
license='MIT',
|
|
69
|
+
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from reserver import Uploader
|
|
2
|
+
from reserver.reserver_func import get_random_name
|
|
3
|
+
|
|
4
|
+
# main pypi account - to be removed.
|
|
5
|
+
# pypi_token = "pypi-AgEIcHlwaS5vcmcCJDRmNThmNDFkLTZhNTYtNDU2Ny05YjhlLTM4YzNkNTczMDA4NgACKlszLCJiMjNmNjZlYS1iZGEzLTQ4NzYtYTdmNy02ZjZlYjYwM2I4NTMiXQAABiAqGQglXAgXzZUL5Ik-NsC1R8TidtKtZRZzbA32C8KiCA"
|
|
6
|
+
# main pypi account new password: "kwhM8Pp$S@sCx6m"
|
|
7
|
+
|
|
8
|
+
# test.pypi account
|
|
9
|
+
# test_pypi_token = "pypi-AgENdGVzdC5weXBpLm9yZwIkMTFkZDhjNWMtMTY2My00OWMyLTlmZGItZWZkMzU2NDQxMWJlAAIqWzMsIjJhYjkwZjE4LWQ1ODItNGFiNy05NTYwLWUxN2ZiZTcwY2Y2NyJdAAAGIDVymuINEbiyhSBeB_-ysIapdi_wHTTjD9vpV6mFGzvu"
|
|
10
|
+
# test pypi account new password: "fgtwwU64X7yEE6z"
|
|
11
|
+
|
|
12
|
+
# AHReccese reserver token:
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
test_pypi_token = os.environ.get("TEST_PYPI_PASSWORD")
|
|
16
|
+
|
|
17
|
+
def test_package_exists():
|
|
18
|
+
# test reserved name
|
|
19
|
+
uploader = Uploader(test_pypi_token, is_test_pypi_account= True)
|
|
20
|
+
assert uploader.upload_to_pypi("numpy") == False
|
|
21
|
+
|
|
22
|
+
def test_valid_package_invalid_credentials():
|
|
23
|
+
# test not reserved name -> wrong credentials
|
|
24
|
+
wrong_pypi_token = "pypi-wrong-api-token"
|
|
25
|
+
uploader = Uploader(wrong_pypi_token, is_test_pypi_account= True)
|
|
26
|
+
assert uploader.upload_to_pypi(get_random_name()) == False
|
|
27
|
+
|
|
28
|
+
def test_valid_package_valid_credentials():
|
|
29
|
+
# test not reserved name -> correct credentials
|
|
30
|
+
pypi_token = "pypi-AgEIcHlwaS5vcmcCJDExMWY5NjljLWQ1MDktNGY3YS1hM2IxLTQ0NDdjMjUzMmM1NAACKlszLCI4YWI5MmU3Mi02ZTJiLTQzM2EtYjA4Ni0wNzYxNGU4NTM2Y2MiXQAABiAGihGds9jq0FdriHsw1q9jq4UY-LmjEyNFgT8lNkaxCg"
|
|
31
|
+
uploader = Uploader(pypi_token)
|
|
32
|
+
uploader.upload_to_pypi("reserver")
|
|
33
|
+
# assert True == True
|
|
34
|
+
test_valid_package_valid_credentials()
|