Skip to content

Commit e937c92

Browse files
committed
organize for dist as pypi package
1 parent 182cbd6 commit e937c92

25 files changed

+230
-265
lines changed

dj_idom/asgi.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

dj_idom/consumers.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

dj_idom/settings.py

Lines changed: 0 additions & 131 deletions
This file was deleted.

dj_idom/static/scripts.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

dj_idom/templates/base.html

Lines changed: 0 additions & 17 deletions
This file was deleted.

dj_idom/urls.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

dj_idom/views.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

noxfile.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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 format(session: Session) -> None:
19+
install_requirements_file(session, "check-style")
20+
session.run("black", ".")
21+
session.run("isort", ".")
22+
23+
24+
@nox.session
25+
def test(session: Session) -> None:
26+
"""Run the complete test suite"""
27+
session.install("--upgrade", "pip", "setuptools", "wheel")
28+
test_suite(session)
29+
test_style(session)
30+
31+
32+
@nox.session
33+
def test_suite(session: Session) -> None:
34+
"""Run the Python-based test suite"""
35+
session.env["IDOM_DEBUG_MODE"] = "1"
36+
install_requirements_file(session, "test-env")
37+
session.install(".[all]")
38+
session.run("figure-it-out")
39+
40+
41+
@nox.session
42+
def test_style(session: Session) -> None:
43+
"""Check that style guidelines are being followed"""
44+
install_requirements_file(session, "check-style")
45+
session.run("flake8", "src/django_idom", "tests")
46+
black_default_exclude = r"\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist"
47+
session.run(
48+
"black",
49+
".",
50+
"--check",
51+
"--exclude",
52+
rf"/({black_default_exclude}|venv|node_modules)/",
53+
)
54+
session.run("isort", ".", "--check-only")
55+
56+
57+
def install_requirements_file(session: Session, name: str) -> None:
58+
file_path = HERE / "requirements" / (name + ".txt")
59+
assert file_path.exists(), f"requirements file {file_path} does not exist"
60+
session.install("-r", str(file_path))

pyproject.toml

Lines changed: 12 additions & 0 deletions
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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
django<4.0.0 # Django Library
2-
daphne<4.0.0 # Production ASGI webserver
3-
channels<4.0.0 # Django websocket features
4-
idom<1.0.0 # Python React
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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
black
2+
flake8
3+
isort

requirements/pkg-deps.txt

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
django<4.0.0 # Django Library
2+
daphne<4.0.0 # Production ASGI webserver

requirements/test-run.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nox

setup.cfg

Lines changed: 11 additions & 0 deletions
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)