Skip to content

File store operations, refactor and ruff fixes#26

Merged
bdc34 merged 16 commits intodevelopfrom
bdc34/submission-35
Mar 18, 2026
Merged

File store operations, refactor and ruff fixes#26
bdc34 merged 16 commits intodevelopfrom
bdc34/submission-35

Conversation

@bdc34
Copy link
Contributor

@bdc34 bdc34 commented Mar 18, 2026

Refactor to move submit_ce.api.domain to submit_ce.domain to avoid circular imports

This is to avoid circular imports. Having domain under submit_ce.api caused circular imports due to it importing many packages for exporting as a "exposing the API" pattern.

Avoiding circular imports also included using a pattern like:

# force all types to be just strings at run time
from __future__ import annotations
...

if TYPE_CHECKING:
    # Only import submitapi at type check time since it is only used for type checking
    # i.e. it is not used for functions or class instantiation 
    from submit_ce.api.submit import SubmitApi

fixes ruff errors

Many ruff errors are fixed.

changes to pytest config in pyproject.toml

I found the config of pytest a bit surprising and dialed back some of the configs in pyproject.toml

bdc34 added 12 commits March 18, 2026 11:31
- Added `get_source_file_info` and `store_source_file` to `SubmissionFileStore`
- Implemented `get_source_file_info` and `store_source_file` in `GsFileStore`
- Rename `Upload` to `Workspace`
- add `yarl` for `URL`
- Changes `Workspace` `FileError` and  `FileStatus` to pydantic instead of `NamedTuple`
- Added `crc32c`, `url` and `is_versioned` to
- In `FileStatus` renamed `size` to `bytes` for explicit units
- In `FileStatus` renamed `file_type` to `content_type`
- Added `AddFiles`, `RemoveFiles`, and `RemoveAllFiles` events to
  `submit_ce/api/domain/event/file.py`. These inherit from
  `EventWithSideEffect` and interact with the `SubmitApi`
- Added unit tests
- Extracted the `SubmitFile` Protocol into a dedicated `types.py`
  file to resolve a circular import
- Unified the `SubmissionFileStore` return types,
  updating `get_source_file` to return an `arxiv.files.FileObj`
- Added missing abstract methods to the `SubmissionFileStore` interface.
- Implemented previously missing methods in the `GsFileStore`
- Added stub methods to `LegacyFileStore` to satisfy the updated
  abstract base class
- Changes to github workflow to standardize coverage config with pyproject
- Adds test.sh to run tests similar to GHA
also fixes some ruff errors, moves
This is to fix circular import problems. The domain objects are no longer under
submit_ce.api so they can successfully import and use api objects for typing. It
is safe to use them just for typing since no functions are called and no classes
instanciated. This is done with `annotations` and `TYPE_CHECKING` conditions.

- Fixes ruff errors
- Tests at get past import errors
Tests all pass
No linting errors
More work on moving domain to its own packages
@bdc34 bdc34 requested a review from DavidLFielding as a code owner March 18, 2026 15:42
bdc34 added 3 commits March 18, 2026 11:47
Also removes dome validation from submit_ce/domain/annotation.py since it is now
handled by pydantic
@bdc34
Copy link
Contributor Author

bdc34 commented Mar 18, 2026

Added some tests to get test coverage up.

current_run = ''

last_run = False
# last_run = False

Choose a reason for hiding this comment

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

I need to rewrite this module before Submit 2.0 goes live.

Copy link

@DavidLFielding DavidLFielding left a comment

Choose a reason for hiding this comment

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

Looks fine.

@bdc34 bdc34 merged commit d4d77f5 into develop Mar 18, 2026
1 check passed
@bdc34 bdc34 deleted the bdc34/submission-35 branch March 18, 2026 17:54
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