From 55edbd8aae04a013f37d4398b78ea31b8ab66102 Mon Sep 17 00:00:00 2001 From: Dustin Lo Date: Mon, 9 Jan 2023 20:46:01 -0800 Subject: [PATCH] HC-431 - Make hysds-framework conda installable (#35) * added to .gitignore additional metadata to setup.py * test github webhook to jenkins * test github webhook to jenkins * test github webhook to jenkins * test github webhook to jenkins * test * test * update * added new job(s) + workflow to circleci first job is to build and unit test osaka second job is to build + publish the package to pypi (added the pypi creds to circleci under contexts) added workflow first run the "build" job and if successful it will proceed to the publish job to pypi the workflow will trigger when a new tag is created * changed pypi repo url * bump version * added filter build-and-deploy * moved pypi-creds context to publish job only * using cimg docker image Co-authored-by: dustinlo --- .circleci/config.yml | 66 +++++++++++++++++- .gitignore | 162 +++++++++++++++++++++++++++++++++++++++++++ osaka/__init__.py | 2 +- setup.py | 31 ++++++++- 4 files changed, 256 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e82169d..28777aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,6 +14,48 @@ jobs: source $HOME/.bash_profile python setup.py install pytest . + build: + docker: + - image: cimg/python:3.9 + auth: + username: $DOCKER_USER + password: $DOCKER_PASS + steps: + - checkout + - run: + name: Install dependencies + command: | + pip install pytest==7.2.0 + pip install . + - run: + name: pytest + command: | + pytest . + publish-pypi: + docker: + - image: cimg/python:3.9 + auth: + username: $DOCKER_USER + password: $DOCKER_PASS + steps: + - checkout + - run: + name: Init .pypirc + command: | + echo -e "[pypi]" >> ~/.pypirc + echo -e "repository: https://upload.pypi.org/legacy/" >> ~/.pypirc + echo -e "username: $PYPI_USER" >> ~/.pypirc + echo -e "password: $PYPI_PASSWORD" >> ~/.pypirc + - run: + name: Install tools + command: | + pip install twine==4.0.2 + - run: + name: Install and publish to PyPI + command: | + pip install . + python setup.py sdist bdist_wheel + twine upload dist/* --verbose --config-file ~/.pypirc workflows: version: 2 @@ -39,4 +81,26 @@ workflows: filters: branches: only: develop - + build-and-deploy: + jobs: + - build: + context: + - docker-hub-creds + - git-oauth-token + filters: + tags: + only: /[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ + - publish-pypi: + context: + - docker-hub-creds + - git-oauth-token + - pypi-creds + requires: + - build + filters: + tags: + only: /[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ diff --git a/.gitignore b/.gitignore index 84813d0..62cf7fc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,165 @@ *.egg-info *.pyc .vscode + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea/ + diff --git a/osaka/__init__.py b/osaka/__init__.py index e377743..1fcc37e 100644 --- a/osaka/__init__.py +++ b/osaka/__init__.py @@ -3,6 +3,6 @@ from __future__ import division from __future__ import absolute_import -__version__ = "1.2.0" +__version__ = "1.2.1" __url__ = "https://github.com/hysds/osaka" __description__ = "Osaka (Object Store Abstraction K Arcitecture)" diff --git a/setup.py b/setup.py index a7ea57f..1383a64 100644 --- a/setup.py +++ b/setup.py @@ -4,12 +4,20 @@ from setuptools import setup, find_packages import osaka + +def readme(): + with open("README.md") as f: + return f.read() + + setup( name="osaka", version=osaka.__version__, - long_description=osaka.__description__, + description=osaka.__description__, + long_description_content_type="text/markdown", + long_description=readme(), url=osaka.__url__, - packages=find_packages(), + packages=find_packages(exclude=["tests.*", "tests"]), include_package_data=True, zip_safe=False, install_requires=[ @@ -27,5 +35,22 @@ "mock>=4.0.3", "moto>=2.0.6", ], - entry_points={"console_scripts": ["osaka = osaka.__main__:main"]}, + entry_points={ + "console_scripts": ["osaka = osaka.__main__:main"] + }, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Operating System :: POSIX :: Linux", + "Operating System :: Unix", + "Operating System :: MacOS :: MacOS X", + ], )