Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [published]

permissions:
contents: read
contents: write

jobs:
deploy:
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/pydom/context/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
)
Expand Down
7 changes: 3 additions & 4 deletions src/pydom/styling/css_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion tests/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
padding: 20px;
}

.cardHeader {
.card_header {
font-size: 1.5em;
font-weight: bold;
margin-bottom: 10px;
Expand Down
6 changes: 3 additions & 3 deletions tests/test_css_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)