diff --git a/build_deploy.sh b/build_deploy.sh index 2bccb12..87a093a 100755 --- a/build_deploy.sh +++ b/build_deploy.sh @@ -1,16 +1,28 @@ #!/usr/bin/env bash +#================================================================ +# DESCRIPTION +# This script builds the Python library and uploads the package either to testPyPi or PyPi, depending on the first argument provided. +# The argument can be '--local' for local testing, '--test' for uploading to testPyPi, or left empty for uploading to PyPi. +#================================================================ -TEST_URL="https://test.pypi.org/legacy/" +print_msg() { + local GRE='\e[1;32m' + local NC='\e[0m' + echo -e "${GRE}$1${NC}" + return 0 +} pip3 install -r requirements/release.txt -[ -d "dist" ] && rm -r dist && echo -e '\e[38;5;219m./dist dir deleted\e[0m' -python3 setup.py sdist bdist_wheel -[[ "$1" = "--local" ]] && echo -e '\e[38;5;219mtar.gz created in ./dist, install it locally via pip\e[0m' && exit 0 +[ -d "dist" ] && rm -r dist && print_msg './dist dir deleted' +python3 -m build +[[ "$1" = "--local" ]] && print_msg 'tar.gz created in ./dist, install it locally via pip' && exit 0 if twine check dist/*; then if [ "$1" = "--test" ] ; then - twine upload --repository-url ${TEST_URL} dist/* + twine upload --repository testpypi dist/* + print_msg "Use this command for local testing: + python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps cron-converter" else twine upload dist/* fi diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ff5f386 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,31 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "cron-converter" +version = "1.1.0" +authors = [ + { name="Andrea Salvatori", email="16443598+Sonic0@users.noreply.github.com " }, +] +description = "Cron string parser and scheduler for Python" +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Operating System :: OS Independent", + "Topic :: Software Development :: Libraries :: Python Modules" +] +dependencies = ["python-dateutil"] + +[project.optional-dependencies] +test = ["unittest"] + +[project.urls] +Homepage = "https://github.com/Sonic0/cron-converter" +Issues = "https://github.com/Sonic0/cron-converter/issues" \ No newline at end of file diff --git a/requirements/release.txt b/requirements/release.txt index ca43792..273a4e0 100644 --- a/requirements/release.txt +++ b/requirements/release.txt @@ -1,4 +1,3 @@ -r base.txt twine -wheel -setuptools +build diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e69de29..0000000 diff --git a/setup.py b/setup.py deleted file mode 100644 index f005ee8..0000000 --- a/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -from setuptools import setup, find_packages - -setup( - name='cron-converter', - version='1.0.2', - license='MIT License', - description='Cron string parser and scheduler for Python', - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - author='Andrea Salvatori', - author_email='andrea.salvatori92@gmail.com', - url='https://github.com/Sonic0/cron-converter', - packages=['cron_converter', 'cron_converter/sub_modules'], - keywords='cron', - install_requires=['python-dateutil'], - include_package_data=True, - extras_require={ - 'test': ['unittest'], - }, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3 :: Only', - 'Topic :: Software Development :: Libraries :: Python Modules' - ], - python_requires='>=3.8', -)