diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml new file mode 100644 index 0000000..840d766 --- /dev/null +++ b/.github/workflows/django.yml @@ -0,0 +1,34 @@ +name: pytest-django CI + +on: + push: + # TODO: change that to "main" when merging + branches: [ "tetra-package" ] + pull_request: + branches: [ "tetra-package" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.11, 3.12] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[dev] + cd tests + npm install + - name: Run Tests + run: | + cd tests + pytest \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..2d02796 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,16 @@ +# Read the Docs configuration file for MkDocs projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.12" + +mkdocs: + configuration: mkdocs.yml + +python: + install: + - requirements: docs/requirements.txt \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index e6c0202..ee85f0f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,7 @@ recursive-include tetra/static * recursive-include tetra/js * recursive-include tetra/templates * -prune demosites \ No newline at end of file +prune demosite +prune .github +exclude mkdocs.yml +exclude .readthedocs.yaml diff --git a/README.md b/README.md index a5c4df7..b598a37 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ Tetra is a new full stack component framework for Django, bridging the gap betwe See examples at [tetraframework.com](https://www.tetraframework.com) -Read the [Documentation](https://www.tetraframework.com/docs) +Read the [Documentation](https://tetra.readthedocs.org) ``` -pip install tetraframework +pip install tetra ``` ## What does Tetra do? diff --git a/demosite/.env.example b/demosite/.env.example new file mode 100644 index 0000000..f1dcd47 --- /dev/null +++ b/demosite/.env.example @@ -0,0 +1,5 @@ +DEBUG=True +SECRET_KEY= +# ALLOWED_HOSTS="www.tetraframework.com,tetraframework.com" +# CSRF_TRUSTED_ORIGINS="https://www.tetraframework.com,https://tetraframework.com" +# STATIC_ROOT="..." \ No newline at end of file diff --git a/demosite/demo/components.py b/demosite/demo/components.py index 8aa2eb9..66ef997 100644 --- a/demosite/demo/components.py +++ b/demosite/demo/components.py @@ -15,20 +15,23 @@ def load(self): self.todos = ToDo.objects.filter(session_key=self.request.session.session_key) @public - def add_todo(self, title): - todo = ToDo( - title=title, - session_key=self.request.session.session_key, - ) - todo.save() - self.title = "" + def add_todo(self, title: str): + if self.title: + todo = ToDo( + title=title, + session_key=self.request.session.session_key, + ) + todo.save() + self.title = "" template: django_html = """