Skip to content

Code organisation can be improved #60

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

Closed
1 task
dhruvkb opened this issue Aug 14, 2020 · 8 comments · Fixed by #143
Closed
1 task

Code organisation can be improved #60

dhruvkb opened this issue Aug 14, 2020 · 8 comments · Fixed by #143
Assignees
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix help wanted Open to participation from the community 💪 skill: python Requires proficiency in 'Python' 🏷 status: label work required Needs proper labelling before it can be worked on

Comments

@dhruvkb
Copy link
Member

dhruvkb commented Aug 14, 2020

Description

Currently the code in the repository is organised in directories on the basis of the GitHub Actions workflow they enable, each with its own Python environment and each independent of the other. This however does not take into account that multiple workflows may share code, utility functions and constants with each other.

For example in #58, a number of constants and functions were duplicated from push_data_to_ccos/ to sync_community_team/ because the way the repos are organised prohibits sharing. I believe the code can be better organised to be more DRY, all the while maintaining a reasonable amount of separation between the different workflows.

Reproduction

  1. Write a new workflow
  2. Observe inability to reuse existing code
  3. Feel dread as you copy code, verbatim, from one folder to another.

Expectation

Even when concerns are separated, constants and common functions like setting up a client to GitHub or Asana should be placed in a central location and shared.

Resolution

  • I would be interested in resolving this bug.
@dhruvkb dhruvkb added help wanted Open to participation from the community 🛠 goal: fix Bug fix 💪 skill: python Requires proficiency in 'Python' 🤖 aspect: dx Concerns developers' experience with the codebase and removed help wanted labels Sep 3, 2020
@avats-dev avats-dev mentioned this issue Sep 17, 2020
1 task
@tushar912
Copy link

@dhruvkb i would like to work on this

@tushar912
Copy link

I am thinking of implementing it as follows . set_up_github_clientand get_cc_organization are used in a lot of files so i would create a common file utils which can be used for all the workflows .It would also contain constants like GITHUB_ORGANIZATION and GITHUB_TOKEN. Also in push_data_to_ccos Setting up asana could be placed at a single place. @dhruvkb Please tell if I am missing anything.

@dhruvkb
Copy link
Member Author

dhruvkb commented Sep 30, 2020

@tushar912 the idea of containing duplicated code in a single location is a good idea. But putting the file in a different folder might present some complications in terms of how Python resolves packages so you should check how that works.

@tushar912
Copy link

Yes

@avats-dev
Copy link

@tushar912 the idea of containing duplicated code in a single location is a good idea. But putting the file in a different folder might present some complications in terms of how Python resolves packages so you should check how that works.

yeah, relative imports could be a trouble! I tried them while fixing logging. @tushar912 if you get to know a better way, ping me back as I also need to implement this for improved logging. Thanks 👍

concerned with #63

@tushar912
Copy link

I think here we can use sys.path.append to add the path of folder to sys.pathand then we can easily import files by their name rather than using relative imports.

@tushar912 tushar912 mentioned this issue Oct 1, 2020
7 tasks
@avats-dev
Copy link

@tushar912 yes we can use sys.path but that might be a dangerous step as it changes the system path and may abrupt the script's working. That's why I haven't used it yet, and thought about relative imports. Let's see what @aldenstpage has to say.

@cc-open-source-bot cc-open-source-bot added the 🏷 status: label work required Needs proper labelling before it can be worked on label Dec 2, 2020
@TimidRobot
Copy link
Member

Fixed by #143

@TimidRobot TimidRobot assigned TimidRobot and unassigned tushar912 Apr 12, 2022
@TimidRobot TimidRobot linked a pull request Apr 12, 2022 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix help wanted Open to participation from the community 💪 skill: python Requires proficiency in 'Python' 🏷 status: label work required Needs proper labelling before it can be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants