Skip to content

Refactor repository structure #1251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2f320bb
New repo structure
Archmonger Jan 3, 2025
8706373
bad attempt at getting bun working
Archmonger Jan 5, 2025
f54f9c4
re-add tsconfig
Archmonger Jan 5, 2025
754c838
re-add TS config
Archmonger Jan 12, 2025
3632880
functional JS build
Archmonger Jan 14, 2025
259ed3d
Remove unneded tsconfig
Archmonger Jan 14, 2025
ecc31a7
cleaner build cmd
Archmonger Jan 14, 2025
a15d33e
clean up install cmd
Archmonger Jan 14, 2025
fe84808
Seemingly fully functional Python build?
Archmonger Jan 15, 2025
9e2ace2
functional `hatch test` command
Archmonger Jan 15, 2025
b4a66f4
refactor test names
Archmonger Jan 15, 2025
d65bc81
fix misc test warnings
Archmonger Jan 15, 2025
bd7f40d
prep work to get CI working
Archmonger Jan 17, 2025
2e82d19
fully functional build sequence for JS
Archmonger Jan 17, 2025
1797ba2
increase test timeout
Archmonger Jan 18, 2025
42f4ab3
potentially working publishing workflow
Archmonger Jan 19, 2025
9369442
potentially working check workflows
Archmonger Jan 20, 2025
77f41d3
reduce coverage percent
Archmonger Jan 20, 2025
288dde5
attempt some CI fixes
Archmonger Jan 20, 2025
0bf34a3
docs serve cmd
Archmonger Jan 20, 2025
1d824a6
Attempt fixes for docker build
Archmonger Jan 20, 2025
c33b843
Attempt at fixing poetry install
Archmonger Jan 20, 2025
0079739
copy more stuff
Archmonger Jan 20, 2025
4f9e644
fix hatch dep for docker
Archmonger Jan 20, 2025
51e67f8
Install bun in docker image
Archmonger Jan 20, 2025
d35bc3d
Try removing nsolid
Archmonger Jan 20, 2025
7e5da83
Switch docs to use bun
Archmonger Jan 20, 2025
c0bf3ec
self review
Archmonger Jan 20, 2025
3a1cb6e
Better coverage settings
Archmonger Jan 21, 2025
5ebfa1c
Add documentation for new hatch commands
Archmonger Jan 21, 2025
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ max_line_length = 120
[*.md]
indent_size = 4

[*.yml]
indent_size = 4

[*.html]
max_line_length = off

Expand Down
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: [rmorshea]
github: [archmonger, rmorshea]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
Expand Down
31 changes: 12 additions & 19 deletions .github/workflows/.hatch-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@ on:
job-name:
required: true
type: string
hatch-run:
run-cmd:
required: true
type: string
runs-on-array:
runs-on:
required: false
type: string
default: '["ubuntu-latest"]'
python-version-array:
python-version:
required: false
type: string
default: '["3.x"]'
node-registry-url:
required: false
type: string
default: ""
secrets:
node-auth-token:
required: false
Expand All @@ -34,26 +30,23 @@ jobs:
name: ${{ format(inputs.job-name, matrix.python-version, matrix.runs-on) }}
strategy:
matrix:
python-version: ${{ fromJson(inputs.python-version-array) }}
runs-on: ${{ fromJson(inputs.runs-on-array) }}
python-version: ${{ fromJson(inputs.python-version) }}
runs-on: ${{ fromJson(inputs.runs-on) }}
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: oven-sh/setup-bun@v2
with:
node-version: "23.x"
registry-url: ${{ inputs.node-registry-url }}
- name: Pin NPM Version
run: npm install -g [email protected]
bun-version: latest
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python Dependencies
run: pip install hatch poetry
run: pip install --upgrade pip hatch uv
- name: Run Scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.node-auth-token }}
PYPI_USERNAME: ${{ secrets.pypi-username }}
PYPI_PASSWORD: ${{ secrets.pypi-password }}
run: hatch run ${{ inputs.hatch-run }}
NPM_CONFIG_TOKEN: ${{ secrets.node-auth-token }}
HATCH_INDEX_USER: ${{ secrets.pypi-username }}
HATCH_INDEX_AUTH: ${{ secrets.pypi-password }}
run: ${{ inputs.run-cmd }}
32 changes: 15 additions & 17 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,36 @@ on:
- cron: "0 0 * * 0"

