Skip to content

make cli requirements optional #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"-e",
"GIT_EDITOR=code --wait"
],
"postCreateCommand": "pip3 install -e .[dev]",
"postCreateCommand": "pip3 install -e .[cli,dev]",
"customizations": {
"vscode": {
"extensions": [
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
tests:
name: ${{ matrix.session }} ${{ matrix.python-version }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand All @@ -31,7 +31,7 @@ jobs:
run: pip install pip

- name: Setup
run: pip install -e .[dev]
run: pip install -e .[cli,dev]

- name: Run Pytest
run: pytest tests
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ it's a vacuum.

If you have a recent version of Python 3, you should be able to
do `pip install py-sucks` to get the most recently released version of
this.
this. In order to use the command line (cli) tool, you need to install
the additional cli requirements by `pip install py-sucks[cli]`

## Usage

Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
"sleekxmppfs>=1.4.1",
"click>=6",
"requests>=2.18",
"pycryptodome>=3.4",
"pycountry-convert>=0.5",
],
# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
# for example:
# $ pip install -e .[dev,test]
extras_require={
"cli": ["click>=6", "pycountry-convert>=0.5"],
"dev": ["pytest", "requests-mock>=1.3"],
},
# If there are data files included in your packages that need to be
Expand Down
12 changes: 10 additions & 2 deletions sucks/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
import itertools
import os
import platform
import sys
import random
import re

import click
from pycountry_convert import country_alpha2_to_continent_code
try:
import click
from pycountry_convert import country_alpha2_to_continent_code
except ImportError:
print(
"The extra dependencies are missing, "
"please use 'pip install py-sucks[cli]' to install them."
)
sys.exit(1)

from sucks import *

Expand Down
Loading