From f710fc1a82dbe008120af8ed4b95e3ffd7c3a555 Mon Sep 17 00:00:00 2001 From: Nikhil Rao Date: Tue, 29 Nov 2022 17:01:14 -0800 Subject: [PATCH] Support Python 3.11 (#17) --- .github/workflows/python-checks.yml | 2 +- pynecone/app.py | 8 ++++---- pynecone/constants.py | 2 +- pynecone/pc.py | 3 ++- pynecone/utils.py | 4 ++-- pyproject.toml | 24 ++++++++++++++++++------ 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/workflows/python-checks.yml b/.github/workflows/python-checks.yml index 86b6576b2..26255ff6f 100644 --- a/.github/workflows/python-checks.yml +++ b/.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 diff --git a/pynecone/app.py b/pynecone/app.py index 4bb5e168d..7a6ff57b7 100644 --- a/pynecone/app.py +++ b/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 diff --git a/pynecone/constants.py b/pynecone/constants.py index c74a28484..2ac3f43fc 100644 --- a/pynecone/constants.py +++ b/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" diff --git a/pynecone/pc.py b/pynecone/pc.py index 07b743c85..2c703df32 100644 --- a/pynecone/pc.py +++ b/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 diff --git a/pynecone/utils.py b/pynecone/utils.py index 98c7ea54f..d71d11e8c 100644 --- a/pynecone/utils.py +++ b/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: diff --git a/pyproject.toml b/pyproject.toml index 9b68914d2..3517b4fac 100644 --- a/pyproject.toml +++ b/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 ", "Alek Petuskey ", ] +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"