Skip to content
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
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Check out the docs:
Open CI pipeline on your default browser:

```bash
ciopen
$ ciopen
```

---
Expand All @@ -37,16 +37,16 @@ ciopen
### Using `pip`

```bash
pip install ciopen
$ pip install ciopen
```

### Using pip (editable / dev mode)

```bash
git clone https://github.com/mel-cdn/ciopen.git
cd ciopen
pipenv shell # or activate your virtualenv
./run-checks.sh # Install all dependencies
$ git clone https://github.com/mel-cdn/ciopen.git
$ cd ciopen
$ pipenv shell # or activate your virtualenv
$ ./run-checks.sh # Install all dependencies
```

---
Expand All @@ -56,7 +56,7 @@ pipenv shell # or activate your virtualenv
Show helpful CLI documentation:

```bash
ciopen --help
$ ciopen --help

Usage: ciopen [OPTIONS] COMMAND [ARGS]...

Expand All @@ -69,6 +69,7 @@ ciopen --help
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ version Show ciopen version │
│ info Show ciopen information │
│ doctor Check if everything is set up right │
│ provider Show which CI provider is detected │
│ repo Open the main page of this repository │
Expand All @@ -79,15 +80,15 @@ ciopen --help
Open your repository's main page:

```bash
ciopen repo
$ ciopen repo

Opening https://github.com/mel-cdn/ciopen
```

Check if it's going to work with diagnostics:

```bash
ciopen doctor
$ ciopen doctor

ciopen 0.0.5
Running diagnostics...
Expand Down
48 changes: 39 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# -----------------------------
# Build system
# -----------------------------
[build-system]
requires = ["setuptools>=61"]
requires = ["setuptools>=69"]
build-backend = "setuptools.build_meta"

# Project metadata
# -----------------------------
# Project metadata (PyPI)
# -----------------------------
[project]
name = "ciopen"
version = "0.0.8"
Expand All @@ -12,19 +16,44 @@ readme = { file = "README.md", content-type = "text/markdown" }
license = "MIT"
license-files = ["LICENSE"]
authors = [
{ name = "Mel Cadano", email = "mel.cdn@outlook.ph" },
{ name = "Mel Cadano", email = "mel.cdn@outlook.ph" }
]

requires-python = ">=3.11"

keywords = ["cli", "ci", "github-actions", "devtools", "automation"]


classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Environment :: Console",
"Topic :: Software Development :: Build Tools",
]
dependencies = [
"typer>=0.24.1"
"typer>=0.12"
]

# CLI entry points
# -----------------------------
# CLI entry point
# -----------------------------
[project.scripts]
ciopen = "ciopen.cli:app"

# Dev dependencies
# -----------------------------
# Project links (shown on PyPI)
# -----------------------------
[project.urls]
Homepage = "https://github.com/mel-cdn/ciopen"
Repository = "https://github.com/mel-cdn/ciopen"
Issues = "https://github.com/mel-cdn/ciopen/issues"
Changelog = "https://github.com/mel-cdn/ciopen/blob/main/CHANGELOG.md"

# -----------------------------
# Optional Dev dependencies
# -----------------------------
[project.optional-dependencies]
dev = [
"pytest==9.0.2",
Expand All @@ -33,7 +62,9 @@ dev = [
"conventional-pre-commit==4.4.0",
]

# Semantic versioning
# -----------------------------
# Semantic Release Configuration
# -----------------------------
[tool.semantic_release]
branch = "main"
version_source = "tag"
Expand All @@ -48,7 +79,6 @@ version_toml = [
"pyproject.toml:project.version",
]

# Optional: override commit parsing
[tool.semantic_release.commit_parser_options]
patch_tags = ["fix", "chore", "docs", "style", "refactor", "test"]
minor_tags = ["feat"]
Expand Down
4 changes: 3 additions & 1 deletion src/ciopen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from importlib.metadata import version
from importlib.metadata import metadata, version

__version__ = version("ciopen")

__author__ = metadata("ciopen")["Author-email"]
2 changes: 2 additions & 0 deletions src/ciopen/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import typer

from ciopen.commands.doctor import doctor_command
from ciopen.commands.info import info_command
from ciopen.commands.open import open_command
from ciopen.commands.pr import pr_command
from ciopen.commands.provider import provider_command
Expand All @@ -12,6 +13,7 @@
app.callback(invoke_without_command=True)(open_command)

app.command(name="version", help="Show ciopen version")(version_command)
app.command(name="info", help="Show ciopen information")(info_command)
app.command(name="doctor", help="Check if everything is set up right")(doctor_command)
app.command(name="provider", help="Show which CI provider is detected")(provider_command)
app.command(name="repo", help="Open the main page of this repository")(repo_command)
Expand Down
10 changes: 10 additions & 0 deletions src/ciopen/commands/info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import typer

from ciopen import __author__, __version__


def info_command() -> None:
typer.echo(f"ciopen {__version__}")
typer.echo(f"Author: {__author__}")
# Make this not hard coded in the future
typer.echo("Homepage: https://github.com/mel-cdn/ciopen")
21 changes: 21 additions & 0 deletions tests/integration/test_print.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from contextlib import chdir

from ciopen import __author__, __version__, cli


def test_version_command_should_print_current_version(fx_git_repo, fx_cli_runner):
with chdir(fx_git_repo):
result = fx_cli_runner.invoke(cli.app, ["version"])

assert result.exit_code == 0
assert f"ciopen {__version__}" in result.output


def test_info_command_should_print_information(fx_git_repo, fx_cli_runner):
with chdir(fx_git_repo):
result = fx_cli_runner.invoke(cli.app, ["info"])

assert result.exit_code == 0
assert f"ciopen {__version__}" in result.output
assert f"Author: {__author__}" in result.output
assert f"Homepage: https://github.com/mel-cdn/ciopen" in result.output
11 changes: 0 additions & 11 deletions tests/integration/test_version_print.py

This file was deleted.

18 changes: 18 additions & 0 deletions tests/unit/commands/test_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from unittest.mock import call, patch

from ciopen.commands.info import info_command


@patch(f"{info_command.__module__}.typer.echo", spec=True)
@patch(f"{info_command.__module__}.__author__", spec=True)
@patch(f"{info_command.__module__}.__version__", spec=True)
def test_info_command_should_show_version(m_version, m_author, m_echo):
m_version.__str__.return_value = "1.2.3"
m_author.__str__.return_value = "Name of Author"

assert info_command() is None
assert m_echo.mock_calls == [
call("ciopen 1.2.3"),
call("Author: Name of Author"),
call("Homepage: https://github.com/mel-cdn/ciopen"),
]
1 change: 1 addition & 0 deletions tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def test_cli_help_lists_commands():

# Ensure commands are registered (don’t overfit exact help formatting)
assert "version" in result.stdout
assert "info" in result.stdout
assert "doctor" in result.stdout
assert "provider" in result.stdout
assert "repo" in result.stdout
Expand Down