Skip to content

Commit 066c9c5

Browse files
committed
move package to src dir
1 parent 773f78e commit 066c9c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+69
-68
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,39 @@ on:
1111
- cron: "0 0 * * *"
1212

1313
jobs:
14-
test-linux:
14+
coverage:
1515
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
python-version: [3.7, 3.8, 3.9]
1916
steps:
2017
- uses: actions/checkout@v2
2118
- uses: nanasess/setup-chromedriver@master
2219
- uses: actions/setup-node@v2-beta
2320
with:
2421
node-version: "12"
25-
- name: Use Python ${{ matrix.python-version }}
22+
- name: Use Latest Python
2623
uses: actions/setup-python@v2
2724
with:
28-
python-version: ${{ matrix.python-version }}
25+
python-version: 3.9
2926
- name: Install Python Dependencies
3027
run: pip install -r requirements/test-run.txt
3128
- name: Run Tests
3229
run: |
3330
nox -s test -- pytest[--headless]
34-
test-other-systems:
31+
matrix:
3532
runs-on: ${{ matrix.os }}
3633
strategy:
37-
fail-fast: false
3834
matrix:
39-
os: [ macos-latest, windows-latest ]
35+
python-version: [3.7, 3.8, 3.9]
36+
os: [ubuntu-latest, macos-latest, windows-latest]
4037
steps:
4138
- uses: actions/checkout@v2
4239
- uses: nanasess/setup-chromedriver@master
4340
- uses: actions/setup-node@v2-beta
4441
with:
4542
node-version: "12"
46-
- name: Use Python 3.9
43+
- name: Use Python ${{ matrix.python-version }}
4744
uses: actions/setup-python@v2
4845
with:
49-
python-version: 3.9
46+
python-version: ${{ matrix.python-version }}
5047
- name: Install Python Dependencies
5148
run: pip install -r requirements/test-run.txt
5249
- name: Run Tests

MANIFEST.in

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
recursive-include idom/client/app *
2-
recursive-exclude idom/client/app/node_modules *
3-
recursive-exclude idom/client/app/web_modules *
4-
recursive-exclude idom/client/build *
5-
include idom/py.typed
6-
include LICENSE
1+
recursive-include src/idom *
2+
recursive-exclude src/idom/client/app/node_modules *
3+
recursive-exclude src/idom/client/app/web_modules *
4+
recursive-exclude src/idom/client/build *
75
include requirements/prod.txt
86
include requirements/extras.txt
9-
include README.md
10-
include scripts/build.sh

noxfile.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,14 @@ def test_python(session: Session) -> None:
8787
"""Run the Python-based test suite"""
8888
session.env["IDOM_DEBUG_MODE"] = "1"
8989
session.install("-r", "requirements/test-env.txt")
90-
session.install(".[all]")
91-
args = ["pytest", "tests"] + get_posargs("pytest", session)
92-
session.run(*args)
90+
91+
pytest_args = get_posargs("pytest", session)
92+
if "--no-cov" in pytest_args:
93+
session.install(".[all]")
94+
else:
95+
session.install("-e", ".[all]")
96+
97+
session.run("pytest", "tests", *pytest_args)
9398

9499

95100
@nox.session
@@ -98,14 +103,14 @@ def test_types(session: Session) -> None:
98103
session.install("-r", "requirements/check-types.txt")
99104
session.install("-r", "requirements/pkg-deps.txt")
100105
session.install("-r", "requirements/pkg-extras.txt")
101-
session.run("mypy", "--strict", "idom")
106+
session.run("mypy", "--strict", "src/idom")
102107

103108

