Skip to content

Commit

Permalink
release: v0.1.1 (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
eonu authored Dec 14, 2023
2 parents 11b2609 + 58a33b6 commit eeacf6c
Show file tree
Hide file tree
Showing 48 changed files with 1,866 additions and 360 deletions.
82 changes: 82 additions & 0 deletions .github/issue_templates/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Report unexpected behaviour
description: If you came across something unexpected, let us know here!
labels: [bug, pending]

body:
- type: checkboxes
id: exists
attributes:
label: Has this already been reported?
description: If you haven't already, please look other existing issues to see if this bug has already been reported.
options:
- label: This is a new bug!
required: true

- type: textarea
id: expected-behaviour
attributes:
label: Expected behaviour
description: |
Please describe the behaviour that you expected to see.
If appropriate, provide any links to official Feud documentation that indicate this is the behaviour that is expected.
validations:
required: true

- type: textarea
id: observed-behaviour
attributes:
label: Observed behaviour
description: |
Please describe the unexpected behaviour that you observed.
Make sure to provide as much information as possible, so that we can investigate as thoroughly as we can!
validations:
required: true

- type: textarea
id: example
attributes:
label: Code to reproduce
description: >
Please provide a snippet of code that shows how to reproduce the bug,
making sure that it is [minimal and reproducible](https://stackoverflow.com/help/minimal-reproducible-example).
placeholder: |
"""To reproduce my bug, run the following script with:
python command.py --bug
"""
# command.py
import feud
def command(*, bug: bool = False):
"""Command that demonstrates the bug."""
if bug:
raise ValueError("Woops, this is buggy!")
if __name__ == "__main__":
feud.run(command)
render: Python

- type: textarea
id: version
attributes:
label: Version details
description: |
To help us get to the root of the problem as fast as possible,
please run the following command to display version information about:
- Python
- Feud
- Operating system
```bash
python -c "import feud; print(feud.version.version_info())"
```
render: Text
validations:
required: true
5 changes: 5 additions & 0 deletions .github/issue_templates/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Got a question?
url: "https://github.com/eonu/feud/discussions/new?category=question"
about: Start a discussion on GitHub discussions where Feud developers and users can respond.
21 changes: 21 additions & 0 deletions .github/issue_templates/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Request a new feature or improvement
description: If you have a suggestion for something that might improve feud, let us know here!
labels: [feature, pending]

body:
- type: checkboxes
id: exists
attributes:
label: Does this suggestion already exist?
description: If you haven't already, please look through the documentation and other existing issues to see if this feature is already implemented.
options:
- label: This is a new feature!
required: true

- type: textarea
id: feature-description
attributes:
label: Feature description
description: Please describe the new feature or improvement that you would like.
validations:
required: true
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Description

<!-- If your pull request fixes an existing issue (e.g. #xxx), mention "Fixes #xxx" here. -->

<!-- Please describe the purpose of the pull request. -->
<!-- Provide thorough details about what you changed and why. -->

## Checklist

- [ ] I have added new tests (if necessary).
- [ ] I have ensured that tests and coverage are passing on CI.
- [ ] I have updated any relevant documentation (if necessary).
- [ ] I have used a descriptive pull request title.
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build:
post_install:
- pip install poetry
- poetry config virtualenvs.create false
- poetry install --only base,main,docs -E extra-types
- poetry install --only base,main,docs

sphinx:
configuration: docs/source/conf.py
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

All notable changes to this project will be documented in this file.

## [v0.1.1](https://github.com/eonu/feud/releases/tag/v0.1.1) - 2023-12-14

### Bug Fixes

- change `feud.config` from package to module ([#86](https://github.com/eonu/feud/issues/86))
- use `==` instead of `is` for `typing.Annotated` comparison ([#88](https://github.com/eonu/feud/issues/88))

### Documentation

- add postponed evaluation `README.md` disclaimer ([#92](https://github.com/eonu/feud/issues/92))
- `click.Option` intersphinx reference ([#93](https://github.com/eonu/feud/issues/93))

### Features

- add `email` extra, issue/PR templates, `version` module ([#84](https://github.com/eonu/feud/issues/84))
- add `typing.Pattern` to `feud.typing` ([#85](https://github.com/eonu/feud/issues/85))
- add metavars for `typing.Union` and literal `|` union types ([#89](https://github.com/eonu/feud/issues/89))
- add `Group.__main__()` support ([#90](https://github.com/eonu/feud/issues/90))
- add `feud.env` decorator for env. variable options ([#91](https://github.com/eonu/feud/issues/91))
- add `feud.rename` decorator ([#94](https://github.com/eonu/feud/issues/94))

### Testing

- add test for inheritance command override ([#87](https://github.com/eonu/feud/issues/87))

## [v0.1.0](https://github.com/eonu/feud/releases/tag/v0.1.0) - 2023-12-05

### Build System
Expand Down
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

## About

> [!CAUTION]
> [!WARNING]
> _Writing command-line interfaces can get messy!_
It is not uncommon for CLIs to consist of many commands,
Expand All @@ -75,7 +75,7 @@ somewhat verbose and often requires frequently looking up documentation.

Consider the following example command for serving local files on a HTTP server.

In red is a typical Click implementation, and in green is the Feud equivalent.
**In red is a typical Click implementation, and in green is the Feud equivalent.**

```diff
- import click
Expand Down Expand Up @@ -472,8 +472,8 @@ $ python blog.py post list --help

### Powerful typing

Feud is powered by Pydantic – a validation library with extensive support for
many data types, including:
Feud is powered by [Pydantic](https://docs.pydantic.dev/latest/) – a
validation library with extensive support for many data types, including:

- simple types such as integers and dates,
- complex types such as emails, IP addresses, file/directory paths, database
Expand Down Expand Up @@ -742,29 +742,40 @@ You can install Feud using `pip`.
The latest stable version of Feud can be installed with the following command.

```console
pip install feud[all]
pip install "feud[all]"
```

This installs Feud with the optional dependencies:

- [**`rich-click`**](https://github.com/ewels/rich-click) (can install individually with `pip install feud[rich]`)<br/>
- [`rich-click`](https://github.com/ewels/rich-click) (can install individually with `pip install "feud[rich]"`)<br/>
_Provides improved formatting for CLIs produced by Feud._
- [**`pydantic-extra-types`**](https://github.com/pydantic/pydantic-extra-types) (can install individually with `pip install feud[extra-types]`)<br/>
- [`pydantic-extra-types`](https://github.com/pydantic/pydantic-extra-types) (can install individually with `pip install "feud[extra-types]"`)<br/>
_Provides additional types that can be used as type hints for Feud commands._
- [`email-validator`](https://github.com/JoshData/python-email-validator) (can install individually with `pip install "feud[email]"`)<br/>
_Provides Pydantic support for email validation._

To install Feud without any optional dependencies, simply run `pip install feud`.

> [!CAUTION]
> Feud **will break** if used with postponed type hint evaluation ([PEP563](https://peps.python.org/pep-0563/)), i.e.:
>
> ```python
> from __future__ import annotations
> ```
>
> This is because Feud relies on type hint evaluation in order to determine the expected input type for command parameters.
### Improved formatting with Rich
Below is a demonstration of the difference between using Feud with and without `rich-click`.
Below is a comparison of Feud with and without `rich-click`.
<table>
<tr>
<th>
With Rich
With Rich-formatted output
</th>
<th>
Without Rich
Without Rich-formatted output
</th>
</tr>
<tr>
Expand Down Expand Up @@ -883,7 +894,7 @@ All contributions to this repository are greatly appreciated. Contribution guide
> <img src="https://i.postimg.cc/jq3MZSTD/avatar.png" align="left"/>
> <b>We're living in an imperfect world!</b><br/>
> <sup>Feud is in a public beta-test phase, likely with <em>lots</em> of bugs. Please leave feedback if you come across anything strange!</sup>
> <sup>Feud is in a public beta-test phase, likely with <em>lots</em> of bugs. Please <a href="https://github.com/eonu/feud/issues/new">leave feedback</a> if you come across anything strange!</sup>
## Licensing
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
project = "feud"
copyright = "2023-2025, Feud Developers" # noqa: A001
author = "Edwin Onuonga (eonu)"
release = "0.1.0"
release = "0.1.1"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
12 changes: 6 additions & 6 deletions docs/source/sections/config/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Configuration
=============

.. contents:: Table of Contents
:class: this-will-duplicate-information-and-it-is-still-useful-here
:local:
:backlinks: none
:depth: 3

:doc:`../core/command` are defined by :py:func:`.command`,
which accepts various Feud configuration key-word arguments such as
``negate_flags`` or ``show_help_defaults`` directly.
Expand All @@ -15,12 +21,6 @@ object that can be provided to other commands or groups. This functionality is
implemented by :py:func:`.config`, which creates a configuration which can be
provided to :py:func:`.command` or :py:class:`.Group`.

.. contents:: Table of Contents
:class: this-will-duplicate-information-and-it-is-still-useful-here
:local:
:backlinks: none
:depth: 3

----

API reference
Expand Down
12 changes: 6 additions & 6 deletions docs/source/sections/core/command.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Commands
========

.. contents:: Table of Contents
:class: this-will-duplicate-information-and-it-is-still-useful-here
:local:
:backlinks: none
:depth: 3

Commands are the core component of a CLI, running a user-defined function that
may be parameterized with arguments or options.

Expand All @@ -18,12 +24,6 @@ Commands may be executed using :py:func:`.run`.
- `Arguments <https://click.palletsprojects.com/en/8.1.x/arguments/>`__
- `Options <https://click.palletsprojects.com/en/8.1.x/options/>`__

.. contents:: Table of Contents
:class: this-will-duplicate-information-and-it-is-still-useful-here
:local:
:backlinks: none
:depth: 3

----

Understanding function signatures
Expand Down
12 changes: 6 additions & 6 deletions docs/source/sections/core/group.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Groups
======

.. contents:: Table of Contents
:class: this-will-duplicate-information-and-it-is-still-useful-here
:local:
:backlinks: none
:depth: 3

Groups are a component of CLIs that allow you to group together related :doc:`command`.

In addition to commands, groups may also contain further nested groups by :py:obj:`.register`\ ing subgroups,
Expand All @@ -18,12 +24,6 @@ Groups and their subgroups or commands can be executed using :py:func:`.run`.
- `Arguments <https://click.palletsprojects.com/en/8.1.x/arguments/>`__
- `Options <https://click.palletsprojects.com/en/8.1.x/options/>`__

.. contents:: Table of Contents
:class: this-will-duplicate-information-and-it-is-still-useful-here
:local:
:backlinks: none
:depth: 3

----

API reference
Expand Down
12 changes: 6 additions & 6 deletions docs/source/sections/decorators/alias.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Aliasing parameters
===================

.. contents:: Table of Contents
:class: this-will-duplicate-information-and-it-is-still-useful-here
:local:
:backlinks: none
:depth: 3

In CLIs, it is common for options to have an alias allowing
for quicker short-hand usage.

Expand Down Expand Up @@ -43,12 +49,6 @@ and can instead rely on type hints and docstrings.

In the case of boolean flags such as ``--verbose`` in this case, the ``--no-verbose``
option will also have a corresponding ``--no-v`` alias automatically defined.

.. contents:: Table of Contents
:class: this-will-duplicate-information-and-it-is-still-useful-here
:local:
:backlinks: none
:depth: 3

----

Expand Down
Loading

0 comments on commit eeacf6c

Please sign in to comment.