Skip to content

Commit

Permalink
drop setup.py (#15)
Browse files Browse the repository at this point in the history
* drop setup.py

* allow import error with env override
  • Loading branch information
PhilipDeegan authored Mar 24, 2024
1 parent 4feb836 commit 9a299b4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
13 changes: 9 additions & 4 deletions phlop/reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@

from phlop.sys import extend_sys_path

FORCE_RAISE_ON_IMPORT_ERROR = os.getenv(
"PHLOP_FORCE_RAISE_ON_IMPORT_ERROR", "False"
).lower() in ("true", "1", "t")

def classes_in_file(file, subclasses_only=None, fail_on_import_error=True):
assert file

def classes_in_file(file_path, subclasses_only=None, fail_on_import_error=False):
file = Path(file_path)
assert file.exists()
module = str(file).replace(os.path.sep, ".")[:-3]
assert module

Expand All @@ -23,7 +28,7 @@ def classes_in_file(file, subclasses_only=None, fail_on_import_error=True):

classes = []

with extend_sys_path(os.getcwd()):
with extend_sys_path([os.getcwd(), str(file.parent)]):
try:
for name, cls in inspect.getmembers(
importlib.import_module(module), inspect.isclass
Expand All @@ -34,7 +39,7 @@ def classes_in_file(file, subclasses_only=None, fail_on_import_error=True):
if should_add:
classes += [cls]
except (ValueError, ModuleNotFoundError) as e:
if fail_on_import_error:
if fail_on_import_error or FORCE_RAISE_ON_IMPORT_ERROR:
raise e
logging.error(f"Skipping on error: {e} in module {module}")

Expand Down
2 changes: 1 addition & 1 deletion phlop/run/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import logging
import multiprocessing
import sys
import re
import sys
import unittest
from pathlib import Path

Expand Down
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "phlop"
version = "0.0.14"
version = "0.0.15"

dependencies = [

Expand All @@ -21,6 +21,12 @@ classifiers = [

[build-system]
requires = [
"setuptools>=42", "wheel", "packaging", "dill"
"setuptools>=62", "wheel", "packaging", "dill"
]

[tool.setuptools]
include-package-data = false

[tool.setuptools.packages.find]
include = ["/phlop*"]
exclude = ["/sh*", "/tests*"]
10 changes: 0 additions & 10 deletions setup.py

This file was deleted.

0 comments on commit 9a299b4

Please sign in to comment.