diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index bd2e176..ccca905 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,6 +1,6 @@ name: lint-test -on: [push] +on: [push, pull_request] jobs: build: @@ -16,9 +16,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - name: Code quality with flake8 - run: flake8 cache --exclude gen \ No newline at end of file + run: | + pip install flake8 + flake8 cache --exclude gen \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..de3d15e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,37 @@ +name: test + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + + steps: + - uses: actions/checkout@v4 + - name: Setup Python # Set Python version + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Test with pytest + run: | + pip install pytest + pytest cache + - name: Code quality with flake8 + run: | + pip install flake8 + flake8 cache --exclude gen + - name: Build package + run: | + pip install build + python3 -m build + - name: Upload package to PyPI + uses: pypa/gh-action-pypi-publish@27.0.3 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + repository_url: https://upload.pypi.org/legacy/ + build_dir: dist \ No newline at end of file diff --git a/.github/workflows/build_test.yaml b/.github/workflows/test.yaml similarity index 90% rename from .github/workflows/build_test.yaml rename to .github/workflows/test.yaml index 7dc250c..d97e58b 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/test.yaml @@ -20,5 +20,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt + - name: Build the code + run: python3 -m build - name: Test with pytest run: pytest cache \ No newline at end of file diff --git a/.gitignore b/.gitignore index bf5f69a..924f1a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ __pycache__/ venv/ .mypy_cache -.pytest_cache \ No newline at end of file +.pytest_cache +*.egg-info/ +build/ +dist/ \ No newline at end of file diff --git a/README.md b/README.md index 0137806..b221fbe 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![build-and-test](https://github.com/codophobia/key-value-cache-thrift-python/actions/workflows/build_test.yaml/badge.svg)](https://github.com/codophobia/key-value-cache-thrift-python/actions/workflows/build_test.yaml) [![lint-test](https://github.com/codophobia/key-value-cache-thrift-python/actions/workflows/lint.yaml/badge.svg)](https://github.com/codophobia/key-value-cache-thrift-python/actions/workflows/lint.yaml) ![GitHub License](https://img.shields.io/github/license/codophobia/key-value-cache-thrift-python) +[![build-and-test](https://github.com/codophobia/key-value-cache-thrift-python/actions/workflows/build_test.yaml/badge.svg)](https://github.com/codophobia/key-value-cache-thrift-python/actions/workflows/test.yaml) [![lint-test](https://github.com/codophobia/key-value-cache-thrift-python/actions/workflows/lint.yaml/badge.svg)](https://github.com/codophobia/key-value-cache-thrift-python/actions/workflows/lint.yaml) ![GitHub License](https://img.shields.io/github/license/codophobia/key-value-cache-thrift-python) # key-value-cache-thrift-python Implement a simple key value cache using thrift and Python diff --git a/cache/__main__.py b/cache/__main__.py index ad59b36..4af9d68 100644 --- a/cache/__main__.py +++ b/cache/__main__.py @@ -1,5 +1,9 @@ -from cache.cli import main +from cache.cli import main as cli_main + + +def main(): + cli_main() if __name__ == "__main__": diff --git a/cache/client/__init__.py b/cache/client/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cache/client/python/__init__.py b/cache/client/python/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cache/gen/__init__.py b/cache/gen/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9fb4329 --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +from setuptools import setup, find_packages + +setup( + name='thriftcacheserver', + version='1.0', + description='A cache server using thrift', + url='https://github.com/codophobia/key-value-cache-thrift-python', + entry_points={ + 'console_scripts': [ + 'thriftcacheserver = cache.__main__:main', + ] + }, + author='Shivam Mitra', + author_email='shivamm389@gmail.com', + license='APACHE', + packages=find_packages(include=['cache', 'cache.*']), + install_requires=[ + 'thrift', + ], + zip_safe=False +)