Skip to content

Commit

Permalink
Add smart_jit @jit decorator (#1)
Browse files Browse the repository at this point in the history
* Adding files from guilhermeleobas/numba#2

* update test.yml

* yaml -> yml

* install package with pip

* update test.yml

* = -> ==

* install pytest

* Fix for Numba < 0.56

* rename @smart_jit -> @jit

* add example.py and update README.md

* flake8
  • Loading branch information
guilhermeleobas authored May 11, 2023
1 parent ba3e832 commit 4ff224c
Show file tree
Hide file tree
Showing 17 changed files with 1,292 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Install flit
run: pip install flit

- name: Build
run: flit build

- name: Publish to PyPI
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
flit publish
- name: Create a GitHub Release
id: create_release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
allowUpdates: true
replacesArtifacts: true
tag: ${{ github.event.release.tag_name }}
name: Release ${{ github.event.release.tag_name }}
commit: main
body: Release ${{ github.event.release.tag_name }}
token: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Numba-smartjit

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
pull_request:
branches:
- main

# kill any previous running job on a new commit
concurrency:
group: build-and-test-smartjit-${{ github.head_ref }}
cancel-in-progress: true

jobs:
lint:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2

- name: Install flake8
run: |
pip install flake8
- name: Lint:flake8
run: |
flake8 .
test:
name: ${{ matrix.os }} - Numba v${{matrix.numba-version}} - Python v${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.10', '3.9', '3.8', '3.7']
numba-version: ['0.56', '0.55']
include:
- os: ubuntu-latest
python-version: '3.11'
numba-version: '0.57'

needs: lint

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: pip install Numba ${{ matrix.numba-version }}
run: |
pip install numba==${{ matrix.numba-version }} pytest
- name: Run tests
shell: bash -l {0}
env:
EXPECTED_PYTHON_VERSION: ${{ matrix.python-version }}
EXPECTED_NUMBA_VERSION: ${{ matrix.numba-version }}
run: |
pytest -sv -r A tests/ -x
116 changes: 116 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
*~
# 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/
*.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/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
doc/_build
doc/generated

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# 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/

# PyCharm
.idea/

# macos
.DS_Store

# vscode
.vscode/
File renamed without changes.
Loading

0 comments on commit 4ff224c

Please sign in to comment.