Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
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']
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
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
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Django #
logs
*.log
Expand Down Expand Up @@ -61,6 +60,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
Expand Down Expand Up @@ -125,4 +125,4 @@ GitHub.sublime-settings
%SystemDrive%

# Mac file system
.DS_Store
.DS_Store
17 changes: 0 additions & 17 deletions dj_idom/consumers.py

This file was deleted.

40 changes: 0 additions & 40 deletions dj_idom/static/scripts.js

This file was deleted.

17 changes: 0 additions & 17 deletions dj_idom/templates/base.html

This file was deleted.

75 changes: 75 additions & 0 deletions noxfile.py
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))
12 changes: 12 additions & 0 deletions pyproject.toml
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
8 changes: 4 additions & 4 deletions requirements.txt
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
3 changes: 3 additions & 0 deletions requirements/check-style.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
black
flake8
isort
2 changes: 2 additions & 0 deletions requirements/pkg-deps.txt
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
1 change: 1 addition & 0 deletions requirements/test-env.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
django
1 change: 1 addition & 0 deletions requirements/test-run.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nox
11 changes: 11 additions & 0 deletions setup.cfg
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/*
96 changes: 96 additions & 0 deletions setup.py
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)
5 changes: 5 additions & 0 deletions src/django_idom/__init__.py
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"]
Loading