Первый коммит

This commit is contained in:
Ilia Miheev
2025-07-10 13:08:44 +03:00
commit 286d1132ee
6 changed files with 102 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
venv/
test.*
+21
View File
@@ -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.
+22
View File
@@ -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
```
+18
View File
@@ -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',
],
},
)
View File
+39
View File
@@ -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()