Browse Source

refresh custom components

Khaleel Al-Adhami 3 days ago
parent
commit
cad803d433

+ 5 - 15
reflex/.templates/jinja/custom_components/pyproject.toml.jinja2

@@ -1,25 +1,15 @@
-[build-system]
-requires = ["setuptools", "wheel"]
-build-backend = "setuptools.build_meta"
-
 [project]
 name = "{{ package_name }}"
 version = "0.0.1"
 description = "Reflex custom component {{ module_name }}"
 readme = "README.md"
-license = { text = "Apache-2.0" }
+license.text = "Apache-2.0"
 requires-python = ">=3.10"
 authors = [{ name = "", email = "YOUREMAIL@domain.com" }]
 keywords = ["reflex","reflex-custom-components"]
-
+urls = []
 dependencies = ["reflex>={{ reflex_version }}"]
 
-classifiers = ["Development Status :: 4 - Beta"]
-
-[project.urls]
-
-[project.optional-dependencies]
-dev = ["build", "twine"]
-
-[tool.setuptools.packages.find]
-where = ["custom_components"]
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"

+ 3 - 13
reflex/constants/custom_components.py

@@ -10,26 +10,16 @@ class CustomComponents(SimpleNamespace):
     """Constants for the custom components."""
 
     # The name of the custom components source directory.
-    SRC_DIR = Path("custom_components")
+    SRC_DIR = Path("src")
     # The name of the custom components pyproject.toml file.
     PYPROJECT_TOML = Path("pyproject.toml")
     # The name of the custom components package README file.
     PACKAGE_README = Path("README.md")
-    # The name of the custom components package .gitignore file.
-    PACKAGE_GITIGNORE = ".gitignore"
     # The name of the distribution directory as result of a build.
     DIST_DIR = "dist"
     # The name of the init file.
     INIT_FILE = "__init__.py"
-    # Suffixes for the distribution files.
-    DISTRIBUTION_FILE_SUFFIXES = [".tar.gz", ".whl"]
-    # The name to the URL of python package repositories.
-    REPO_URLS = {
-        # Note: the trailing slash is required for below URLs.
-        "pypi": "https://upload.pypi.org/legacy/",
-        "testpypi": "https://test.pypi.org/legacy/",
-    }
     # The .gitignore file for the custom component project.
-    FILE = Path(".gitignore")
+    GITIGNORE_PATH = Path(".gitignore")
     # Files to gitignore.
-    DEFAULTS = {"__pycache__/", "*.py[cod]", "*.egg-info/", "dist/"}
+    GITIGNORE_DEFAULTS = {"__pycache__/", "*.py[cod]", "*.egg-info/", "dist/"}

+ 1 - 1
reflex/custom_components/custom_components.py

@@ -350,7 +350,7 @@ def init(
 
     # Initialize the .gitignore.
     prerequisites.initialize_gitignore(
-        gitignore_file=CustomComponents.FILE, files_to_ignore=CustomComponents.DEFAULTS
+        gitignore_file=CustomComponents.GITIGNORE_PATH, files_to_ignore=CustomComponents.GITIGNORE_DEFAULTS
     )
 
     if install: