Skip to content

Commit

Permalink
Add setup.py file for packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
codophobia committed Jan 21, 2024
1 parent 2efd0bc commit 80504d2
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 9 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: lint-test

on: [push]
on: [push, pull_request]

jobs:
build:
Expand All @@ -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
run: |
pip install flake8
flake8 cache --exclude gen
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository_url: https://upload.pypi.org/legacy/
build_dir: dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
__pycache__/
venv/
.mypy_cache
.pytest_cache
.pytest_cache
*.egg-info/
build/
dist/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 5 additions & 1 deletion cache/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

from cache.cli import main
from cache.cli import main as cli_main


def main():
cli_main()


if __name__ == "__main__":
Expand Down
Empty file added cache/client/__init__.py
Empty file.
Empty file added cache/client/python/__init__.py
Empty file.
Empty file added cache/gen/__init__.py
Empty file.
21 changes: 21 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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='[email protected]',
license='APACHE',
packages=find_packages(include=['cache', 'cache.*']),
install_requires=[
'thrift',
],
zip_safe=False
)

0 comments on commit 80504d2

Please sign in to comment.