-
-
Notifications
You must be signed in to change notification settings - Fork 12
feat: Add conflict
command to differentiate versioning
#292
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
+1,388
−106
Merged
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
eba184b
feat: add deps and update config file
zhravan 16a4b53
feat: register the command conflict
zhravan f308257
feat: add messages and test cases to handle errors | core business lo…
zhravan 3d1e12f
feat: add all commands
zhravan 2e7ea8b
feat: remove duplicates and refine the commands
zhravan 5f1f047
chore: resolve conflicts
zhravan 707951a
self-review: claenup logic and commands
zhravan 1352f0b
test-case: refactoring and add test cases
zhravan 754b250
self-review: use existing outputformatter
zhravan e0d6144
feat:review comments
zhravan cc2f81a
chores: address review comments
zhravan e9e98fe
chores: address review comments
zhravan 7c77fa6
chores: address review comments | test cases fixed
zhravan 7fd957e
Merge branch 'feat/cli' into feat/cli_/conflict
raghavyuva 55830f1
Merge branch 'feat/cli' of github.com:raghavyuva/nixopus into feat/cl…
zhravan 0c6373e
Merge branch 'feat/cli_/conflict' of github.com:shravan20/nixopus int…
zhravan 8ed4187
chores: refactoring the code
zhravan 986dabf
chores: update .gitignore
zhravan fd85279
chore: resolve conflicts
zhravan 8721a35
chore: resolve conflicts
zhravan 902fd85
feat: development configs and prod configs separations
zhravan 44946e0
chores: addressed review comments
zhravan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,60 @@ | ||
.PHONY: help install install-dev test test-cov lint clean format check build publish dev run | ||
.PHONY: help setup test test-cov lint clean format check build publish dev nixopus | ||
|
||
help: | ||
@echo "Available commands:" | ||
help: ## Show available commands | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
|
||
install: | ||
poetry install | ||
setup: ## Setup Python environment and install dependencies | ||
@if command -v poetry >/dev/null 2>&1; then \ | ||
poetry install --with dev; \ | ||
echo "Environment ready! Use: make nixopus ARGS=\"command\""; \ | ||
else \ | ||
echo "Poetry not found. Install: curl -sSL https://install.python-poetry.org | python3 -"; \ | ||
exit 1; \ | ||
fi | ||
|
||
install-dev: | ||
poetry install --with dev --no-root | ||
|
||
test: | ||
test: ## Run tests | ||
poetry run pytest | ||
|
||
test-cov: | ||
poetry run pytest --cov=core --cov=utils --cov-report=term-missing --cov-report=html | ||
|
||
test-watch: | ||
poetry run pytest-watch | ||
test-cov: ## Run tests with coverage | ||
poetry run pytest --cov=app --cov-report=term-missing --cov-report=html | ||
|
||
lint: | ||
lint: ## Run linting | ||
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
|
||
format: | ||
format: ## Format code | ||
poetry run black . | ||
poetry run isort . | ||
|
||
check: | ||
$(MAKE) lint | ||
$(MAKE) test | ||
|
||
clean: | ||
rm -rf build/ | ||
rm -rf dist/ | ||
rm -rf *.egg-info/ | ||
rm -rf .pytest_cache/ | ||
rm -rf htmlcov/ | ||
rm -rf .coverage | ||
check: ## Run linting and tests | ||
$(MAKE) lint && $(MAKE) test | ||
|
||
clean: ## Clean build artifacts | ||
rm -rf build/ dist/ *.egg-info/ .pytest_cache/ htmlcov/ .coverage | ||
find . -type d -name __pycache__ -delete | ||
find . -type f -name "*.pyc" -delete | ||
|
||
build: | ||
build: ## Build the package | ||
poetry build | ||
|
||
publish: | ||
publish: ## Publish to PyPI | ||
poetry publish | ||
|
||
dev: | ||
dev: ## Activate development shell | ||
poetry shell | ||
|
||
run: | ||
poetry run nixopus | ||
nixopus: ## Run nixopus CLI | ||
zhravan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@if [ -z "$(ARGS)" ]; then \ | ||
poetry run nixopus --help; \ | ||
else \ | ||
poetry run nixopus $(ARGS); \ | ||
fi | ||
|
||
conflict: ## Run conflict command | ||
poetry run nixopus conflict $(ARGS) | ||
|
||
preflight: ## Run preflight command | ||
poetry run nixopus preflight $(ARGS) | ||
|
||
version: ## Show version | ||
poetry run nixopus version |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import typer | ||
from .conflict import ConflictConfig, ConflictService | ||
from .messages import conflict_check_help, error_checking_conflicts | ||
from app.utils.logger import Logger | ||
|
||
conflict_app = typer.Typer(help=conflict_check_help, no_args_is_help=False) | ||
|
||
|
||
@conflict_app.callback(invoke_without_command=True) | ||
def conflict_callback( | ||
ctx: typer.Context, | ||
config_file: str = typer.Option("helpers/config.prod.yaml", "--config-file", "-c", help="Path to configuration file"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use config to load this default option |
||
timeout: int = typer.Option(5, "--timeout", "-t", help="Timeout for tool checks in seconds"), | ||
verbose: bool = typer.Option(False, "--verbose", "-v", help="Verbose output"), | ||
output: str = typer.Option("text", "--output", "-o", help="Output format (text/json)"), | ||
) -> None: | ||
"""Check for tool version conflicts""" | ||
if ctx.invoked_subcommand is None: | ||
try: | ||
logger = Logger(verbose=verbose) | ||
|
||
config = ConflictConfig( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make use of the timeout wrapper here like other commands instead of passing the timeout variable |
||
config_file=config_file, | ||
timeout=timeout, | ||
verbose=verbose, | ||
output=output, | ||
) | ||
|
||
service = ConflictService(config, logger=logger) | ||
result = service.check_and_format(output) | ||
|
||
# Check if there are any conflicts and exit with appropriate code | ||
results = service.check_conflicts() | ||
conflicts = [r for r in results if r.conflict] | ||
|
||
if conflicts: | ||
logger.error(result) | ||
logger.warning(f"Found {len(conflicts)} version conflict(s)") | ||
zhravan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
raise typer.Exit(1) | ||
else: | ||
logger.success(result) | ||
logger.info("No version conflicts found") | ||
zhravan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
except Exception as e: | ||
logger = Logger(verbose=verbose) | ||
logger.error(error_checking_conflicts.format(error=str(e))) | ||
raise typer.Exit(1) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.