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
1 change: 1 addition & 0 deletions packages/hatch-reflex-pyi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "hatch-reflex-pyi"
dynamic = ["version"]
description = "Hatch build hook that generates .pyi stubs for Reflex component packages."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/integrations-docs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-integrations-docs"
dynamic = ["version"]
description = "Reflex Integrations Docs."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-base/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-base"
dynamic = ["version"]
description = "Core types for the Reflex framework."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-code/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-code"
dynamic = ["version"]
description = "Reflex code display components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-core"
dynamic = ["version"]
description = "UI components for Reflex."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-dataeditor/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-dataeditor"
dynamic = ["version"]
description = "Reflex dataeditor components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-gridjs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-gridjs"
dynamic = ["version"]
description = "Reflex gridjs components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
2 changes: 2 additions & 0 deletions packages/reflex-components-internal/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-internal"
dynamic = ["version"]
description = "Reflex internal components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down Expand Up @@ -36,6 +37,7 @@ dependencies = [
"reflex-components-react-player",
"reflex-components-recharts",
"reflex-components-sonner",
"reflex-hosting-cli",
]

[build-system]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-lucide/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-lucide"
dynamic = ["version"]
description = "Reflex lucide components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-markdown/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-markdown"
dynamic = ["version"]
description = "Reflex markdown components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-moment/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-moment"
dynamic = ["version"]
description = "Reflex moment components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-plotly/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-plotly"
dynamic = ["version"]
description = "Reflex plotly components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-radix/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-radix"
dynamic = ["version"]
description = "Reflex radix components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-react-player/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-react-player"
dynamic = ["version"]
description = "Reflex react-player components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-recharts/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-recharts"
dynamic = ["version"]
description = "Reflex recharts components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-components-sonner/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-components-sonner"
dynamic = ["version"]
description = "Reflex sonner components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
1 change: 1 addition & 0 deletions packages/reflex-docgen/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "reflex-docgen"
dynamic = ["version"]
description = "Generate documentation for Reflex components."
license.text = "Apache-2.0"
readme = "README.md"
authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
Expand Down
2 changes: 2 additions & 0 deletions packages/reflex-hosting-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# reflex-hosting-cli
Hosting CLI for Reflex.
36 changes: 36 additions & 0 deletions packages/reflex-hosting-cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[project]
name = "reflex-hosting-cli"
dynamic = ["version"]
description = "Reflex Hosting CLI"
license.text = "Apache-2.0"
readme = "README.md"
authors = [
{ name = "Nikhil Rao", email = "nikhil@reflex.dev" },
{ name = "Alek Petuskey", email = "alek@reflex.dev" },
]
maintainers = [
{ name = "Simon Young", email = "simon@reflex.dev" },
{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" },
]
requires-python = ">=3.10"
dependencies = [
"click >=8.2",
"httpx >=0.25.1,<1.0",
"packaging >=24.2",
"platformdirs >=3.10.0,<5.0",
"rich >=13,<15",
]

[tool.hatch.version]
source = "uv-dynamic-versioning"

[tool.uv-dynamic-versioning]
pattern-prefix = "reflex-hosting-cli-"
fallback-version = "0.0.0dev0"

[tool.hatch.build.targets.wheel]
packages = ["src/reflex_cli"]

[build-system]
requires = ["hatchling", "uv-dynamic-versioning"]
build-backend = "hatchling.build"
1 change: 1 addition & 0 deletions packages/reflex-hosting-cli/src/reflex_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""CLI library for the hosting service."""
9 changes: 9 additions & 0 deletions packages/reflex-hosting-cli/src/reflex_cli/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Disabled V1 CLI for the hosting service."""

from __future__ import annotations

from reflex_cli.utils import disabled_v1_hosting

login = disabled_v1_hosting
logout = disabled_v1_hosting
deploy = disabled_v1_hosting
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""The constants package."""

from .base import Dirs, LogLevel, Reflex
from .compiler import ComponentName
from .hosting import Hosting, ReflexHostingCli, RequirementsTxt

__ALL__ = [
Hosting,
LogLevel,
Reflex,
ComponentName,
ReflexHostingCli,
RequirementsTxt,
Dirs,
]
58 changes: 58 additions & 0 deletions packages/reflex-hosting-cli/src/reflex_cli/constants/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""Base file for constants that don't fit any other categories."""

from __future__ import annotations

from enum import Enum
from types import SimpleNamespace

from platformdirs import PlatformDirs


class Reflex(SimpleNamespace):
"""Base constants concerning Reflex. This is duplicate of the same class in reflex main."""

# The name of the Reflex package.
MODULE_NAME = "reflex"

# Files and directories used to init a new project.
# The directory to store reflex dependencies.
DIR = (
# on windows, we use C:/Users/<username>/AppData/Local/reflex.
# on macOS, we use ~/Library/Application Support/reflex.
# on linux, we use ~/.local/share/reflex.
PlatformDirs(MODULE_NAME, False).user_data_dir
)


# Log levels
class LogLevel(str, Enum):
"""The log levels."""

DEBUG = "debug"
DEFAULT = "default"
INFO = "info"
WARNING = "warning"
ERROR = "error"
CRITICAL = "critical"

def __le__(self, other: LogLevel | str) -> bool:
"""Compare log levels.

Args:
other: The other log level.

Returns:
True if the log level is less than or equal to the other log level.

"""
if isinstance(other, str):
other = LogLevel(other.lower().strip())
levels = list(LogLevel)
return levels.index(self) <= levels.index(other)


class Dirs(SimpleNamespace):
"""Various directories/paths used by the CLI."""

# The cloud.yaml file.
CLOUD_YAML = "cloud.yml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Compiler variables."""

from enum import Enum
from types import SimpleNamespace


class Ext(SimpleNamespace):
"""Extension used in Reflex."""

# The extension for JS files.
JS = ".js"
# The extension for python files.
PY = ".py"
# The extension for css files.
CSS = ".css"
# The extension for zip files.
ZIP = ".zip"


class ComponentName(Enum):
"""Component names."""

BACKEND = "Backend"
FRONTEND = "Frontend"

def zip(self):
"""Give the zip filename for the component.

Returns:
The lower-case filename with zip extension.

"""
return self.value.lower() + Ext.ZIP
56 changes: 56 additions & 0 deletions packages/reflex-hosting-cli/src/reflex_cli/constants/hosting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""Constants related to hosting."""

import os
from pathlib import Path
from types import SimpleNamespace

from packaging import version

from reflex_cli.constants.base import Reflex


class ReflexHostingCli(SimpleNamespace):
"""Constants related to reflex-hosting-cli."""

MODULE_NAME = "reflex-hosting-cli"

MINIMUM_REFLEX_VERSION = version.parse("0.6.6.post1")

RECOMMENDED_REFLEX_VERSION = version.parse("0.7.6")


class Hosting(SimpleNamespace):
"""Constants related to hosting."""

# The hosting config json file
HOSTING_JSON = Path(Reflex.DIR) / "hosting_v1.json"
HOSTING_JSON_V0 = Path(Reflex.DIR) / "hosting_v0.json"
# The hosting service backend URL
HOSTING_SERVICE = os.environ.get(
"REFLEX_CLOUD_BACKEND_URL",
os.environ.get("CP_BACKEND_URL", "https://build.reflex.dev"),
)
# The hosting service webpage URL
HOSTING_SERVICE_UI = os.environ.get(
"REFLEX_CLOUD_URL", os.environ.get("CP_WEB_URL", "https://build.reflex.dev")
)
# The time to wait for HTTP requests to the backend
TIMEOUT = 10
# The number of times to retry authentication
AUTH_RETRY_LIMIT = 5
# How long to wait between retry attempts
AUTH_RETRY_SLEEP_DURATION = 5

# Aliases for compatibility with previous versions of Reflex
CP_BACKEND_URL = HOSTING_SERVICE
CP_WEB_URL = HOSTING_SERVICE_UI


class RequirementsTxt(SimpleNamespace):
"""Requirements.txt constants."""

# The requirements.txt file.
FILE = "requirements.txt"

# The pyproject.toml file.
PYPROJECT = "pyproject.toml"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""core module for reflex-cli."""
Loading
Loading