Skip to content

Refactor file I/O to use context managers and fix bare excepts #12

Closed

Description

@avinxshKD

I've been digging through mkconcore.py and concore.py, and I noticed we're opening a lot of files without context managers (with statements). While CPython's GC usually handles cleanup, it's not guaranteed and can lead to file descriptor leaks, especially during complex I/O operations or if the script crashes.

Also, there are several except: blocks that catch everything (including KeyboardInterrupt and SystemExit). This makes debugging a pain because you can't easily kill the process if it hangs in a loop, and it masks actual errors we might want to see.

I'd like to refactor these file operations to use with open(...) as f: and narrow down the exception handling to specific errors like IOError or FileNotFoundError. It's a bit of housekeeping but will make the codebase much more robust.

Activity

  1. avinxshKD commented on Feb 11, 2026

    @avinxshKD
    Author

    @pradeeban @Rahuljagwani Let me know if this makes sense, ill raise a PR. Thanks

  2. avinxshKD commented on Feb 11, 2026

    @avinxshKD
    Author

    Hi, @pradeeban @Rahuljagwani

    Just wanted to ask if there are any community calls or project meets around the org. Would be so nice to join if something like that happens.

    Hve been working on the project for around 5–6 weeks now. Still learning, but improving with each PR. Got a bunch merged, a few closed too, BUT learned from all of it. Hoping to keep doing better.

    Lastly Thanks for all the work you put into maintaining the org.

  3. pradeeban commented on Feb 11, 2026

    @pradeeban
    Member

    @avinxshKD sure, you can go ahead. The project was largely done by GSoC contributors from 4 years: 2021 (1 contributor as part of Emory-BMI), 2022 (2 contributors as part of Emory-BMI), 2023 (3 contributors as part of Emory-BMI), and 2025 (1 contributor as part of Alaska). So it makes sense some of these issues were overlooked as we focused on features. Good to fix these.

    We do not have meetings at this point. But once we have an accepted contributor, we will have weekly meetings that last an hour.

  4. pradeeban commented on Feb 11, 2026

    @pradeeban
    Member

    Also, @avinxshKD, make sure to fix the critical mistakes and bugs in the concore repository. concore-lite is just a minimal tutorial repository. We must fix the breaking issues here. Other than that, we can choose to live with many bugs here, as we otherwise will be essentially maintaining two separate repositories and cherrypicking the fixes between the repositories. Not an efficient use of time.

  5. avinxshKD commented on Feb 12, 2026

    @avinxshKD
    Author

    hey thanks for the context @pradeeban

    Understood our priority, I'll focus on fixing critical issues in the main concore repository first. This refactor in concore-lite is straightforward, so I'll knock it out quickly and then shift attention to identifying and fixing breaking bugs in the primary repo.

    Appreciate the heads-up on the project history. Makes sense why some of these housekeeping items slipped through when features were the main focus.

    I'll have the PR up shortly for this one and start auditing concore for more serious issues. Already fixed some issues from main today, do check when free,

    Also wanted to ask you the prefrred date for the proposal as im already working on it, thanks again🌸

  6. pradeeban commented on Feb 13, 2026

    @pradeeban
    Member

    @avinxshKD I did not realize this issue was raised in concore-lite. It is our mostly dormant tutorial repository. Can you instead make the same change to the respective file in the concore repository instead?

    Also, this should be two different issues and PRs:

    1. Refactor file I/O to use context managers
    2. Fix bare excepts.
  7. avinxshKD commented on Feb 13, 2026

    @avinxshKD
    Author

    @pradeeban understood, thanks for the clarification.
    I will make the changes in the main concore repository and split them into two separate issues and PRs as suggested

  8. avinxshKD commented on Feb 13, 2026

    @avinxshKD
    Author

    Hey @pradeeban just wanted to need your advice, should I focus contributions only on the main concore repository for now..or is there anything specific you’d like worked on in concore-lite as well?

  9. pradeeban commented on Feb 13, 2026

    @pradeeban
    Member

    Pls no fixes to concore-lite. The only change we were doing was to incorporate the PR review bot and to fix anything critical. We cannot afford to maintain concore and concore-lite. concore-lite is largely just a subset of concore. @avinxshKD

  10. avinxshKD commented on Feb 13, 2026

    @avinxshKD
    Author

    @pradeeban understood, thanks for clarifying. I’ll focus my contributions on the main concore repository going forward and will come up with relevant issues nd improvements there Thanks 🌸

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions