Skip to content

Commit ff7ec1c

Browse files
authored
Merge pull request #1 from Archmonger/main
initial implementation for django-idom at some point we should push the work in test_app back into django_idom so that it's easier to integrate with
2 parents f9de3ec + 4d440eb commit ff7ec1c

35 files changed

+1482
-1
lines changed

.github/FUNDING.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: [rmorshea]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/ISSUE_TEMPLATE/config.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Documentation
4+
url: https://idom-docs.herokuapp.com/
5+
about: Refer to the documentation before starting a discussion
6+
- name: Community Support
7+
url: https://github.com/idom-team/idom/discussions
8+
about: Report issues, request features, and ask questions

.github/workflows/test.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: "0 0 * * *"
12+
13+
jobs:
14+
test-python-versions:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [3.7, 3.8, 3.9]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- uses: nanasess/setup-chromedriver@master
22+
- uses: actions/setup-node@v2-beta
23+
with:
24+
node-version: "14"
25+
- name: Use Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install Python Dependencies
30+
run: pip install -r requirements/test-run.txt
31+
- name: Run Tests
32+
run: |
33+
npm install -g npm@latest
34+
npm --version
35+
nox -s test -- --headless

.gitignore

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Django #
2+
logs
3+
*.log
4+
*.pot
5+
*.pyc
6+
.dccachea
7+
__pycache__
8+
db.sqlite3
9+
media
10+
cache
11+
static-deploy
12+
data
13+
settings.json
14+
15+
# Backup files #
16+
*.bak
17+
18+
# If you are using PyCharm #
19+
.idea/**/workspace.xml
20+
.idea/**/tasks.xml
21+
.idea/dictionaries
22+
.idea/**/dataSources/
23+
.idea/**/dataSources.ids
24+
.idea/**/dataSources.xml
25+
.idea/**/dataSources.local.xml
26+
.idea/**/sqlDataSources.xml
27+
.idea/**/dynamic.xml
28+
.idea/**/uiDesigner.xml
29+
.idea/**/gradle.xml
30+
.idea/**/libraries
31+
*.iws /out/
32+
33+
# Python #
34+
*.py[cod]
35+
*$py.class
36+
37+
# Distribution / packaging
38+
.Python build/
39+
develop-eggs/
40+
dist/
41+
downloads/
42+
eggs/
43+
.eggs/
44+
lib/
45+
lib64/
46+
parts/
47+
sdist/
48+
var/
49+
wheels/
50+
*.egg-info/
51+
.installed.cfg
52+
*.egg
53+
*.manifest
54+
*.spec
55+
56+
# Installer logs
57+
pip-log.txt
58+
pip-delete-this-directory.txt
59+
60+
# Unit test / coverage reports
61+
htmlcov/
62+
.tox/
63+
.nox/
64+
.coverage
65+
.coverage.*
66+
.cache
67+
.pytest_cache/
68+
nosetests.xml
69+
coverage.xml
70+
*.cover
71+
.hypothesis/
72+
73+
# Jupyter Notebook
74+
.ipynb_checkpoints
75+
76+
# pyenv
77+
.python-version
78+
79+
# celery
80+
celerybeat-schedule.*
81+
82+
# SageMath parsed files
83+
*.sage.py
84+
85+
# Environments
86+
.env
87+
.venv
88+
env/
89+
venv/
90+
ENV/
91+
env.bak/
92+
venv.bak/
93+
94+
# mkdocs documentation
95+
/site
96+
97+
# mypy
98+
.mypy_cache/
99+
100+
# Sublime Text #
101+
*.tmlanguage.cache
102+
*.tmPreferences.cache
103+
*.stTheme.cache
104+
*.sublime-workspace
105+
*.sublime-project
106+
107+
# sftp configuration file
108+
sftp-config.json
109+
110+
# Package control specific files Package
111+
Control.last-run
112+
Control.ca-list
113+
Control.ca-bundle
114+
Control.system-ca-bundle
115+
GitHub.sublime-settings
116+
117+
# Visual Studio Code #
118+
.vscode
119+
.vscode/*
120+
.vscode/settings.json
121+
.vscode/tasks.json
122+
.vscode/launch.json
123+
.vscode/extensions.json
124+
.history
125+
%SystemDrive%
126+
127+
# Mac file system
128+
.DS_Store

README.md

+50-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
11
# Django IDOM
22

3-
Support for IDOM in Django
3+
<a href="https://github.com/idom-team/django-idom/actions?query=workflow%3ATest">
4+
<img alt="Tests" src="https://github.com/idom-team/django-idom/workflows/Test/badge.svg?event=push" />
5+
</a>
6+
<a href="https://pypi.python.org/pypi/django-idom">
7+
<img alt="Version Info" src="https://img.shields.io/pypi/v/idom.svg"/>
8+
</a>
9+
<a href="https://github.com/idom-team/django-idom/blob/main/LICENSE">
10+
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-purple.svg">
11+
</a>
12+
13+
A package for building highly interactive user interfaces in pure Python inspired by
14+
[ReactJS](https://reactjs.org/).
15+
16+
**Be sure to [read the IDOM Documentation](https://idom-docs.herokuapp.com)!**
17+
18+
If you have ideas or find a bug, be sure to post an
19+
[issue](https://github.com/idom-team/django-idom/issues)
20+
or create a
21+
[pull request](https://github.com/idom-team/django-idom/pulls). Thanks in advance!
22+
23+
<h3>
24+
<a
25+
target="_blank"
26+
href="https://mybinder.org/v2/gh/idom-team/idom-jupyter/main?filepath=notebooks%2Fintroduction.ipynb"
27+
>
28+
Try it Now
29+
<img alt="Binder" valign="bottom" height="25px"
30+
src="https://mybinder.org/badge_logo.svg"
31+
/>
32+
</a>
33+
</h3>
34+
35+
Click the badge above to get started! It will take you to a [Jupyter Notebooks](https://jupyter.org/)
36+
hosted by [Binder](https://mybinder.org/) with some great examples.
37+
38+
### Or Install it Now
39+
40+
```bash
41+
pip install django-idom
42+
```
43+
44+
# Django Integration
45+
46+
This version of IDOM can be directly integrated into Django. For example
47+
48+
```python
49+
# Example code goes here
50+
```
51+
52+
For examples on how to use IDOM, [read the IDOM Documentation](https://idom-docs.herokuapp.com).

noxfile.py

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
from __future__ import annotations
2+
3+
import os
4+
import re
5+
import subprocess
6+
from pathlib import Path
7+
from typing import List, Tuple
8+
9+
import nox
10+
from nox.sessions import Session
11+
12+
13+
HERE = Path(__file__).parent
14+
POSARGS_PATTERN = re.compile(r"^(\w+)\[(.+)\]$")
15+
16+
17+
@nox.session(reuse_venv=True)
18+
def manage(session: Session) -> None:
19+
session.install("-r", "requirements.txt")
20+
session.install("idom[stable]")
21+
session.install("-e", ".")
22+
session.chdir("tests")
23+
24+
build_js_on_commands = ["runserver"]
25+
if set(session.posargs).intersection(build_js_on_commands):
26+
session.run("python", "manage.py", "build_js")
27+
28+
session.run("python", "manage.py", *session.posargs)
29+
30+
31+
@nox.session(reuse_venv=True)
32+
def format(session: Session) -> None:
33+
install_requirements_file(session, "check-style")
34+
session.run("black", ".")
35+
session.run("isort", ".")
36+
37+
38+
@nox.session
39+
def test(session: Session) -> None:
40+
"""Run the complete test suite"""
41+
session.install("--upgrade", "pip", "setuptools", "wheel")
42+
session.notify("test_suite", posargs=session.posargs)
43+
session.notify("test_style")
44+
45+
46+
@nox.session
47+
def test_suite(session: Session) -> None:
48+
"""Run the Python-based test suite"""
49+
install_requirements_file(session, "test-env")
50+
session.install(".[all]")
51+
52+
session.chdir(HERE / "tests")
53+
session.env["IDOM_DEBUG_MODE"] = "1"
54+
session.env["SELENIUM_HEADLESS"] = str(int("--headless" in session.posargs))
55+
session.run("python", "manage.py", "build_js")
56+
session.run("python", "manage.py", "test")
57+
58+
59+
@nox.session
60+
def test_style(session: Session) -> None:
61+
"""Check that style guidelines are being followed"""
62+
install_requirements_file(session, "check-style")
63+
session.run("flake8", "src/django_idom", "tests")
64+
black_default_exclude = r"\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist"
65+
session.run(
66+
"black",
67+
".",
68+
"--check",
69+
"--exclude",
70+
rf"/({black_default_exclude}|venv|node_modules)/",
71+
)
72+
session.run("isort", ".", "--check-only")
73+
74+
75+
def install_requirements_file(session: Session, name: str) -> None:
76+
file_path = HERE / "requirements" / (name + ".txt")
77+
assert file_path.exists(), f"requirements file {file_path} does not exist"
78+
session.install("-r", str(file_path))

pyproject.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.isort]
6+
multi_line_output = 3
7+
force_grid_wrap = 0
8+
use_parentheses = "True"
9+
ensure_newline_before_comments = "True"
10+
include_trailing_comma = "True"
11+
line_length = 88
12+
lines_after_imports = 2

requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r requirements/pkg-deps.txt
2+
-r requirements/check-style.txt
3+
-r requirements/test-env.txt
4+
-r requirements/test-run.txt

requirements/check-style.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
black
2+
flake8
3+
isort

requirements/pkg-deps.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
channels<4.0.0 # Django websocket features
2+
idom<1.0.0 # Python React

requirements/test-env.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
django
2+
selenium
3+
4+
# required due issue with channels:
5+
# https://github.com/django/channels/issues/1639#issuecomment-817994671
6+
twisted<21

requirements/test-run.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nox

setup.cfg

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[bdist_wheel]
2+
universal=1
3+
4+
[flake8]
5+
ignore = E203, E266, E501, W503, F811, N802
6+
max-line-length = 88
7+
max-complexity = 18
8+
select = B,C,E,F,W,T4,B9,N,ROH
9+
exclude =
10+
.eggs/*
11+
.nox/*

0 commit comments

Comments
 (0)