Skip to content

[Feature Request] Ability to copy module from another project via cli #69

Description

@rnbokade

As a User I want ability to copy module and exported functionalities from external project.
E.g.
Someone has implemented Auth Module in their template project, I want to be able to do pynet c https:/github.com/somer_repo#somebranch -m ModuleNameToCopy -T TargetModuleName
This would allow us to create sort of pynest specific package repos e.g. there are repos for Django applications

Activity

  1. ItayTheDar commented on Jul 18, 2024

    @ItayTheDar
    Contributor

    Hi @rnbokade , I really like this idea. I'm adding here a more whole feature request -

    Feature Request: PyNest Module Copy Command

    User Story

    As a user, I want the ability to copy a module and its exported functionalities from an external project.

    Example Use Case:

    If someone has implemented an Auth Module in their template project, the user wants to be able to copy it into their own project using a command like:

    pynest c https:/github.com/some_repo#some_branch -m ModuleNameToCopy -T TargetModuleName

    This would allow for the creation of PyNest-specific package repositories, similar to how there are repositories for Django applications.

    Clarifying the Requirements

    Source and Target Repositories:

    • Source Repository: The repository from which the module will be copied.
    • Target Repository: The repository into which the module will be copied.

    Module Names:

    • ModuleNameToCopy: The name of the module in the source repository.
    • TargetModuleName: The name of the module in the target repository after copying.

    Command Functionality:

    • The command should pull the specified module and integrate it into the target project seamlessly.
    • It should handle dependencies and configurations necessary for the module to function in the new environment.

    Guiding Questions

    Repositories and Branches:

    1. Can you provide the exact URL of the source repository and the branch from which the module needs to be copied?
    2. Do you have access to both the source and target repositories?

    Modules and Dependencies:

    1. What is the name of the module you want to copy from the source repository?
    2. What should be the name of the module in the target repository?
    3. Are there any specific dependencies that the module relies on? If yes, should these be copied or referenced separately?

    Target Environment:

    1. Is the target project already set up to use PyNest, or will additional setup be required?
    2. Are there any existing modules in the target project that might conflict with the new module?

    Implementation Details:

    1. Should the command handle any necessary environment configurations (e.g., .env files, database connections)?
    2. Are there any specific files or directories that should be excluded or included during the copy process?

    Implementation Steps

    1. Clone the Source Repository

    Use Git commands to clone the specified branch of the source repository.

    git clone -b some_branch https://github.com/some_repo temp_repo

    2. Copy the Module

    Navigate to the module directory and copy its contents to the target project.

    cp -r temp_repo/path/to/ModuleNameToCopy target_repo/path/to/TargetModuleName

    3. Update Configurations

    Adjust any configurations in the target project to ensure compatibility (e.g., import paths, environment variables).

    4. Install Dependencies

    Install any additional dependencies required by the copied module.

    5. Clean Up

    rm -rf temp_repo

    Example Command Workflow

    Cloning the Repository:

    git clone -b some_branch https://github.com/some_repo temp_repo

    Copying the Module:

    cp -r temp_repo/path/to/ModuleNameToCopy target_repo/path/to/TargetModuleName

    Updating Configurations and Dependencies:

    Modify import paths, and environment variables, and install necessary dependencies.

    Cleaning Up:

    rm -rf temp_repo
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