Initial commit

This commit is contained in:
Gregory Lirent 2024-01-31 19:15:49 +03:00
commit 95a80636c8
Signed by: lirent
GPG Key ID: F616BE337EFFEE77
8 changed files with 157 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.*/
__pycache__/
/build/
/dist/
/*.egg-info/

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 AUTHOR <email@example.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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.

1
README.md Normal file
View File

@ -0,0 +1 @@
# [package-name](https://dev.lirent.ru/python/package-name)

27
RELEASE-NOTES.md Normal file
View File

@ -0,0 +1,27 @@
## 0.0.0 (1970-01-01)
> Description
### Upgrade Steps
*
*
### Breaking Changes
*
*
### New Features
*
*
### Bug Fixes
*
*
### Performance Improvements
*
*
### Other Changes
*
*

1
package/__init__.py Normal file
View File

@ -0,0 +1 @@
# This software is licensed by the MIT License (MIT), see LICENSE file

0
requirements.txt Normal file
View File

3
setup.cfg Normal file
View File

@ -0,0 +1,3 @@
[egg_info]
tag_build =
tag_date = 0

99
setup.py Normal file
View File

@ -0,0 +1,99 @@
# This software is licensed by the MIT License (MIT), see LICENSE file
# Use it with: `python setup.py sdist bdist_wheel`
import os
from pathlib import Path
from setuptools import setup, find_packages
AUTHOR = 'Author'
AUTHOR_EMAIL = 'email@example.com'
PROJECT_URL = 'https://dev.lirent.ru/python/package-name'
PROJECT_REPO = f'{PROJECT_URL}/src/branch/master'
PROJECT_DOCS = f'{PROJECT_REPO}/README.md'
DESCRIPTION = 'Package description'
KEYWORDS = ''
PYTHON_VERSION = "3.11"
CLASSIFIERS = [
f'Programming Language :: Python :: {PYTHON_VERSION}',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Framework :: Django :: 5.0'
]
CWD = Path(__file__).resolve().parent
def get_package_name():
excludes = [('.git', '.git'), ('test', '')]
candidates = []
with open(CWD / '.gitignore', 'r', -1, 'utf8') as f:
for line in f.readlines():
line = line.strip()
if line.endswith('/'):
line = line[1:-1] if line.startswith('/') else line[:-1]
if line.count('*') == 1:
line = line.split('*')
elif line.count('*') > 1:
raise AttributeError(f'unexpected value in .gitignore: {line}/')
else:
line = (line, line)
excludes.append(line)
for instance in os.listdir(CWD):
if os.path.isdir(CWD / instance):
exclude = False
for x in excludes:
if instance.startswith(x[0]) and instance.endswith(x[1]):
exclude = True
break
if not exclude:
candidates.append(instance)
if len(candidates) != 1:
raise AttributeError('package name cannot be determined')
else:
return candidates[0]
def readme():
with open(CWD / 'README.md', 'r', -1, 'utf8') as f:
return f.read()
def version():
with open(CWD / 'RELEASE-NOTES.md', 'r', -1, 'utf8') as f:
for line in f.readlines():
if line.startswith('## '):
return line[2:].strip().split(' ')[0]
raise AttributeError('version not found')
def requirements():
with open(CWD / 'requirements.txt', 'r', -1, 'utf8') as f:
return [line.strip() for line in f.readlines() if line.strip()]
setup(
name=get_package_name(),
version=version(),
author=AUTHOR,
author_email=AUTHOR_EMAIL,
description=DESCRIPTION,
long_description=readme(),
long_description_content_type='text/markdown',
url=PROJECT_URL,
packages=find_packages(),
install_requires=requirements(),
classifiers=CLASSIFIERS,
keywords=KEYWORDS,
project_urls={
'homepage': PROJECT_URL,
'repository': PROJECT_REPO,
'documentation': PROJECT_DOCS
},
python_requires=f'>={PYTHON_VERSION}'
)