Skip to content

Make src a package, add collector modules, and allow running src/main.py directly#4

Open
MahanKenway wants to merge 2 commits into
mainfrom
codex/find-issues-in-the-code-rrvgbr
Open

Make src a package, add collector modules, and allow running src/main.py directly#4
MahanKenway wants to merge 2 commits into
mainfrom
codex/find-issues-in-the-code-rrvgbr

Conversation

@MahanKenway
Copy link
Copy Markdown
Owner

Motivation

  • Fix ModuleNotFoundError: No module named 'src' when running python src/main.py and make the project importable as a package for CI and local execution.
  • Provide a structured implementation for collecting, parsing, testing, exporting, and notifying about V2Ray configs to replace the previous single-script approach.
  • Improve CI workflow to run the collector as a module and add basic project metadata and developer tooling files.

Description

  • Add package layout under src/ with modules for settings (src/config), sources (src/config/sources.py), collection (src/core/collector.py), parsing (src/core/parser.py), testing (src/core/tester.py), exporting (src/core/exporter.py), notifying (src/core/notifier.py), models (src/models), and utilities (src/utils), plus __init__.py files so src is a proper package.
  • Implement src/main.py and add a sys.path fallback so python src/main.py works when __package__ is empty, and update scripts/collector.py to prepend the repo root to sys.path and call src.main.main() for direct script invocation.
  • Improve robustness of network calls with retrying requests session, safer base64 decoding utilities, structured logging via src/utils/logger.py, and typed dataclasses for Settings and Config objects.
  • Update GitHub Actions workflow to install dependencies and run the collector via python -m src.main, add requirements.txt/requirements-dev.txt, pytest.ini, .env.example, .gitignore, license, and contributor docs.
  • Add unit tests for parsing and tester logic in tests/test_parser.py and tests/test_tester.py that exercise ConfigParser and ConfigTester behavior.

Testing

  • No automated tests were executed in this rollout; test files tests/test_parser.py and tests/test_tester.py were added but pytest was not run.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c092c98dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/core/parser.py
Comment on lines +64 to +71
data = config[5:]
data = data.split("#", 1)[0]
if "@" not in data:
decoded = decode_base64(data)
if not decoded:
return None
data = decoded
data = data.split("?", 1)[0]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle ss:// base64 URLs with query params

In _parse_shadowsocks, the code tries to base64-decode the entire substring after ss:// before stripping query parameters. For common Shadowsocks URIs like ss://<base64>?plugin=..., the ?plugin=... suffix makes the base64 decode fail, so these configs are dropped even though they are valid and should be parsed. Consider removing the query portion before attempting to decode, otherwise plugin-enabled SS configs will never be collected/tested.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant