diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 7752965..d49c240 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -5,7 +5,7 @@ on: types: [published] permissions: - contents: read + contents: write jobs: deploy: @@ -23,6 +23,20 @@ jobs: python -m pip install --upgrade pip pip install build + - name: Bump version + run: | + echo "Bumping version..." + echo "version = \"${{ github.event.release.tag_name }}\"\n" > src/pydom/version.py + echo "Version bumped to ${{ github.event.release.tag_name }}" + + - name: Commit version bump + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add src/pydom/version.py + git commit -m "Bump version to ${{ github.event.release.tag_name }}" + git push + - name: Build package run: python -m build diff --git a/src/pydom/context/context.py b/src/pydom/context/context.py index 031ad95..627deb0 100644 --- a/src/pydom/context/context.py +++ b/src/pydom/context/context.py @@ -30,7 +30,7 @@ def __init__(self) -> None: self.injector: Injector = Injector( { - Context: self, + type(self): self, RenderState: future_dependency("RenderState is only available during rendering"), } ) diff --git a/src/pydom/styling/css_modules.py b/src/pydom/styling/css_modules.py index 77ace1c..2a5c42e 100644 --- a/src/pydom/styling/css_modules.py +++ b/src/pydom/styling/css_modules.py @@ -136,11 +136,10 @@ def set_root_folder(cls, folder: Union[PathLike, str]): def _full_path(cls, css_path: Union[PathLike, str]) -> Path: if isinstance(css_path, str): - if css_path.startswith("./"): + if css_path.startswith("./") or css_path.startswith("../"): frame = get_frame(2) - module = frame.f_globals["__name__"] - module_path = Path(module.replace(".", "/")) - css_path = module_path.parent / css_path[2:] + module = frame.f_globals["__file__"] + css_path = Path(module).parent / css_path css_path = Path(css_path) diff --git a/tests/css/styles.css b/tests/css/styles.css index a8082fe..452f1f0 100644 --- a/tests/css/styles.css +++ b/tests/css/styles.css @@ -6,7 +6,7 @@ padding: 20px; } -.cardHeader { +.card_header { font-size: 1.5em; font-weight: bold; margin-bottom: 10px; diff --git a/tests/test_css_modules.py b/tests/test_css_modules.py index 30c8d8f..11b7e60 100644 --- a/tests/test_css_modules.py +++ b/tests/test_css_modules.py @@ -8,14 +8,14 @@ class CSSModulesTest(TestCase): def setUpClass(cls) -> None: styles = CSS.module("tests/css/styles.css") cls.card_class = styles.card - cls.card_header_class = styles.cardHeader + cls.card_header_class = styles.card_header def test_class_name(self): styles = CSS.module("tests/css/styles.css") self.assertEqual(self.card_class, styles.card) - self.assertEqual(self.card_header_class, styles.cardHeader) + self.assertEqual(self.card_header_class, styles.card_header) def test_relative_css(self): styles = CSS.module("./css/styles.css") self.assertEqual(styles.card, self.card_class) - self.assertEqual(styles.cardHeader, self.card_header_class) + self.assertEqual(styles.card_header, self.card_header_class)