Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SNNafi committed Jul 8, 2024
0 parents commit 970bfe2
Show file tree
Hide file tree
Showing 45 changed files with 11,248 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build and test

on:
push:
branches:
- main
tags-ignore:
- "*"
paths:
- .github/**
- sqlite3_arabic_tokenizer/**
- src/**
- test/**
- Makefile
- setup.py
pull_request:
branches:
- main
workflow_dispatch:

jobs:
download-sources:
name: Download and store sources
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Download external sources
run: |
make prepare-src
make download-sqlite
make download-sqlite3_arabic_tokenizer
- name: Store sources
uses: actions/upload-artifact@v3
with:
name: sources
path: |
MANIFEST.in
Makefile
README.md
setup.cfg
setup.py
sqlite3_arabic_tokenizer
src
sqlite
test
test:
name: ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: download-sources
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Download sources
uses: actions/download-artifact@v3
with:
name: sources

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Build and run tests
env:
PYTHONPATH: ".:$PYTHONPATH"
run: |
make clean
python -m pip install --upgrade setuptools wheel
python setup.py build_ext -i
python -m test
115 changes: 115 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Publish to PyPI

on:
push:
tags:
- "*"
workflow_dispatch:

jobs:
download-sources:
name: Download and store sources
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Download external sources
run: |
make prepare-src
make download-sqlite
make download-sqlite3_arabic_tokenizer
- name: Store sources
uses: actions/upload-artifact@v3
with:
name: sources
path: |
MANIFEST.in
Makefile
README.md
setup.cfg
setup.py
sqlite3_arabic_tokenizer
src
sqlite
test
sdist:
name: Build sdist
runs-on: ubuntu-latest
needs: download-sources
steps:
- name: Download sources
uses: actions/download-artifact@v3
with:
name: sources

- name: Build sdist
run: pipx run build --sdist

- name: Store sdist
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

build:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: download-sources
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: Download sources
uses: actions/download-artifact@v3
with:
name: sources

# only initialize QEMU on Linux, other platforms don't need it
- name: Set up QEMU to add multiplatform support
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Build wheels
uses: pypa/[email protected]
env:
# architectures:
# - 64-bit linux (x86_64/i686/aarch64/ppc64le/s390x)
# - 64-bit windows (AMD64/x86/ARM64)
# - 64-bit macos (x86_64/arm64/universal2)
CIBW_ARCHS_LINUX: x86_64 aarch64
CIBW_ARCHS_WINDOWS: AMD64 ARM64
CIBW_ARCHS_MACOS: x86_64 arm64
# disable builds:
# - unsupported python versions
# - musllinux
# - pypy
CIBW_SKIP: "cp36-* cp37-* *-musllinux_* pp*"

- name: Store wheels
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

publish:
name: Publish to PyPI
needs: [build, sdist]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
permissions:
id-token: write
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
166 changes: 166 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Project specific stuff
sqlite/
wheelhouse/

# 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/
.idea/
.DS_Store
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2004-2007 Gerhard Häring, 2018+ Charles Leifer, 2024+ Shahriar Nasim Nafi

This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use
of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in
a product, an acknowledgment in the product documentation would be
appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.
11 changes: 11 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include MANIFEST.in
include README.md
include LICENSE
include setup.py
include src/*.h
include src/*.c

include sqlite/*.h
include sqlite/*.c

global-exclude *~ *.pyc
Loading

0 comments on commit 970bfe2

Please sign in to comment.