Skip to content

Commit

Permalink
Convert project to use a src layout
Browse files Browse the repository at this point in the history
see #18
  • Loading branch information
bdraco committed Oct 6, 2024
1 parent fd4f135 commit 783d13e
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ error_summary = true
files =
packaging/,
tests/,
propcache/
src/propcache/

# check_untyped_defs = true

Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PYXS = $(wildcard propcache/*.pyx)
PYXS = $(wildcard src/propcache/*.pyx)
SRC = propcache tests

all: test
Expand All @@ -15,8 +15,8 @@ all: test
touch .install-cython


propcache/%.c: propcache/%.pyx
python -m cython -3 -o $@ $< -I propcache
src/propcache/%.c: src/propcache/%.pyx
python -m cython -3 -o $@ $< -I src/propcache


.cythonize: .install-cython $(PYXS:.pyx=.c)
Expand All @@ -25,7 +25,7 @@ propcache/%.c: propcache/%.pyx
cythonize: .cythonize


.develop: .install-deps $(shell find propcache -type f)
.develop: .install-deps $(shell find src/propcache -type f)
@pip install -e .
@touch .develop

Expand All @@ -39,15 +39,15 @@ endif
lint: fmt

test: lint .develop
pytest ./tests ./propcache
pytest ./tests ./src/propcache


vtest: lint .develop
pytest ./tests ./propcache -v
pytest ./tests ./src/propcache -v


cov: lint .develop
pytest --cov propcache --cov-report html --cov-report term ./tests/ ./propcache/
pytest --cov src/propcache --cov-report html --cov-report term ./tests/ ./src/propcache/
@echo "open file://`pwd`/htmlcov/index.html"


Expand Down
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@


_docs_path = Path(__file__).parent
_version_path = _docs_path / "../propcache/__init__.py"

_version_path = _docs_path / "../src/propcache/__init__.py"

with _version_path.open() as fp:
try:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build-backend = "pep517_backend.hooks" # wraps `setuptools.build_meta`

[tool.local.cythonize]
# This attr can contain multiple globs
src = ["propcache/*.pyx"]
src = ["src/propcache/*.pyx"]

[tool.local.cythonize.env]
# Env vars provisioned during cythonize call
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@ norecursedirs =

testpaths = tests/

pythonpath = src

xfail_strict = true
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ python_requires = >=3.8
# Ref:
# https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#using-a-src-layout
# (`src/` layout)
# package_dir =
# = src
package_dir =
=src
packages =
propcache

# https://setuptools.pypa.io/en/latest/deprecated/zip_safe.html
zip_safe = False
include_package_data = True
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 783d13e

Please sign in to comment.