Code Monkey home page Code Monkey logo

feud's Introduction

๐Ÿ‘‹

Hi! My name is Ed, and I'm currently a machine learning engineer at Hazy working on improving a privacy-preserving synthetic data generation platform for enterprise data analytics.

I studied at the University of Edinburgh, with an MSc in Statistics with Data Science at the School of Mathematics, and a BSc in Computer Science at the School of Informatics.

I normally work with Python, mainly using it for machine learning or data related things, as well as any general purpose scripting, task automation or web development.

I did my fair share of Ruby development back in the day, and I am also familiar with the use of R for applied statistics, but lean heavily towards Python.

feud's People

Contributors

eonu avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

feud's Issues

Create a user guide with more detailed examples

Does this suggestion already exist?

  • This is a new feature!

Feature description

The current Sphinx-generated API reference is useful for learning basic usage patterns of the package.

However, there are many features of Feud, or ways to combine features that can be used in more complex usage patterns to achieve many different things in the generated CLI.

These detailed usage examples don't belong in the API reference, and should be contained in a separate user guide.

The user guide should also show integrations (which should work in theory), e.g. click-contrib and trogon.

Proposed stack


Hosted at feud.wiki/guide or guide.feud.wiki.

Investigate support for postponed type hint evaluation

Does this suggestion already exist?

  • This is a new feature!

Feature description

Feud will currently break if from __future__ import annotations is used as the package relies on evaluated type hints.

Look into possible solutions to handle postponed type hint evaluation.

Docstring formats

Does this suggestion already exist?

  • This is a new feature!

Feature description

From the examples it seems like currently only numpy style docstrings are supported.

Is there any plan to support other docstring conventions. The 3 major ones in python are
Numpy
Google
rst

Define `feud.click.is_rich` to check if `rich_click` is installed

Does this suggestion already exist?

  • This is a new feature!

Feature description

There is currently no easy way to check whether rich_click is installed and being used.

A simple way to do this is to change:

try:
from rich_click import *
except ImportError:
from click import *

To:

#: Whether ``rich_click`` is installed or not.
is_rich: bool

try: 
    from rich_click import * 
    is_rich = True
except ImportError: 
    from click import * 
    is_rich = False

Then feud.click.is_rich can be used within the code base or by the user.

Existing parts of the code base relying on similar checks should be updated to re-use this variable.

Dynamic addition of commands to a `Group`

Does this suggestion already exist?

  • This is a new feature!

Feature description

Currently commands must be specified as members of a Group subclass when the subclass is defined, i.e.:

import feud

class CLI(feud.Group):
    def func():
        pass

In some cases, it may be useful to define the group first, then add the command later, e.g.:

import feud

def func1():
    pass

def func2():
    pass

class CLI(feud.Group):
    pass

CLI.add_commands(func1, func2)

Where func1/func2 may be a function, or a click.Command generated from @feud.command/@click.command/@click.group.

Proposed signature is:

import typing

class Group(...):
    def add_commands(
        cls: type[Group], 
        *args: click.Command | typing.Callable,
        **kwargs: click.Command | typing.Callable,
    ):
        ...

If called with keyword arguments, the key should be used as the name of the attribute added to the Group subclass.

The function should update __feud_commands__ on the subclass, and any other relevant attributes. It should probably check that there isn't already a class member with the same name.

If a function is provided, it should be wrapped with @feud.command(config=cls.__feud_config__).

Parameters before *args are not shown in the help message

Has this already been reported?

  • This is a new bug!

Expected behaviour

All defined options are still shown with or without any *args.

def serve(port: int = 1, watch: bool = True, env: Literal["dev", "prod"] = "dev"):
python "main.py" --help
                                                                       
 Usage: main.py [OPTIONS]                                              
                                                                       
 Start a local HTTP server.                                            
                                                                       
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --port                INTEGER     Server port. [default: 1]         โ”‚
โ”‚ --watch/--no-watch                Watch source code for changes.    โ”‚
โ”‚                                   [default: watch]                  โ”‚
โ”‚ --env                 [dev|prod]  Environment mode. [default: dev]  โ”‚
โ”‚ --help                            Show this message and exit.       โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Observed behaviour

Defined options are not shown if they are not preceded by *args

def serve(port: int = 1, watch: bool = True, env: Literal["dev", "prod"] = "dev"):
python "main.py" --help         
                                                                       
 Usage: main.py [OPTIONS] PORT WATCH {dev|prod}                        
                                                                       
 Start a local HTTP server.                                            
                                                                       
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --help      Show this message and exit.                             โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

If I add * or *args somewhere else except the last, then the rest of the commands after it is now shown

def serve(port: int = 1, watch: bool = True, *, env: Literal["dev", "prod"] = "dev"):
python "main.py" --help
                                                                       
 Usage: main.py [OPTIONS] PORT WATCH                                   
                                                                       
 Start a local HTTP server.                                            
                                                                       
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --env     [dev|prod]  Environment mode. [default: dev]              โ”‚
โ”‚ --help                Show this message and exit.                   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Code to reproduce

No response

Version details

Python: 3.12.1
Feud: 0.1.4
Operating system: Debian 12-bookworm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.