Skip to content

Commit 0ee82e1

Browse files
author
Hirotaka Wakabayashi
committed
secondary commit
1 parent 356696a commit 0ee82e1

40 files changed

Lines changed: 5427 additions & 1 deletion

.github/ISSUE_TEMPLATE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Additional Information
2+
(The following information is very important in order to help us to help you. Omission of the following details may delay your support request or receive no attention at all.)
3+
4+
- Version of python (python --version)
5+
```
6+
```
7+
8+
- Version of K2HR3 OpenStack Notification Listener (k2hr3-osnl -v)
9+
```
10+
```
11+
12+
- System information (uname -a)
13+
```
14+
```
15+
16+
- Distro (cat /etc/issue)
17+
```
18+
```
19+
20+
## Details about issue

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Relevant Issue (if applicable)
2+
(If there are Issues related to this PullRequest, please list it.)
3+
4+
## Details
5+
(Please describe the details of PullRequest.)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
echo $(basename $0)
4+
5+
if test -f "/etc/os-release"; then
6+
. /etc/os-release
7+
OS_NAME=$ID
8+
OS_VERSION=$VERSION_ID
9+
elif test -f "/etc/centos-release"; then
10+
echo "[OK] /etc/centos-release falling back to CentOS-7"
11+
OS_NAME=centos
12+
OS_VERSION=7
13+
else
14+
echo "Unknown OS, neither /etc/os-release nor /etc/centos-release"
15+
exit 1
16+
fi
17+
18+
echo "[OK] HOSTNAME=${HOSTNAME} OS_NAME=${OS_NAME} OS_VERSION=${OS_VERSION}"
19+
20+
case "${OS_NAME}-${OS_VERSION}" in
21+
ubuntu*|debian*)
22+
DEBIAN_FRONTEND="noninteractive" sudo apt-get update -y
23+
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y curl pylint
24+
curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh | sudo bash
25+
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y k2hash-dev
26+
;;
27+
centos-7)
28+
sudo yum install -y epel-release-7
29+
sudo yum install -y --enablerepo=epel pylint python3 git curl which
30+
curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh | sudo bash
31+
sudo yum install -y k2hash-devel
32+
;;
33+
centos-8|fedora*)
34+
sudo dnf install -y epel-release-8
35+
sudo dnf install -y python3-pylint git curl
36+
curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh | sudo bash
37+
sudo dnf install -y k2hash-devel
38+
;;
39+
esac
40+
41+
exit $?
42+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
echo $(basename $0)
4+
5+
if test -f "/etc/os-release"; then
6+
. /etc/os-release
7+
OS_NAME=$ID
8+
OS_VERSION=$VERSION_ID
9+
elif test -f "/etc/centos-release"; then
10+
echo "[OK] /etc/centos-release falling back to CentOS-7"
11+
OS_NAME=centos
12+
OS_VERSION=7
13+
else
14+
echo "Unknown OS, neither /etc/os-release nor /etc/centos-release"
15+
exit 1
16+
fi
17+
18+
echo "[OK] HOSTNAME=${HOSTNAME} OS_NAME=${OS_NAME} OS_VERSION=${OS_VERSION}"
19+
cd src
20+
21+
pylint k2hash --py3k -r n
22+
23+
exit $?
24+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
echo $(basename $0)
4+
5+
if test -f "/etc/os-release"; then
6+
. /etc/os-release
7+
OS_NAME=$ID
8+
OS_VERSION=$VERSION_ID
9+
elif test -f "/etc/centos-release"; then
10+
echo "[OK] /etc/centos-release falling back to CentOS-7"
11+
OS_NAME=centos
12+
OS_VERSION=7
13+
else
14+
echo "[NO] Unknown OS, neither /etc/os-release nor /etc/centos-release"
15+
exit 1
16+
fi
17+
18+
echo "[OK] HOSTNAME=${HOSTNAME} OS_NAME=${OS_NAME} OS_VERSION=${OS_VERSION}"
19+
PYTHON=""
20+
case "${OS_NAME}-${OS_VERSION}" in
21+
ubuntu*|debian*)
22+
PYTHON=$(which python)
23+
;;
24+
centos*|fedora*)
25+
PYTHON=$(which python3)
26+
;;
27+
esac
28+
29+
cd src
30+
31+
TEST_FILES="test_k2hash.py test_k2hash_package.py test_keyqueue.py test_queue.py"
32+
for TEST_FILE in ${TEST_FILES}
33+
do
34+
${PYTHON} -m unittest k2hash/tests/${TEST_FILE}
35+
if test $? -ne 0; then
36+
echo "[NO] ${PYTHON} -m unittest k2hash/tests/${TEST_FILE}"
37+
exit 1
38+
fi
39+
done
40+
41+
exit 0
42+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
release:
12+
types: [published]
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ["3.x", "3.10", "3.9", "3.8", "3.7"]
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
./.github/scripts/install_dependencies.sh
32+
shell: sh
33+
- name: Lint with pylint
34+
run: |
35+
./.github/scripts/lint_with_pylint.sh
36+
shell: sh
37+
- name: Test with unittest
38+
run: |
39+
./.github/scripts/test_with_unittest.sh
40+
shell: sh
41+
- name: Install dependencies for upload pypi package
42+
if: startsWith(github.ref, 'refs/tags')
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install build
46+
- name: Build package
47+
if: startsWith(github.ref, 'refs/tags')
48+
run: python -m build
49+
- name: Publish distribution to PyPI
50+
if: ${{ matrix.python-version == '3.x' && startsWith(github.ref, 'refs/tags') }}
51+
uses: pypa/gh-action-pypi-publish@master
52+
with:
53+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# K2hash Python Driver
4+
#
5+
# Copyright (c) 2022 Yahoo Japan Corporation
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
#
25+
# AUTHOR: Hirotaka Wakabayashi
26+
# CREATE: Tue Feb 08 2022
27+
# REVISION:
28+
#
29+
# Byte-compiled / optimized / DLL files
30+
__pycache__/
31+
*.py[cod]
32+
*$py.class
33+
34+
# C extensions
35+
*.so
36+
37+
# Distribution / packaging
38+
.Python
39+
build/
40+
develop-eggs/
41+
dist/
42+
downloads/
43+
eggs/
44+
.eggs/
45+
lib/
46+
lib64/
47+
parts/
48+
sdist/
49+
var/
50+
wheels/
51+
pip-wheel-metadata/
52+
share/python-wheels/
53+
*.egg-info/
54+
.installed.cfg
55+
*.egg
56+
MANIFEST
57+
58+
# PyInstaller
59+
# Usually these files are written by a python script from a template
60+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
61+
*.manifest
62+
*.spec
63+
64+
# Installer logs
65+
pip-log.txt
66+
pip-delete-this-directory.txt
67+
68+
# Unit test / coverage reports
69+
htmlcov/
70+
.tox/
71+
.nox/
72+
.coverage
73+
.coverage.*
74+
.cache
75+
nosetests.xml
76+
coverage.xml
77+
*.cover
78+
*.py,cover
79+
.hypothesis/
80+
.pytest_cache/
81+
82+
# Translations
83+
*.mo
84+
*.pot
85+
86+
# Django stuff:
87+
*.log
88+
local_settings.py
89+
db.sqlite3
90+
db.sqlite3-journal
91+
92+
# Flask stuff:
93+
instance/
94+
.webassets-cache
95+
96+
# Scrapy stuff:
97+
.scrapy
98+
99+
# Sphinx documentation
100+
docs/_build/
101+
102+
# PyBuilder
103+
target/
104+
105+
# Jupyter Notebook
106+
.ipynb_checkpoints
107+
108+
# IPython
109+
profile_default/
110+
ipython_config.py
111+
112+
# pyenv
113+
.python-version
114+
115+
# pipenv
116+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
117+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
118+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
119+
# install all needed dependencies.
120+
#Pipfile.lock
121+
122+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
123+
__pypackages__/
124+
125+
# Celery stuff
126+
celerybeat-schedule
127+
celerybeat.pid
128+
129+
# SageMath parsed files
130+
*.sage.py
131+
132+
# Environments
133+
.env
134+
.venv
135+
env/
136+
venv/
137+
ENV/
138+
env.bak/
139+
venv.bak/
140+
141+
# Spyder project settings
142+
.spyderproject
143+
.spyproject
144+
145+
# Rope project settings
146+
.ropeproject
147+
148+
# mkdocs documentation
149+
/site
150+
151+
# mypy
152+
.mypy_cache/
153+
.dmypy.json
154+
dmypy.json
155+
156+
# Pyre type checker
157+
.pyre/
158+
159+
160+
#
161+
# Local variables:
162+
# tab-width: 4
163+
# c-basic-offset: 4
164+
# End:
165+
# vim600: expandtab sw=4 ts=4 fdm=marker
166+
# vim<600: expandtab sw=4 ts=4
167+
#

AUTHORS.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
=======
2+
Credits
3+
=======
4+
5+
Development Lead
6+
----------------
7+
8+
* Hirotaka Wakabayashi <hiwakaba@yahoo-corp.jp>
9+
10+
Contributors
11+
------------
12+
13+
* Takeshi Nakatani <ggtakec@gmail.com>

HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=======
2+
History
3+
=======
4+
5+
1.0.0 (2022-02-07)
6+
-------------------
7+
8+
* First release on PyPI.

0 commit comments

Comments
 (0)