-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e456db5
commit dd835ba
Showing
7 changed files
with
6,294 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow will upload a Python Package when a release is created | ||
|
||
|
||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
pip install .[dev] | ||
- name: Test with pytest | ||
run: | | ||
pip install pytest | ||
pytest | ||
- name: Build package | ||
run: python -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This workflow will run pytest only | ||
|
||
name: Run pytest | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install .[dev] | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
# handlebars-py | ||
handlebars.js transpiled to python with js2py | ||
[handlebars.js](https://github.com/handlebars-lang/handlebars.js) transpiled to python with [js2py](https://github.com/PiotrDabkowski/Js2Py) | ||
|
||
## Usage | ||
```python | ||
#!pip install handlebars | ||
from handlebars import Handlebars | ||
template = Handlebars.compile( "Name: {{name}}" ) | ||
template({ "name": "Jane" }) | ||
# returns: 'Name: Jane' | ||
``` | ||
|
||
|
||
## Development | ||
```bash | ||
pip install -e .[dev] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=61.0.0", | ||
"setuptools-scm>=8.0", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "handlebars" | ||
dynamic = ["version"] | ||
description = "handlebars.js transpiled to python with js2py" | ||
readme = "README.md" | ||
authors = [ | ||
{ name = "Simon Stier", email = 'simon.stier@gmx.de' }, | ||
{ name = "handlebars.js contributors" } | ||
] | ||
maintainers = [ | ||
{ name = "Simon Stier", email = 'simon.stier@gmx.de' } | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"License :: OSI Approved :: MIT License", | ||
] | ||
dependencies = [ | ||
"js2py", | ||
] | ||
[project.optional-dependencies] | ||
dev = [ | ||
"pytest", | ||
"requests", | ||
] | ||
|
||
[project.license] | ||
file = "LICENSE" | ||
|
||
[project.urls] | ||
"Homepage" = "https://github.com/opensemanticworld/handlebars-py" | ||
"Bug Tracker" = "https://github.com/opensemanticworld/handlebars-py" | ||
|
||
[tool.ruff] | ||
include = ["src/*.py", "tests/*.py"] | ||
select = [ | ||
"E", # pycodestyle | ||
"W", # pycodestyle | ||
"PL", # pylint | ||
] | ||
ignore = [ | ||
"E501", # Line too long ({width} > {limit} characters) | ||
"E701", # Multiple statements on one line (colon) | ||
"E731", # Do not assign a lambda expression, use a def | ||
"E402", # Module level import not at top of file | ||
"PLR0911", # Too many return statements | ||
"PLR0912", # Too many branches | ||
"PLR0913", # Too many arguments in function definition | ||
"PLR0915", # Too many statements | ||
"PLR2004", # Magic value used instead of constant | ||
"PLW0603", # Using the global statement | ||
"PLW2901", # redefined-loop-name | ||
"PLR1714", # consider-using-in | ||
"PLR5501", # else-if-used | ||
] | ||
fixable = ["ALL"] | ||
exclude = ["dependencies"] | ||
|
||
# Same as Black. | ||
line-length = 88 | ||
indent-width = 4 | ||
|
||
[tool.ruff.format] | ||
# use single quotes for strings. | ||
quote-style = "single" | ||
|
||
# indent with spaces, rather than tabs. | ||
indent-style = "space" | ||
|
||
# Like Black, respect magic trailing commas. | ||
skip-magic-trailing-comma = false | ||
|
||
# Like Black, automatically detect the appropriate line ending. | ||
line-ending = "auto" | ||
|
||
[tool.setuptools.packages.find] | ||
where = [ | ||
"src", | ||
] | ||
|
||
[tool.setuptools_scm] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .handlebars_js import handlebars_js | ||
Handlebars = handlebars_js.Handlebars | ||
|
Oops, something went wrong.