104109
@nox.session
105110
def test_style(session: Session) -> None:
106111
"""Check that style guidelines are being followed"""
107112
session.install("-r", "requirements/check-style.txt")
108-
session.run("flake8", "idom", "tests", "docs")
113+
session.run("flake8", "src/idom", "tests", "docs")
109114
black_default_exclude = r"\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist"
110115
session.run(
111116
"black",

scripts/__init__.py

Whitespace-only changes.

setup.cfg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ max-line-length = 88
1313
max-complexity = 18
1414
select = B,C,E,F,W,T4,B9,N,ROH
1515
exclude =
16-
idom/client/app/node_modules/*
16+
src/idom/client/app/node_modules/*
1717
.eggs/*
1818
.tox/*
1919

2020
[tool:pytest]
2121
testpaths = tests
2222
xfail_strict = True
23-
addopts = --cov=idom --cov-report term
23+
addopts = --cov=src/idom --cov-report term
2424
markers =
2525
slow: marks tests as slow (deselect with '-m "not slow"')
2626

@@ -30,11 +30,11 @@ show_missing = True
3030
skip_covered = True
3131
sort = Name
3232
exclude_lines =
33-
pragma: no cover
33+
coverage: skip
3434
\.\.\.
3535
raise NotImplementedError
3636
omit =
37-
idom/__main__.py
37+
src/idom/__main__.py
3838

3939
[build_sphinx]
4040
all-files = true

setup.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import print_function
22

3-
import os
43
import pipes
54
import shutil
65
import subprocess
@@ -9,6 +8,7 @@
98
from distutils import log
109
from distutils.command.build import build # type: ignore
1110
from distutils.command.sdist import sdist # type: ignore
11+
from pathlib import Path
1212

1313
from setuptools import find_packages, setup
1414
from setuptools.command.develop import develop
@@ -25,8 +25,9 @@ def list2cmdline(cmd_list):
2525
name = "idom"
2626

2727
# basic paths used to gather files
28-
here = os.path.abspath(os.path.dirname(__file__))
29-
root = os.path.join(here, name)
28+
root_dir = Path(__file__).parent
29+
src_dir = root_dir / "src"
30+
package_dir = src_dir / name
3031

3132

3233
# -----------------------------------------------------------------------------
@@ -37,7 +38,8 @@ def list2cmdline(cmd_list):
3738
package = {
3839
"name": name,
3940
"python_requires": ">=3.7",
40-
"packages": find_packages(exclude=["tests*"]),
41+
"packages": find_packages(str(src_dir)),
42+
"package_dir": {"": "src"},
4143
"description": "Control the web with Python",
4244
"author": "Ryan Morshead",
4345
"author_email": "ryan.morshead@gmail.com",
@@ -76,16 +78,16 @@ def list2cmdline(cmd_list):
7678

7779

7880
requirements = []
79-
with open(os.path.join(here, "requirements", "pkg-deps.txt"), "r") as f:
81+
with (root_dir / "requirements" / "pkg-deps.txt").open() as f:
8082
for line in map(str.strip, f):
8183
if not line.startswith("#"):
8284
requirements.append(line)
8385
package["install_requires"] = requirements
8486

8587
_current_extras = []
8688
extra_requirements = {"all": []} # type: ignore
87-
extra_requirements_path = os.path.join(here, "requirements", "pkg-extras.txt")
88-
with open(extra_requirements_path, "r") as f:
89+
extra_requirements_path = root_dir / "requirements" / "pkg-extras.txt"
90+
with extra_requirements_path.open() as f:
8991
for line in map(str.strip, f):
9092
if line.startswith("#") and line[1:].strip().startswith("extra="):
9193
_current_extras = [e.strip() for e in line.split("=", 1)[1].split(",")]
@@ -98,8 +100,9 @@ def list2cmdline(cmd_list):
98100
extra_requirements[e].append(line)
99101
extra_requirements["all"].append(line)
100102
elif line:
101-
msg = "No '# extra=<name>' header before requirements in %r"
102-
raise ValueError(msg % extra_requirements_path)
103+
raise ValueError(
104+
f"No '# extra=<name>' header before requirements in {extra_requirements_path}"
105+
)
103106
package["extras_require"] = extra_requirements
104107

105108

@@ -108,7 +111,7 @@ def list2cmdline(cmd_list):
108111
# -----------------------------------------------------------------------------
109112

110113

111-
with open(os.path.join(here, "README.md")) as f:
114+
with (root_dir / "README.md").open() as f:
112115
long_description = f.read()
113116

114117
package["long_description"] = long_description
@@ -125,7 +128,7 @@ class Command(cls):
125128
def run(self):
126129
log.info("Installing Javascript...")
127130
try:
128-
js_dir = os.path.join(root, "client", "app")
131+
js_dir = str(package_dir / "client" / "app")
129132
for cmd, *args in map(str.split, ["npm install", "npm run build"]):
130133
which_cmd = shutil.which(cmd)
131134
if which_cmd is None:

idom/__init__.py renamed to src/idom/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
try:
55
__version__: str = _get_distribution(__name__).version
6-
except _DistributionNotFound: # pragma: no cover
6+
except _DistributionNotFound: # coverage: skip
77
# package is not installed
88
__version__ = "0.0.0"
99

@@ -24,7 +24,7 @@
2424
import htm
2525
import pyalect
2626
import tagged
27-
except ImportError: # pragma: no cover
27+
except ImportError: # coverage: skip
2828
pass
2929
else:
3030
from . import dialect
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)