jobs:
test-py-cov:
test-python-coverage:
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "python-{0}"
hatch-run: "test-py"
lint-py:
run-cmd: "hatch test --cover"
lint-python:
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "python-{0}"
hatch-run: "lint-py"
test-py-matrix:
run-cmd: "hatch fmt src/reactpy --check && hatch run python:type_check"
test-python:
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "python-{0} {1}"
hatch-run: "test-py --no-cov"
runs-on-array: '["ubuntu-latest", "macos-latest", "windows-latest"]'
python-version-array: '["3.9", "3.10", "3.11"]'
test-docs:
run-cmd: "hatch test"
runs-on: '["ubuntu-latest", "macos-latest", "windows-latest"]'
python-version: '["3.9", "3.10", "3.11"]'
test-documentation:
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "python-{0}"
hatch-run: "test-docs"
# as of Dec 2023 lxml does have wheels for 3.12
# https://bugs.launchpad.net/lxml/+bug/2040440
python-version-array: '["3.11"]'
test-js:
run-cmd: "hatch run docs:check"
python-version: '["3.11"]'
test-javascript:
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "{1}"
hatch-run: "test-js"
lint-js:
run-cmd: "hatch run javascript:test"
lint-javascript:
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "{1}"
hatch-run: "lint-js"
run-cmd: "hatch run javascript:check"
3 changes: 0 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: deploy-docs

on:
Expand Down
30 changes: 22 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
# This workflows will upload a Javscript Package using NPM to npmjs.org when a release is created
# For more information see: https://docs.github.com/en/actions/guides/publishing-nodejs-packages

name: publish

on:
release:
types: [published]

jobs:
publish:
publish-reactpy:
if: startsWith(github.event.release.name, 'reactpy ')
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "publish"
hatch-run: "publish"
node-registry-url: "https://registry.npmjs.org"
job-name: "Publish to PyPI"
run-cmd: "hatch build --clean && hatch publish --yes"
secrets:
node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }}
pypi-username: ${{ secrets.PYPI_USERNAME }}
pypi-password: ${{ secrets.PYPI_PASSWORD }}

publish-reactpy-client:
if: startsWith(github.event.release.name, '@reactpy/client ')
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "Publish to NPM"
run-cmd: "hatch run javascript:publish_reactpy_client"
secrets:
node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }}

publish-event-to-object:
if: startsWith(github.event.release.name, 'event-to-object ')
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "Publish to NPM"
run-cmd: "hatch run javascript:publish_event_to_object"
secrets:
node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# --- Build Artifacts ---
src/reactpy/static/**/index.js*

# --- Jupyter ---
*.ipynb_checkpoints
*Untitled*.ipynb
Expand Down Expand Up @@ -29,6 +32,7 @@ pip-wheel-metadata
.python-version

# -- Python Tests ---
.coverage.*
*.coverage
*.pytest_cache
*.mypy_cache
Expand Down
12 changes: 0 additions & 12 deletions .vscode/extensions.json

This file was deleted.

20 changes: 4 additions & 16 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
The MIT License (MIT)

Copyright (c) 2019 Ryan S. Morshead
Copyright (c) Reactive Python and affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 changes: 13 additions & 17 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,38 @@
FROM python:3.9
FROM python:3.11
WORKDIR /app/

RUN apt-get update

# Install NodeJS
# --------------
RUN curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh
RUN chmod 500 nsolid_setup_deb.sh
RUN ./nsolid_setup_deb.sh 20
RUN apt-get install nodejs -y

# Install Poetry
# --------------
RUN pip install poetry

# Create/Activate Python Venv
# ---------------------------
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --upgrade pip

# Install Python Build Dependencies
# ---------------------------------
RUN pip install --upgrade pip poetry hatch uv
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:$PATH"

# Copy Files
# ----------
COPY LICENSE ./
COPY README.md ./
COPY pyproject.toml ./
COPY src ./src
COPY docs ./docs
COPY branding ./branding

# Install and Build Docs
# ----------------------
WORKDIR /app/docs
RUN poetry install
WORKDIR /app/docs/
RUN poetry install -v
RUN sphinx-build -v -W -b html source build

# Define Entrypoint
# -----------------
ENV PORT 5000
ENV PORT=5000
ENV REACTPY_DEBUG_MODE=1
ENV REACTPY_CHECK_VDOM_SPEC=0
CMD python main.py
CMD ["python", "main.py"]
19 changes: 1 addition & 18 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# ReactPy's Documentation

We provide two main ways to run the docs. Both use
[`nox`](https://pypi.org/project/nox/):

- `nox -s docs` - displays the docs and rebuilds when files are modified.
- `nox -s docs-in-docker` - builds a docker image and runs the docs from there.

If any changes to the core of the documentation are made (i.e. to non-`*.rst` files),
then you should run a manual test of the documentation using the `docs_in_docker`
session.

If you wish to build and run the docs by hand you need to perform two commands, each
being run from the root of the repository:

- `sphinx-build -b html docs/source docs/build`
- `python scripts/run_docs.py`

The first command constructs the static HTML and any Javascript. The latter actually
runs the web server that serves the content.
...
Loading
Loading