Skip to content

Commit 80504d2

Browse files
committed
Add setup.py file for packaging
1 parent 2efd0bc commit 80504d2

File tree

10 files changed

+74
-9
lines changed

10 files changed

+74
-9
lines changed

.github/workflows/lint.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: lint-test
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:
@@ -16,9 +16,7 @@ jobs:
1616
uses: actions/setup-python@v4
1717
with:
1818
python-version: ${{ matrix.python-version }}
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install -r requirements.txt
2319
- name: Code quality with flake8
24-
run: flake8 cache --exclude gen
20+
run: |
21+
pip install flake8
22+
flake8 cache --exclude gen

.github/workflows/release.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.8", "3.9", "3.10"]
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Setup Python # Set Python version
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Test with pytest
20+
run: |
21+
pip install pytest
22+
pytest cache
23+
- name: Code quality with flake8
24+
run: |
25+
pip install flake8
26+
flake8 cache --exclude gen
27+
- name: Build package
28+
run: |
29+
pip install build
30+
python3 -m build
31+
- name: Upload package to PyPI
32+
uses: pypa/[email protected]
33+
with:
34+
user: __token__
35+
password: ${{ secrets.PYPI_TOKEN }}
36+
repository_url: https://upload.pypi.org/legacy/
37+
build_dir: dist

.github/workflows/build_test.yaml renamed to .github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ jobs:
2020
run: |
2121
python -m pip install --upgrade pip
2222
pip install -r requirements.txt
23+
- name: Build the code
24+
run: python3 -m build
2325
- name: Test with pytest
2426
run: pytest cache

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
__pycache__/
22
venv/
33
.mypy_cache
4-
.pytest_cache
4+
.pytest_cache
5+
*.egg-info/
6+
build/
7+
dist/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![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)
1+
[![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)
22

33
# key-value-cache-thrift-python
44
Implement a simple key value cache using thrift and Python

cache/__main__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11

2-
from cache.cli import main
2+
from cache.cli import main as cli_main
3+
4+
5+
def main():
6+
cli_main()
37

48

59
if __name__ == "__main__":

cache/client/__init__.py

Whitespace-only changes.

cache/client/python/__init__.py

Whitespace-only changes.

cache/gen/__init__.py

Whitespace-only changes.

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name='thriftcacheserver',
5+
version='1.0',
6+
description='A cache server using thrift',
7+
url='https://github.com/codophobia/key-value-cache-thrift-python',
8+
entry_points={
9+
'console_scripts': [
10+
'thriftcacheserver = cache.__main__:main',
11+
]
12+
},
13+
author='Shivam Mitra',
14+
author_email='[email protected]',
15+
license='APACHE',
16+
packages=find_packages(include=['cache', 'cache.*']),
17+
install_requires=[
18+
'thrift',
19+
],
20+
zip_safe=False
21+
)

0 commit comments

Comments
 (0)