Skip to content

2026 rewrite#3

Open
peleccom wants to merge 16 commits intomasterfrom
2026-rewrite
Open

2026 rewrite#3
peleccom wants to merge 16 commits intomasterfrom
2026-rewrite

Conversation

@peleccom
Copy link
Owner

@peleccom peleccom commented Feb 7, 2026

No description provided.

peleccom-aibot and others added 16 commits February 7, 2026 17:54
- Move to src/ directory structure following modern Python packaging standards
- Rename modules for clarity:
  - byflyuser.py -> html_client.py
  - byflyapi.py -> api_client.py
  - byfly.py -> cli.py
- Add traffic details support for API v2
  - New get_traffic_details() method
  - Traffic details display in table format
  - Multiple internet login detection with explicit selection
- Clean CLI interface with clear separation of API v1 vs v2 auth models
  - API v1: --login/--password (deprecated)
  - API v2: --account-phone/--account-password (default)
  - --internet-login for explicit selection when multiple logins exist
- Add comprehensive test suite (45 tests)
  - test_models.py: Data model tests
  - test_api_client.py: API client tests
  - test_cli.py: CLI tests
- Version bump to 3.2
- Replace Optional[X] with X | None (UP045)
- Fix uppercase variable names: LANG_ID, TABLE_RE, ROW_RE, CELL_RE (N806)
- Fix blind Exception catch in test (B017)
- Remove unused Optional imports (F401)
- Delete tests/__init__.py to fix N999

All 45 tests passing, all ruff checks clean
Deleted legacy files that have been replaced by src/ structure:
- byfly.py -> src/byflypy/cli.py
- byflyuser.py -> src/byflypy/html_client.py
- byflyapi.py (already removed earlier)
- database.py -> src/byflypy/database.py
- plotinfo.py -> src/byflypy/plotter.py
- tests.py -> tests/ directory
- __init__.py (root)

All functionality now lives in src/byflypy/ with proper package structure
- Switch build system from setuptools to hatchling
- Add [tool.hatch.build.targets.wheel] configuration
- Update dependency-groups to use modern uv format
- Add matplotlib to dev dependencies for tests
- Expand ruff configuration with comprehensive rule set
- Add ignore rules for project-specific patterns (Cyrillic text, etc.)
- Update classifiers with more detailed metadata
- Add project.urls with Issues link
- Fix all ruff errors to comply with new stricter rules
- Add coverage configuration
- Update mypy configuration
- Add --access-token (-t) option to skip login with phone/password
- Add --account-phone and --account-password for API v2 authentication
- Add -l/--login option to specify contract by login number
- Print access token after successful login
- Add _to_decimal() helper for safe Decimal parsing
- Replace contract_id parameter with login for user-friendly contract selection
- Validate --login value against available contracts
- Move imports to top level for linter compliance
- Add coverage report to make test
- Add tests for access token, Decimal parsing, and HTML parsing with testdata files
- Remove dead code: _refresh_token(), --contract-id, --internet-login options
- Add btk_id field to ApiContract for direct access to internet login ID
- Replace --login/-l option with --btk-id for specifying internet login
- Use btk_id from contract response instead of btk_login from applications
- Update validation logic to find and set contract by btk_id
- Update tests to use btk_id instead of login
- Update help text to clarify Btk ID is the internet login
- Add ErrorDatabase exception and Record class to database module
- Add Table methods: list(), add(), get(), delete(), create_table_if_not_exists()
- Add DBManager helper methods for password management
- Create tests/test_database.py with tests for:
  - TestRecord: Record dataclass tests
  - TestDBManager: DBManager password operations
  - TestTable: Table operations
  - TestDatabaseIntegration: File-based integration tests
  - TestLogToFile: log_to_file function tests

Total: 21 new tests for database functionality
- Add __del__ method to auto-close SQLite connections
- Add context manager to Table class
- Update test teardown to close connections properly
- Use context manager in integration tests
- Replace setup_method/teardown_method with @pytest.fixture
- Create reusable table and db_manager fixtures
- Use yield pattern for automatic cleanup
- Create clients/ package
- Move api_client.py and html_client.py to clients/
- Add clients/__init__.py with re-exports
- Update all imports in cli.py, tests, and __init__.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants