Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python package with expanded testing #278

Merged
merged 71 commits into from
May 15, 2024

Conversation

pchakraborty
Copy link
Collaborator

@pchakraborty pchakraborty commented Apr 16, 2024

This PR addresses some of the concerns raised in #273

  • mepo is now a Python package with

    • src/mepo/__init__.py
    • src/mepo/main.py -> src/mepo/__main__.py. This allows one to execute mepo via python -m mepo.
  • src/mepo/config/config_file.py -> src/mepo/registry.py. So components.yaml is now called a registry, instead of a config file. While this change is mostly internal, it does affect the clone command - the optional argument --config to mepo clone is now --registry.

  • More code reorganization

    • Using Python3's relative import
    • Code from src/mepo/command/command.py is now included in __main__.py
    • src/mepo/command/<command>/<command>.py -> src/mepo/command/<command>.py
      • subcommands are in files src/command/<command_subcommand>.py
    • src/mepo/state/state.py -> src/mepo/state.py
    • src/mepo/state/component.py -> src/mepo/component.py
    • src/mepo/repository/git.py -> src/mepo/git.py
    • Added optional argument -1/--one-per-line for mepo list
  • Expanded testing to cover more mepo commands

  • Since the multiprocessing library now supports the context manager protocol, we can write

    import multiprocessing as mp
    with mp.Pool() as pool:
        result = pool.map(check_component_status, allcomps)

    3412ad7, 376baf2

  • Added linting via Pylint

  • Implemented context manager for os.chdir. We can now do

    from mepo.utilities import chdir as mepo_chdir
    with mepo_chdir(some_path):
        execute_some_command()

    instead of

     import os
     cwd = os.getcwd()
     os.chdir(some_path)
     execute_some_command()
     os.chdir(cwd)

    Using contextlib.chdir when available (3.11+)

  • Formatted code using Black

  • Managing project using Poetry. Closes Poetry for packaging and dependency management  #281

  • Split GitHub actions workflow into three

    • Run mepo tests
    • Run formatter
    • Run linter
  • Using contextlib.redirect_stdout to redirect stdout to variable

  • Switched state file format from pickled (mepo1 style) to json (mepo2 style). Closes State file: pickle to json #284

    • If mepo1 style state is detected, print warning and suggest running mepo update-state
    • Added a new command update-state to permanently convert mepo1 style state to mepo2 style

Maybe 'mepo reset' is causing issues with testing 'mepo tag create'
@pchakraborty pchakraborty requested a review from a team as a code owner April 16, 2024 22:15
@pchakraborty pchakraborty self-assigned this May 14, 2024
@pchakraborty pchakraborty added the enhancement New feature or request label May 14, 2024
@pchakraborty
Copy link
Collaborator Author

@mathomp4 I think this is ready for merge. Converting to PR.

@pchakraborty pchakraborty marked this pull request as ready for review May 14, 2024 18:21
Copy link
Member

@mathomp4 mathomp4 left a comment

Choose a reason for hiding this comment

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

Approve!

@mathomp4 mathomp4 merged commit 53ffe8a into develop May 15, 2024
17 checks passed
@mathomp4 mathomp4 deleted the feature/pchakrab/mepo-module-etc branch May 15, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants