-
- 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 5 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
django<4.0.0 # Django Library | ||
daphne<4.0.0 # Production ASGI webserver | ||
channels<4.0.0 # Django websocket features | ||
idom<1.0.0 # Python React | ||
-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/* |
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,96 @@ | ||
import os | ||
import sys | ||
from pathlib import Path | ||
| ||
from setuptools import find_packages, setup | ||
| ||
| ||
# the name of the project | ||
name = "django_idom" | ||
| ||
# basic paths used to gather files | ||
root_dir = Path(__file__).parent | ||
src_dir = root_dir / "src" | ||
package_dir = src_dir / name | ||
| ||
| ||
# ----------------------------------------------------------------------------- | ||
# Package Definition | ||
# ----------------------------------------------------------------------------- | ||
| ||
| ||
package = { | ||
"name": name, | ||
"python_requires": ">=3.7", | ||
"packages": find_packages(str(src_dir)), | ||
"package_dir": {"": "src"}, | ||
"description": "Control the web with Python", | ||
"author": "Ryan Morshead", | ||
"author_email": "ryan.morshead@gmail.com", | ||
"url": "https://github.com/idom-team/django-idom", | ||
"license": "MIT", | ||
"platforms": "Linux, Mac OS X, Windows", | ||
"keywords": ["interactive", "widgets", "DOM", "React"], | ||
"zip_safe": False, | ||
"classifiers": [ | ||
"Framework :: Django", | ||
"Framework :: Django :: 3.1", | ||
"Framework :: Django :: 3.2", | ||
"Operating System :: OS Independent", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Multimedia :: Graphics", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Environment :: Web Environment", | ||
], | ||
} | ||
| ||
| ||
# ----------------------------------------------------------------------------- | ||
# Library Version | ||
# ----------------------------------------------------------------------------- | ||
| ||
with open(os.path.join(package_dir, "__init__.py")) as f: | ||
for line in f.read().split("\n"): | ||
if line.startswith("__version__ = "): | ||
package["version"] = eval(line.split("=", 1)[1]) | ||
break | ||
else: | ||
print("No version found in %s/__init__.py" % package_dir) | ||
sys.exit(1) | ||
| ||
| ||
# ----------------------------------------------------------------------------- | ||
# Requirements | ||
# ----------------------------------------------------------------------------- | ||
| ||
| ||
requirements = [] | ||
with (root_dir / "requirements" / "pkg-deps.txt").open() as f: | ||
for line in map(str.strip, f): | ||
if not line.startswith("#"): | ||
requirements.append(line) | ||
package["install_requires"] = requirements | ||
| ||
| ||
# ----------------------------------------------------------------------------- | ||
# Library Description | ||
# ----------------------------------------------------------------------------- | ||
| ||
| ||
with (root_dir / "README.md").open() as f: | ||
long_description = f.read() | ||
| ||
package["long_description"] = long_description | ||
package["long_description_content_type"] = "text/markdown" | ||
| ||
| ||
# ----------------------------------------------------------------------------- | ||
# Install It | ||
# ----------------------------------------------------------------------------- | ||
| ||
| ||
if __name__ == "__main__": | ||
setup(**package) |
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,5 @@ | ||
__version__ = "0.0.1" | ||
| ||
from .websocket_consumer import IdomAsyncWebSocketConsumer | ||
| ||
__all__ = ["IdomAsyncWebSocketConsumer"] |
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.