Make src a package, add collector modules, and allow running src/main.py directly#4
Make src a package, add collector modules, and allow running src/main.py directly#4MahanKenway wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 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".
| 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] |
There was a problem hiding this comment.
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 👍 / 👎.
Motivation
ModuleNotFoundError: No module named 'src'when runningpython src/main.pyand make the project importable as a package for CI and local execution.Description
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__.pyfiles sosrcis a proper package.src/main.pyand add asys.pathfallback sopython src/main.pyworks when__package__is empty, and updatescripts/collector.pyto prepend the repo root tosys.pathand callsrc.main.main()for direct script invocation.requestssession, safer base64 decoding utilities, structured logging viasrc/utils/logger.py, and typed dataclasses forSettingsandConfigobjects.python -m src.main, addrequirements.txt/requirements-dev.txt,pytest.ini,.env.example,.gitignore, license, and contributor docs.tests/test_parser.pyandtests/test_tester.pythat exerciseConfigParserandConfigTesterbehavior.Testing
tests/test_parser.pyandtests/test_tester.pywere added butpytestwas not run.Codex Task