From f9e7914e62e110a20697d100273d316635c9ae9d Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 11 Sep 2022 12:53:27 -0500 Subject: [PATCH 1/3] refactor!: Move to src/ layout --- {g => src/g}/__about__.py | 0 {g => src/g}/__init__.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {g => src/g}/__about__.py (100%) rename {g => src/g}/__init__.py (100%) diff --git a/g/__about__.py b/src/g/__about__.py similarity index 100% rename from g/__about__.py rename to src/g/__about__.py diff --git a/g/__init__.py b/src/g/__init__.py similarity index 100% rename from g/__init__.py rename to src/g/__init__.py From 67bc6b1ac193b7b50e287d50d304ce4e995d5f54 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 11 Sep 2022 13:09:53 -0500 Subject: [PATCH 2/3] ci: Update configs for src/ layout --- docs/conf.py | 11 +++++++---- pyproject.toml | 2 +- setup.cfg | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ef4d27c..63f565c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,13 +11,14 @@ # Get the project root dir, which is the parent dir of this cwd = Path(__file__).parent project_root = cwd.parent +src_root = project_root / "src" -sys.path.insert(0, str(project_root)) +sys.path.insert(0, str(src_root)) sys.path.insert(0, str(cwd / "_ext")) # package data about: t.Dict[str, str] = {} -with open(project_root / "g" / "__about__.py") as fp: +with open(src_root / "g" / "__about__.py") as fp: exec(fp.read(), about) extensions = [ @@ -210,16 +211,18 @@ def linkcode_resolve( fn = relpath(fn, start=dirname(g.__file__)) if "dev" in about["__version__"]: - return "{}/blob/master/{}/{}{}".format( + return "{}/blob/master/{}/{}/{}{}".format( about["__github__"], + "src", about["__package_name__"], fn, linespec, ) else: - return "{}/blob/v{}/{}/{}{}".format( + return "{}/blob/v{}/{}/{}/{}{}".format( about["__github__"], about["__version__"], + "src", about["__package_name__"], fn, linespec, diff --git a/pyproject.toml b/pyproject.toml index 7115459..8ef5cd9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ "Topic :: System :: Shells", ] packages = [ - { include = "g" }, + { include = "*", from = "src" }, ] include = [ { path = "tests", format = "sdist" }, diff --git a/setup.cfg b/setup.cfg index 14ee22b..4b77fef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [flake8] -exclude = .*/,.tox,*.egg,g/__*__.py, +exclude = .*/,.tox,*.egg,src/g/__*__.py, select = E,W,F,N max-line-length = 88 # Stuff we ignore thanks to black: https://github.com/ambv/black/issues/429 @@ -20,6 +20,6 @@ line_length = 88 addopts = --tb=short --no-header --showlocals --doctest-modules doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE testpaths = - g + src/g tests docs From 9bab096fc06c80f2a7924b769fae6f18bd90f51c Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 11 Sep 2022 15:40:13 -0500 Subject: [PATCH 3/3] docs(CHANGES): Note change to src/ layout --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 03c255e..b194706 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ $ pipx install --suffix=@next g --pip-args '\--pre' --force ### Development +- Move to `src/` layout (#7) - Add [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) (#4) - Add [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) (#5)