Первый коммит
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
venv/
|
||||||
|
test.*
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Ilia Miheev <waggle-pout-sprawl@duck.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
1. The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
2. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# Библиотека для загрузки проектов на PyPI и TestPyPI
|
||||||
|
|
||||||
|
Библиотека способна быстро и просто выгрузить проекты. Проект доступен из командной строки.
|
||||||
|
|
||||||
|
```
|
||||||
|
uploadi [-h] [-t] [-p] name_project
|
||||||
|
```
|
||||||
|
|
||||||
|
1. **-h**: Выведет справочную информацию
|
||||||
|
2. **-t**: Проект будет выгружен на TestPyPI
|
||||||
|
3. **-p**: Проект будет выгружен на PyPI
|
||||||
|
4. **name_project**: название вашего проекта
|
||||||
|
|
||||||
|
## Пример
|
||||||
|
Эта команда выгрузит проект ipars на TestPyPI
|
||||||
|
```bash
|
||||||
|
uploadi -t ipars
|
||||||
|
```
|
||||||
|
Эта команда выгрузит проект uploadi на PyPI
|
||||||
|
```bash
|
||||||
|
uploadi -p uploadi
|
||||||
|
```
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='uploadi',
|
||||||
|
version='1.0.1',
|
||||||
|
description='Приложение для загрузки проектов python',
|
||||||
|
long_description=open('./README.md', encoding='utf8').read(),
|
||||||
|
long_description_content_type='text/markdown',
|
||||||
|
author='Ilia Miheev',
|
||||||
|
author_email='waggle-pout-sprawl@duck.com',
|
||||||
|
packages=find_packages(),
|
||||||
|
license='MIT',
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': [
|
||||||
|
'uploadi=uploadi.uploadi:uploadi',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
from argparse import ArgumentParser
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
class CustomArgumentParser(ArgumentParser):
|
||||||
|
def error(self, message):
|
||||||
|
self.print_usage(sys.stderr)
|
||||||
|
print(f"Ошибка: {message}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def uploadi():
|
||||||
|
# Получаем аргументы из командной строки
|
||||||
|
parser = CustomArgumentParser(description="Код для загрузки проектов python на PyPI или TestPyPI")
|
||||||
|
parser.add_argument('-t', action='store_true', help='Загрузка будет происходить на TestPyPI')
|
||||||
|
parser.add_argument('-p', action='store_true', help='Загрузка будет происходить на PyPI')
|
||||||
|
parser.add_argument('name_project', help='Название проекта')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Проверяем наличие одного из флагов
|
||||||
|
# Если указагы оба флага или ни один
|
||||||
|
if (args.t and args.p) or (not args.t and not args.p):
|
||||||
|
print('Надо выбрать один флаг. -t или -p')
|
||||||
|
return
|
||||||
|
|
||||||
|
name_project = args.name_project
|
||||||
|
|
||||||
|
|
||||||
|
# Выполняем выгрузку
|
||||||
|
os.system('python setup.py sdist bdist_wheel')
|
||||||
|
if args.t:
|
||||||
|
os.system('twine upload --repository-url https://test.pypi.org/legacy/ dist/*')
|
||||||
|
else:
|
||||||
|
os.system('twine upload dist/*')
|
||||||
|
os.system(f'rmdir /s /q build dist {name_project}.egg-info')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
uploadi()
|
||||||
Reference in New Issue
Block a user