Skip to content

Commit

Permalink
feat: easier for users to know when new version is available, Closes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobi-De committed Dec 19, 2023
1 parent 2d988ed commit c3ee9cf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@

Intro here....

✨📚✨ [Read the full documentation](https://falco.oluwatobi.dev)

![Static Badge](https://img.shields.io/badge/Read%20The%20full%20Documentation-blue?&style=flat)

<!-- [![Read the full documentation](https://img.shields.io/badge/Read%20The%20full%20Documentation-blue?style=for-the-badge&logo=ReadTheDocs)](https://falco.oluwatobi.dev) -->


## The CLI

This is a set of commands to help you throughout the lifecycle of your django project development, from bootstrapping a new project using modern tools like [htmx](https://htmx.org), [hatch](https://github.com/pypa/hatch), [tailwindcss](https://tailwindcss.com/), to generating CRUD views for your models and a few utilities that might help during deployment.

[The CLI full documentation](https://falco.oluwatobi.dev/the_cli/)
<!-- [![The CLI full documentation](https://img.shields.io/badge/Read%20The%20CLI%20Documentation-blue?style=for-the-badge&logo=ReadTheDocs)](https://falco.oluwatobi.dev/the_cli/) -->


```sh
pip install falco-cli
Expand All @@ -54,7 +52,8 @@ pip install falco-cli
If you don't find any use of the CLI, I hope you will in these guides. This is a collection of guides that address common issues in web development, specifically tailored to Django. Each guide provides solutions, patterns, and approaches that are relevant to Django projects. It is similar to the [Django topic guides](https://docs.djangoproject.com/en/5.0/topics/), but instead of focusing on components of the framework like `forms`, `models`, `views`, etc., it focuses on more general topics like `task queues`, `deployment`, `realtime`, etc.

[The full Guides](https://falco.oluwatobi.dev/guides/)
<!--
[![The full Guides](https://img.shields.io/badge/Read%20The%20Full%20Guides-blue?style=for-the-badge&logo=ReadTheDocs)](https://falco.oluwatobi.dev/guides/) -->


<!-- GUIDES-LIST:START -->
Expand Down
2 changes: 1 addition & 1 deletion src/falco/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Tobi DEGNON <tobidegnon@proton.me>
#
# SPDX-License-Identifier: MIT
__version__ = "0.0.9"
__version__ = "0.0.10"
21 changes: 21 additions & 0 deletions src/falco/commands/start_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
from typing import Annotated

import cappa
import httpx
from django.core.management.commands.startproject import Command as DjangoStartProject
from falco import falco_version
from falco.utils import clean_project_name
from falco.utils import get_falco_blueprints_path
from falco.utils import network_request_with_progress
from falco.utils import RICH_INFO_MARKER
from falco.utils import RICH_SUCCESS_MARKER
from falco.utils import simple_progress
Expand Down Expand Up @@ -38,6 +41,19 @@ def get_authors_info() -> tuple[str, str]:
)


def is_new_falco_cli_available() -> bool:
try:
with network_request_with_progress(
"https://pypi.org/pypi/falco-cli/json",
"Checking for new falco version...",
) as response:
latest_version = response.json()["info"]["version"]
current_version = falco_version
return latest_version != current_version
except httpx.HTTPError:
return False


@cappa.command(help="Initialize a new django project the falco way.")
class StartProject:
project_name: Annotated[
Expand All @@ -60,6 +76,11 @@ def __call__(self) -> None:
)

rich_print(msg)
if is_new_falco_cli_available():
rich_print(
f"{RICH_INFO_MARKER} A new falco version is available, run "
f"{RICH_SUCCESS_MARKER}pip install -U falco-cli{RICH_INFO_MARKER} to upgrade."
)

def init_project(self) -> None:
project_template_path = get_falco_blueprints_path() / "project_name"
Expand Down

0 comments on commit c3ee9cf

Please sign in to comment.