ソースを参照

Support Python 3.11 (#17)

Nikhil Rao 2 年 前
コミット
f710fc1a82
6 ファイル変更28 行追加15 行削除
  1. 1 1
      .github/workflows/python-checks.yml
  2. 4 4
      pynecone/app.py
  3. 1 1
      pynecone/constants.py
  4. 2 1
      pynecone/pc.py
  5. 2 2
      pynecone/utils.py
  6. 18 6
      pyproject.toml

+ 1 - 1
.github/workflows/python-checks.yml

@@ -15,7 +15,7 @@ jobs:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     strategy:
     strategy:
       matrix:
       matrix:
-        python-version: ["3.7", "3.8", "3.9", "3.10"]
+        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
 
 
     steps:
     steps:
     - uses: actions/checkout@v3
     - uses: actions/checkout@v3

+ 4 - 4
pynecone/app.py

@@ -212,18 +212,18 @@ class App(Base):
         # Add the page.
         # Add the page.
         self.pages[route] = component
         self.pages[route] = component
 
 
-    def compile(self, ignore_env: bool = False):
+    def compile(self, force_compile: bool = False):
         """Compile the app and output it to the pages folder.
         """Compile the app and output it to the pages folder.
 
 
         If the config environment is set to production, the app will
         If the config environment is set to production, the app will
         not be compiled.
         not be compiled.
 
 
         Args:
         Args:
-            ignore_env: Whether to ignore the config environment.
+            force_compile: Whether to force the app to compile.
         """
         """
         # Get the env mode.
         # Get the env mode.
         config = utils.get_config()
         config = utils.get_config()
-        if not ignore_env and config.env != constants.Env.DEV:
+        if config.env != constants.Env.DEV and not force_compile:
             print("Skipping compilation in non-dev mode.")
             print("Skipping compilation in non-dev mode.")
             return
             return
 
 
@@ -238,7 +238,7 @@ class App(Base):
 
 
         # Compile the pages.
         # Compile the pages.
         for path, component in self.pages.items():
         for path, component in self.pages.items():
-            path, code = self.compile_page(path, component)
+            self.compile_page(path, component)
 
 
     def compile_page(
     def compile_page(
         self, path: str, component: Component, write: bool = True
         self, path: str, component: Component, write: bool = True

+ 1 - 1
pynecone/constants.py

@@ -113,7 +113,7 @@ TOKEN_EXPIRATION = 60 * 60
 
 
 
 
 # Env modes
 # Env modes
-class Env(Enum):
+class Env(str, Enum):
     """The environment modes."""
     """The environment modes."""
 
 
     DEV = "dev"
     DEV = "dev"

+ 2 - 1
pynecone/pc.py

@@ -53,7 +53,7 @@ def init():
 
 
 @cli.command()
 @cli.command()
 def run(
 def run(
-    env: constants.Env = constants.Env.DEV.value,  # type: ignore
+    env: constants.Env = constants.Env.DEV,
     frontend: bool = True,
     frontend: bool = True,
     backend: bool = True,
     backend: bool = True,
 ):
 ):
@@ -66,6 +66,7 @@ def run(
     """
     """
     utils.console.rule("[bold]Starting Pynecone App")
     utils.console.rule("[bold]Starting Pynecone App")
     app = utils.get_app()
     app = utils.get_app()
+
     frontend_cmd = backend_cmd = None
     frontend_cmd = backend_cmd = None
     if env == constants.Env.DEV:
     if env == constants.Env.DEV:
         frontend_cmd, backend_cmd = utils.run_frontend, utils.run_backend
         frontend_cmd, backend_cmd = utils.run_frontend, utils.run_backend

+ 2 - 2
pynecone/utils.py

@@ -321,7 +321,7 @@ def export_app(app):
     Args:
     Args:
         app: The app.
         app: The app.
     """
     """
-    app.app.compile(ignore_env=False)
+    app.app.compile(force_compile=True)
     cmd = r"rm -rf .web/_static; cd .web && bun run export && cd _static  && zip -r ../../frontend.zip ./* && cd ../.. && zip -r backend.zip ./* -x .web/\* ./assets\* ./frontend.zip\* ./backend.zip\*"
     cmd = r"rm -rf .web/_static; cd .web && bun run export && cd _static  && zip -r ../../frontend.zip ./* && cd ../.. && zip -r backend.zip ./* -x .web/\* ./assets\* ./frontend.zip\* ./backend.zip\*"
     os.system(cmd)
     os.system(cmd)
 
 
@@ -343,7 +343,7 @@ def setup_frontend(app):
     ln(src=os.path.join("..", constants.APP_ASSETS_DIR), dest=constants.WEB_ASSETS_DIR)
     ln(src=os.path.join("..", constants.APP_ASSETS_DIR), dest=constants.WEB_ASSETS_DIR)
 
 
     # Compile the frontend.
     # Compile the frontend.
-    app.app.compile(ignore_env=False)
+    app.app.compile(force_compile=True)
 
 
 
 
 def run_frontend(app) -> subprocess.Popen:
 def run_frontend(app) -> subprocess.Popen:

+ 18 - 6
pyproject.toml

@@ -1,25 +1,37 @@
 [tool.poetry]
 [tool.poetry]
 name = "pynecone-io"
 name = "pynecone-io"
 version = "0.1.6"
 version = "0.1.6"
-description = ""
+description = "The easiest way to build web apps."
+license = "Apache-2.0"
 authors = [
 authors = [
     "Nikhil Rao <nikhil@pynecone.io>",
     "Nikhil Rao <nikhil@pynecone.io>",
     "Alek Petuskey <alek@pynecone.io>",
     "Alek Petuskey <alek@pynecone.io>",
 ]
 ]
+readme = "README.md"
+homepage = "https://pynecone.io"
+repository = "https://github.com/pynecone-io/pynecone"
+documentation = "https://pynecone.io/docs/getting-started/introduction"
+keywords = [
+    "web",
+    "framework",
+]
+classifiers = [
+    "Development Status :: 4 - Beta",
+]
 packages = [
 packages = [
     {include = "pynecone"}
     {include = "pynecone"}
 ]
 ]
 
 
 [tool.poetry.dependencies]
 [tool.poetry.dependencies]
 python = "^3.7.2"
 python = "^3.7.2"
-fastapi = "^0.75.0"
+fastapi = "^0.88.0"
 gunicorn = "^20.1.0"
 gunicorn = "^20.1.0"
 plotly = "^5.10.0"
 plotly = "^5.10.0"
-pydantic = "1.9.0"
+pydantic = "1.10.2"
 requests = "^2.28.1"
 requests = "^2.28.1"
-sqlmodel = "^0.0.6"
-typer = "^0.4.1"
-uvicorn = "^0.17.6"
+sqlmodel = "^0.0.8"
+typer = "^0.7.0"
+uvicorn = "^0.20.0"
 rich = "^12.6.0"
 rich = "^12.6.0"
 redis = "^4.3.5"
 redis = "^4.3.5"