click
connexion
click | connexion | |
---|---|---|
32 | 23 | |
15,049 | 4,420 | |
0.7% | 0.2% | |
8.0 | 8.2 | |
2 days ago | 3 days ago | |
Python | Python | |
BSD 3-clause "New" or "Revised" License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
click
-
click-web: Serve click scripts over the web (Python)
Context: "click" - "Command Line Interface Creation Kit" - easily create CLIs from Python code, via adding decorators: https://github.com/pallets/click
"click-web" in turn turns the click CLI app into a web app with one line of code.
- Anyone want to start a project with me.
-
How does "python3 *file* -*letter* work?
there is also click, it is more straight forward and also nice to keep the relevant code where the code is. https://github.com/pallets/click/
-
Overhead of Python Asyncio Tasks
I don't have huge experience with Python, but I used async code with C#/Typescript and lately I had to use some asyncio magic.
I found this article: https://blog.dalibo.com/2022/09/12/monitoring-python-subproc... and while async/await syntax is the same, it's not entirely clear for me, why there's some event loop and what exactly happens, when I pass function to asyncio.run(), like here: https://github.com/pallets/click/issues/85#issuecomment-5034...
So, you can use it and it's not that hard, but there are some parts that are vague for me, no matter which language implements async support.
-
I am sick of writing argparse boilerplate code, so I made "duckargs" to do it for me
Hmm… did you try such approaches, as [click](https://github.com/pallets/click) or[tap](https://github.com/swansonk14/typed-argument-parser)?
-
lord-of-the-clips (lotc): CLI app to download, trim/clip, and merge videos. Supports lots of sites. Downloads/trims at multiple points. Merges multiple clips.
This app leverages these powerful libraries: - yt-dlp: video downloader - moviepy: video trimmer/merger - click: CLI app creator - rich / rich-click: CLI app styler
-
Shells Are Two Things
I've used click [1] a lot to build Python tooling scripts the past few years. Click usage is "sort of" similar to the author's proposed solution. There's also a small section here [2] that describes some of the issues covered in the article (in context of argparse).
[1] - https://github.com/pallets/click
-
Tomu – A family of devices which fit inside your USB port
I think the success of Arduino in the hardware world can be explained in a similar way, as the relative success of "command line app frameworks" like Click[1], or even much lighter-weight libraries like argparse[2]. You absolutely can get away with using just getopt[3] (and people experienced with it will likely strongly prefer it). However certain factors such as a more declarative API, a nice logo, the existence of an ecosystem (even if you're not actively drawing from it), an official "branded" forum, etc can all play into picking a more complex solution, with more baggage you don't need, certain oddities that may throw users off, etc.
[1]: https://click.palletsprojects.com/
[2]: https://docs.python.org/3/library/argparse.html
[3]: https://man.openbsd.org/getopt.3, https://linux.die.net/man/3/getopt
- something like python's click library?
-
Advice for a final project in python without web?
Exactly! You can also use a library like click (https://github.com/pallets/click) to help take care of the command line side, while you focus on the 'business logic' of your application :)
connexion
-
Write OpenAPI with TypeSpec
I like the idea, especially the TS-like syntax around enums and union types. I've always preferred the SDL for GraphQL vs writing OpenAPI for similar reasons.
I echo the sentiment others have brought up, which is the trade-offs of a code-driven schema vs schema-driven code.
At work we use Pydantic and FastAPI to generate the OpenAPI contract, but there's some cruft and care needed around exposing those underlying Pydantic models through the API documentation. It's been easy to create schemas that have compatibility problems when run through other code generators. I know there are projects such as connexction[1] which attempt to inverse this, but I don't have much experience with it. In the GraphQL space it seems that code-first approaches are becoming more favored, though there's a different level of complexity needed to create a "typesafe" GraphQL server (eg. model mismatches between root query resolvers and field resolvers).
[1] https://github.com/spec-first/connexion
-
Connexion 3 released!
Connexion is a popular Python web framework (~ 5 million downloads per month) that makes spec-first and api-first development easy. You describe your API in an OpenAPI (or swagger) specification with as much detail as you want and Connexion will guarantee that it works as you specified.
- Connexion 3.0 Released
-
Show HN: REST Alternative to GraphQL and tRPC
> While REST APIs don't generally provide the same level of control to clients as GraphQL, many times this could be seen as a benefit especially in scenarios where strict control over data access and operations is crucial.
Rest is more secure, cacheable, and more performant on the server side as field resolution doesn't need to happen like it does with GraphQL. It is not more performant on the client side, and this is a trade-off, but I favor rest applications over GraphQL ones as a DevOps engineer. They are much easier to administer infrastructure-wise, I can cache the requests, etc.
Data at our company suggests that several small queries actually do better performance-wise than one large one. We switched to GraphQL a year and a half ago or so, but this piece of data seems to suggest that we might have been better off just sticking with REST. My suggestion to that effect was not met with optimism either on the client or server side. Apparently there are server-side benefits as well, allowing for more modular development or something like that.
I have used OpenAPI using connexion[1]. It was hard to understand at first, but I really liked that the single source of truth was one schema. It also made it really easy to develop against the API because it came with a UI that showed the documentation for all the rest end points and even had test buttons.
1: https://connexion.readthedocs.io/en/latest/
-
Ask HN: Why is there no specification for Command Line Interfaces?
What's the use case? I was thinking about this exact issue because my product ships several CLI tools, but I wasn't convinced it would be worth the effort.
An OpenAPI specification describes an HTTP interface, and I see it as useful because it makes it easier to write code in language-of-choice to generate HTTP requests (by generating client libraries from the OpenAPI spec).
For a CLI, the interface is the command-line. Usually people type these commands, or they end up in bash scripts, or sometimes they get called from programming language of choice by shelling out to the CLI. So I could see a use case for a CLI spec, which would make it easier to generate client libraries (which would shell out to the CLI)... but it seems a little niche.
Or maybe, as input to a documentation tool (like Swagger docs). I would imagine if you're using a CLI library like Python's Click, most of that data is already there. Click Parameters documentation: https://click.palletsprojects.com/en/8.1.x/parameters/
Or maybe, you could start from the spec and then generate code which enforces it. So any changes pass through the spec, which would make it easy to write code (server and client-side) / documentation / changelogs. Some projects like this: Guardrail (Scala) https://github.com/guardrail-dev/guardrail , and Connexion (Python) https://github.com/spec-first/connexion .
But without this ecosystem of tooling, documenting your CLI in a specification didn't really seem worth the effort. Of course, that's a bootstrapping problem.
-
Flask is Great!
Connexion is a framework on top of Flask that automagically handles HTTP requests defined using OpenAPI/Swagger.
-
What is the best practice for mapping JSON requests to objects and back to JSON?
I recommend you create a OpenAPI Specification and implement a python module that you expose via connexion or on the cli via click(for easy testing).
-
Flask-Powered APIs: Fast, Reliable, and Used by the World's Top Companies
I'm here because Swagger-CodeGen created flask-Connexion boilerplate for python.
- Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 1 – Real Python
-
Does anybody know any good resources I could use to study ISP architecture?
Personally we just prov them using librouteros and flask-connexion/openapi.
What are some alternatives?
typer - Typer, build great CLIs. Easy to code. Based on Python type hints.
flask-restful - Simple framework for creating REST APIs
Python Fire - Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.
Flask RestPlus - Fully featured framework for fast, easy and documented API development with Flask
python-prompt-toolkit - Library for building powerful interactive command line applications in Python
flasgger - Easy OpenAPI specs and Swagger UI for your Flask API
cement - Application Framework for Python
django-rest-framework - Web APIs for Django. 🎸
cliff - Command Line Interface Formulation Framework. Mirror of code maintained at opendev.org.
eve - REST API framework designed for human beings
docopt - This project is no longer maintained. Please see https://github.com/jazzband/docopt-ng
falcon - The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.