From 50dccdc14b2612dc1739649a10d51e2c8f6629ea Mon Sep 17 00:00:00 2001 From: Vasilis Raptakis Date: Wed, 9 Oct 2024 17:55:54 -0700 Subject: [PATCH] LUM-979: Automate pushing to pypi --- .run/Unit Tests.run.xml | 18 ----------------- DEPLOY.md | 20 +++++++++++++++++++ VERSION | 2 +- requirements-test.txt | 0 scripts/push-to-pypi.sh | 43 +++++++++++++++++++++++++++++++++++++++++ setup.py | 15 ++++++++------ tests/test_sdk.py | 1 - 7 files changed, 73 insertions(+), 26 deletions(-) delete mode 100644 .run/Unit Tests.run.xml create mode 100644 DEPLOY.md delete mode 100644 requirements-test.txt create mode 100755 scripts/push-to-pypi.sh delete mode 100644 tests/test_sdk.py diff --git a/.run/Unit Tests.run.xml b/.run/Unit Tests.run.xml deleted file mode 100644 index 277e84e..0000000 --- a/.run/Unit Tests.run.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - \ No newline at end of file diff --git a/DEPLOY.md b/DEPLOY.md new file mode 100644 index 0000000..40690ea --- /dev/null +++ b/DEPLOY.md @@ -0,0 +1,20 @@ +### Deploying to PyPI + +1. Create an API key on PyPI +2. Create a `.pypirc` file in your home directory with the following content: +```bash +[distutils] + index-servers = + lumino + +[lumino] + repository = https://upload.pypi.org/legacy/ + username = __token__ + password = +``` + +3. Make sure the `VERSION` file is updated +4. Run the following command: +```bash +./scripts/push-to-pypi.sh +``` \ No newline at end of file diff --git a/VERSION b/VERSION index 6812f81..2774f85 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.3 \ No newline at end of file +0.10.0 \ No newline at end of file diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/push-to-pypi.sh b/scripts/push-to-pypi.sh new file mode 100755 index 0000000..628715d --- /dev/null +++ b/scripts/push-to-pypi.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status +set -e + +# Check if twine is installed, if not, install it +if ! command -v twine &> /dev/null; then + echo "twine not found, please install it with 'pip install twine'" + exit +fi + +# Check if a ~/.pypirc file exists, if not, error out +if [ ! -f ~/.pypirc ]; then + echo "Please create a ~/.pypirc file with your PyPI API token; example:" + echo "Example:" + echo "[distutils]" + echo " index-servers =" + echo " lumino" + echo "" + echo "[lumino]" + echo " repository = https://upload.pypi.org/legacy/" + echo " username = __token__" + echo " password = pypi-......" + exit +fi + +# Remove any old distributions +echo "Removing old distributions..." +rm -rf dist/* + +# Create source distribution and wheel +echo "Building the package..." +python setup.py sdist bdist_wheel + +# Upload the package to PyPI +echo "Uploading the package to PyPI..." +twine upload --repository lumino dist/* + +# Clean up +echo "Cleaning up build files..." +rm -rf build dist *.egg-info + +echo "Package successfully uploaded to PyPI!" \ No newline at end of file diff --git a/setup.py b/setup.py index c32ba56..56c6547 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,18 @@ from setuptools import setup, find_packages +# Read README.md file for long description with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() +# Read version from VERSION file with open("VERSION", "r", encoding="utf-8") as fh: version = fh.read() +# Read requirements from requirements.txt file +with open("requirements.txt", "r", encoding="utf-8") as fh: + requirements = fh.read().splitlines() + +# Setup configuration setup( name="lumino", version=version, @@ -18,10 +25,6 @@ url="https://github.com/luminolabs/lumino-sdk-python", packages=find_packages(where="src"), package_dir={"": "src"}, - python_requires=">=3.7", - install_requires=[ - "aiohttp", - "pydantic", - "pydantic[email]", - ], + python_requires=">=3.10", + install_requires=requirements, ) \ No newline at end of file diff --git a/tests/test_sdk.py b/tests/test_sdk.py deleted file mode 100644 index 4fcf943..0000000 --- a/tests/test_sdk.py +++ /dev/null @@ -1 +0,0 @@ -# TODO: Implement unit tests \ No newline at end of file