-
-
Notifications
You must be signed in to change notification settings - Fork 23
Django IDOM #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Django IDOM #1
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
07240ea
django startproject
Archmonger 5a03f82
barebones websocket consumer
Archmonger 1591eb1
create barebones http page
Archmonger 923276e
barebones unauthenticated websocket
Archmonger 182cbd6
remove unneeded pass
Archmonger 78369ea
organize for dist as pypi package
rmorshea 3cda81d
convert to building standard js app
rmorshea 7c76da0
setup CI
rmorshea edeadbe
minor fixes
rmorshea aa5b5e1
Merge pull request #1 from idom-team/archmonger
Archmonger e994b71
Update README.md
Archmonger aa36702
Update README.md
Archmonger b3e81d9
use npm latest
Archmonger 673cc07
settings clean up
Archmonger 3e454ec
add src dir to system path
Archmonger c31f4a0
fix flake8 errors
Archmonger 1d05e90
more style cleanup
Archmonger 6b64aa2
style cleanup 3
Archmonger 54af7c5
add basic test of IDOM
rmorshea d62e137
Merge branch 'main' into archmonger
rmorshea 2091408
fix rollup warning for this
rmorshea c377f3d
fix style issues
rmorshea 4e1a970
allow tests to run in headless mode in CI
rmorshea 4d440eb
Merge pull request #3 from idom-team/archmonger
Archmonger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,12 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [rmorshea] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains hidden or 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,8 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: Documentation | ||
url: https://idom-docs.herokuapp.com/ | ||
about: Refer to the documentation before starting a discussion | ||
- name: Community Support | ||
url: https://github.com/idom-team/idom/discussions | ||
about: Report issues, request features, and ask questions |
This file contains hidden or 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,34 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
test-python-versions: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: nanasess/setup-chromedriver@master | ||
- uses: actions/setup-node@v2-beta | ||
with: | ||
node-version: "14" | ||
- name: Use Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Python Dependencies | ||
run: pip install -r requirements/test-run.txt | ||
- name: Run Tests | ||
run: | | ||
npm install -g npm@v7.13.0 | ||
nox -s test |
This file contains hidden or 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,128 @@ | ||
# Django # | ||
logs | ||
*.log | ||
*.pot | ||
*.pyc | ||
.dccachea | ||
__pycache__ | ||
db.sqlite3 | ||
media | ||
cache | ||
static-deploy | ||
data | ||
settings.json | ||
|
||
# Backup files # | ||
*.bak | ||
|
||
# If you are using PyCharm # | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/dictionaries | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.xml | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
*.iws /out/ | ||
|
||
# Python # | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Distribution / packaging | ||
.Python build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
.pytest_cache/ | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery | ||
celerybeat-schedule.* | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# Sublime Text # | ||
*.tmlanguage.cache | ||
*.tmPreferences.cache | ||
*.stTheme.cache | ||
*.sublime-workspace | ||
*.sublime-project | ||
|
||
# sftp configuration file | ||
sftp-config.json | ||
|
||
# Package control specific files Package | ||
Control.last-run | ||
Control.ca-list | ||
Control.ca-bundle | ||
Control.system-ca-bundle | ||
GitHub.sublime-settings | ||
|
||
# Visual Studio Code # | ||
.vscode | ||
.vscode/* | ||
.vscode/settings.json | ||
.vscode/tasks.json | ||
.vscode/launch.json | ||
.vscode/extensions.json | ||
.history | ||
%SystemDrive% | ||
|
||
# Mac file system | ||
.DS_Store |
This file contains hidden or 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,3 +1,52 @@ | ||
# Django IDOM | ||
|
||
Support for IDOM in Django | ||
<a href="https://github.com/idom-team/django-idom/actions?query=workflow%3ATest"> | ||
<img alt="Tests" src="https://github.com/idom-team/django-idom/workflows/Test/badge.svg?event=push" /> | ||
</a> | ||
<a href="https://pypi.python.org/pypi/django-idom"> | ||
<img alt="Version Info" src="https://img.shields.io/pypi/v/idom.svg"/> | ||
</a> | ||
<a href="https://github.com/idom-team/django-idom/blob/main/LICENSE"> | ||
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-purple.svg"> | ||
</a> | ||
|
||
A package for building highly interactive user interfaces in pure Python inspired by | ||
[ReactJS](https://reactjs.org/). | ||
|
||
**Be sure to [read the IDOM Documentation](https://idom-docs.herokuapp.com)!** | ||
|
||
If you have ideas or find a bug, be sure to post an | ||
[issue](https://github.com/idom-team/django-idom/issues) | ||
or create a | ||
[pull request](https://github.com/idom-team/django-idom/pulls). Thanks in advance! | ||
|
||
<h3> | ||
<a | ||
target="_blank" | ||
href="https://mybinder.org/v2/gh/idom-team/idom-jupyter/main?filepath=notebooks%2Fintroduction.ipynb" | ||
> | ||
Try it Now | ||
<img alt="Binder" valign="bottom" height="25px" | ||
src="https://mybinder.org/badge_logo.svg" | ||
/> | ||
</a> | ||
</h3> | ||
|
||
Click the badge above to get started! It will take you to a [Jupyter Notebooks](https://jupyter.org/) | ||
hosted by [Binder](https://mybinder.org/) with some great examples. | ||
|
||
### Or Install it Now | ||
|
||
```bash | ||
pip install django-idom | ||
``` | ||
|
||
# Django Integration | ||
|
||
This version of IDOM can be directly integrated into Django. For example | ||
|
||
```python | ||
# Example code goes here | ||
``` | ||
|
||
For examples on how to use IDOM, [read the IDOM Documentation](https://idom-docs.herokuapp.com). |
This file contains hidden or 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,75 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
import re | ||
import subprocess | ||
from pathlib import Path | ||
from typing import List, Tuple | ||
|
||
import nox | ||
from nox.sessions import Session | ||
|
||
|
||
HERE = Path(__file__).parent | ||
POSARGS_PATTERN = re.compile(r"^(\w+)\[(.+)\]$") | ||
|
||
|
||
@nox.session(reuse_venv=True) | ||
def manage(session: Session) -> None: | ||
session.install("-r", "requirements.txt") | ||
session.install("idom[stable]") | ||
session.install("-e", ".") | ||
session.chdir("tests") | ||
|
||
build_js_on_commands = ["runserver"] | ||
if set(session.posargs).intersection(build_js_on_commands): | ||
session.run("python", "manage.py", "build_js") | ||
|
||
session.run("python", "manage.py", *session.posargs) | ||
|
||
|
||
@nox.session(reuse_venv=True) | ||
def format(session: Session) -> None: | ||
install_requirements_file(session, "check-style") | ||
session.run("black", ".") | ||
session.run("isort", ".") | ||
|
||
|
||
@nox.session | ||
def test(session: Session) -> None: | ||
"""Run the complete test suite""" | ||
session.install("--upgrade", "pip", "setuptools", "wheel") | ||
session.notify("test_suite") | ||
session.notify("test_style") | ||
|
||
|
||
@nox.session | ||
def test_suite(session: Session) -> None: | ||
"""Run the Python-based test suite""" | ||
session.env["IDOM_DEBUG_MODE"] = "1" | ||
install_requirements_file(session, "test-env") | ||
session.install(".[all]") | ||
session.chdir("tests") | ||
session.run("figure-it-out") | ||
|
||
|
||
@nox.session | ||
def test_style(session: Session) -> None: | ||
"""Check that style guidelines are being followed""" | ||
install_requirements_file(session, "check-style") | ||
session.run("flake8", "src/django_idom", "tests") | ||
black_default_exclude = r"\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist" | ||
session.run( | ||
"black", | ||
".", | ||
"--check", | ||
"--exclude", | ||
rf"/({black_default_exclude}|venv|node_modules)/", | ||
) | ||
session.run("isort", ".", "--check-only") | ||
|
||
|
||
def install_requirements_file(session: Session, name: str) -> None: | ||
file_path = HERE / "requirements" / (name + ".txt") | ||
assert file_path.exists(), f"requirements file {file_path} does not exist" | ||
session.install("-r", str(file_path)) |
This file contains hidden or 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,12 @@ | ||
[build-system] | ||
requires = ["setuptools>=42", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.isort] | ||
multi_line_output = 3 | ||
force_grid_wrap = 0 | ||
use_parentheses = "True" | ||
ensure_newline_before_comments = "True" | ||
include_trailing_comma = "True" | ||
line_length = 88 | ||
lines_after_imports = 2 |
This file contains hidden or 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,4 @@ | ||
-r requirements/pkg-deps.txt | ||
-r requirements/check-style.txt | ||
-r requirements/test-env.txt | ||
-r requirements/test-run.txt |
This file contains hidden or 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 @@ | ||
black | ||
flake8 | ||
isort |
This file contains hidden or 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,2 @@ | ||
channels<4.0.0 # Django websocket features | ||
idom<1.0.0 # Python React |
This file contains hidden or 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 @@ | ||
django |
This file contains hidden or 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 @@ | ||
nox |
This file contains hidden or 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,11 @@ | ||
[bdist_wheel] | ||
universal=1 | ||
|
||
[flake8] | ||
ignore = E203, E266, E501, W503, F811, N802 | ||
max-line-length = 88 | ||
max-complexity = 18 | ||
select = B,C,E,F,W,T4,B9,N,ROH | ||
exclude = | ||
.eggs/* | ||
.nox/* |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.