Skip to content

Commit 9e8d39d

Browse files
authored
refactor!: Move to src/ layout (#7)
2 parents 2ddda7b + 9bab096 commit 9e8d39d

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ $ pipx install --suffix=@next g --pip-args '\--pre' --force
2121

2222
### Development
2323

24+
- Move to `src/` layout (#7)
2425
- Add [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) (#4)
2526
- Add [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) (#5)
2627

docs/conf.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
# Get the project root dir, which is the parent dir of this
1212
cwd = Path(__file__).parent
1313
project_root = cwd.parent
14+
src_root = project_root / "src"
1415

15-
sys.path.insert(0, str(project_root))
16+
sys.path.insert(0, str(src_root))
1617
sys.path.insert(0, str(cwd / "_ext"))
1718

1819
# package data
1920
about: t.Dict[str, str] = {}
20-
with open(project_root / "g" / "__about__.py") as fp:
21+
with open(src_root / "g" / "__about__.py") as fp:
2122
exec(fp.read(), about)
2223

2324
extensions = [
@@ -210,16 +211,18 @@ def linkcode_resolve(
210211
fn = relpath(fn, start=dirname(g.__file__))
211212

212213
if "dev" in about["__version__"]:
213-
return "{}/blob/master/{}/{}{}".format(
214+
return "{}/blob/master/{}/{}/{}{}".format(
214215
about["__github__"],
216+
"src",
215217
about["__package_name__"],
216218
fn,
217219
linespec,
218220
)
219221
else:
220-
return "{}/blob/v{}/{}/{}{}".format(
222+
return "{}/blob/v{}/{}/{}/{}{}".format(
221223
about["__github__"],
222224
about["__version__"],
225+
"src",
223226
about["__package_name__"],
224227
fn,
225228
linespec,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ classifiers = [
2121
"Topic :: System :: Shells",
2222
]
2323
packages = [
24-
{ include = "g" },
24+
{ include = "*", from = "src" },
2525
]
2626
include = [
2727
{ path = "tests", format = "sdist" },

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
exclude = .*/,.tox,*.egg,g/__*__.py,
2+
exclude = .*/,.tox,*.egg,src/g/__*__.py,
33
select = E,W,F,N
44
max-line-length = 88
55
# Stuff we ignore thanks to black: https://github.com/ambv/black/issues/429
@@ -20,6 +20,6 @@ line_length = 88
2020
addopts = --tb=short --no-header --showlocals --doctest-modules
2121
doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
2222
testpaths =
23-
g
23+
src/g
2424
tests
2525
docs
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)