-
-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor repository structure (#1251)
- Refactor repo away from monorepo structure into something more standard/maintainable - Project dependencies have been simplified to [`python > 3.9`](https://www.python.org/downloads/), [`hatch`](https://hatch.pypa.io/latest/install/#pip), and [`bun`](https://bun.sh/). - All tool chain commands are now funneled through `hatch` with commands being [near identical to our other repos](https://reactive-python.github.io/reactpy-router/latest/about/contributing/). - Documentation commands have an optional dependency of [`docker`](https://www.docker.com/pricing/), which is primarily used for deployment. - Replace `react` usage with `preact/compat` within `@reactpy/client`. - This was previously being done via build-time name substitutions, but realistically ReactPy is the only user of `@reactpy/client`, so we may as well "clean up" the build path for ourselves. - Remove tests for `module_from_template` due to unfixable failures
- Loading branch information
1 parent
e09d09c
commit 90c25e0
Showing
151 changed files
with
1,741 additions
and
9,978 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,9 @@ max_line_length = 120 | |
[*.md] | ||
indent_size = 4 | ||
|
||
[*.yml] | ||
indent_size = 4 | ||
|
||
[*.html] | ||
max_line_length = off | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
... |
Oops, something went wrong.