Bläddra i källkod

Support Python 3.11 (#17)

Nikhil Rao 2 år sedan
förälder
incheckning
f710fc1a82
6 ändrade filer med 28 tillägg och 15 borttagningar
  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
     strategy:
       matrix:
-        python-version: ["3.7", "3.8", "3.9", "3.10"]
+        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
 
     steps:
     - uses: actions/checkout@v3

+ 4 - 4
pynecone/app.py

@@ -212,18 +212,18 @@ class App(Base):
         # Add the page.
         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.
 
         If the config environment is set to production, the app will
         not be compiled.
 
         Args:
-            ignore_env: Whether to ignore the config environment.
+            force_compile: Whether to force the app to compile.
         """
         # Get the env mode.
         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.")
             return
 
@@ -238,7 +238,7 @@ class App(Base):
 
         # Compile the pages.
         for path, component in self.pages.items():
-            path, code = self.compile_page(path, component)
+            self.compile_page(path, component)
 
     def compile_page(
         self, path: str, component: Component, write: bool = True

+ 1 - 1
pynecone/constants.py

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

+ 2 - 1
pynecone/pc.py

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

+ 2 - 2
pynecone/utils.py

@@ -321,7 +321,7 @@ def export_app(app):
     Args:
         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\*"
     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)
 
     # Compile the frontend.
-    app.app.compile(ignore_env=False)
+    app.app.compile(force_compile=True)
 
 
 def run_frontend(app) -> subprocess.Popen:

+ 18 - 6
pyproject.toml

@@ -1,25 +1,37 @@
 [tool.poetry]
 name = "pynecone-io"
 version = "0.1.6"
-description = ""
+description = "The easiest way to build web apps."
+license = "Apache-2.0"
 authors = [
     "Nikhil Rao <nikhil@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 = [
     {include = "pynecone"}
 ]
 
 [tool.poetry.dependencies]
 python = "^3.7.2"
-fastapi = "^0.75.0"
+fastapi = "^0.88.0"
 gunicorn = "^20.1.0"
 plotly = "^5.10.0"
-pydantic = "1.9.0"
+pydantic = "1.10.2"
 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"
 redis = "^4.3.5"