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

Add poetry #193

Merged
merged 15 commits into from
Aug 22, 2024
Merged

Add poetry #193

merged 15 commits into from
Aug 22, 2024

Conversation

valmik-patel
Copy link
Contributor

I'm creating this request to start a conversation about adding Poetry to the project for dependency management.

Poetry allows for easy dependency management while ensuring there are no clashes. I've added the dependencies mentioned in requirements/management.txt as dev dependencies to poetry. Dependencies in requirements/cli.txt and requirements/webapp.txt have been added as optional extras dependencies. And finally, the dependencies in requirements/main.txt have been added as the main dependencies for the project.

You can test this locally through the following steps

  • Install Poetry
  • Run poetry install --all-extras from project root to set up a poetry venv and install all dependencies
  • Commands can be run in this venv from project root by adding poetry run in front of the command

We can do the following things easily through poetry

  • Run unit tests - We can run unit tests using just a single line of code instead of having to use a script like we currently do.

poetry run coverage run -m pytest --cov-report xml:cov.xml --cov-report term

  • Build dist files - We can easily build dist files using poetry build
  • Publish the package - Packages can be published to PyPI using poetry publish. This will require configuring poetry with PyPI credentials.

In addition to all this, we can also automate testing when a PR is made using GitHub Actions. Using this method, we can block PRs from being merged if the unit tests fail. `GitHub Actions will also allow us to automatically build and publish packages when a PR is merged. Doing all this setup requires us to add PyPI credentials to GitHub secrets at minimum, and we might need to change some GitHub settings, too.

I wanted to start a conversation using this MR so we can get some opinions from the original maintainers. We will need someone with admin access to the repo to help us add secrets and block PRs from merging when the unit tests fail.

@sgpjesus FYI

@sgpjesus
Copy link
Collaborator

Hey @jesteria! Can you give your opinion on changing the setup of aequitas to Poetry? Thank you!

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
Copy link
Collaborator

@sgpjesus sgpjesus left a comment

Choose a reason for hiding this comment

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

I believe that with the changes I sent, this MR is good to be merged to master. I think we can also drop the previous requirement files.

valmik-patel and others added 2 commits August 22, 2024 02:03
Co-authored-by: Sérgio Jesus <36162088+sgpjesus@users.noreply.github.com>
@valmik-patel
Copy link
Contributor Author

@sgpjesus I accepted your suggestions and removed the old requirements. Let me know if you need me to do anything else.

@sgpjesus
Copy link
Collaborator

@valmik-patel Can you just update the .lock file, before merging? I think that will be the last thing! I can't add any commits from my side or else my approval will not be valid for the merge.

@sgpjesus sgpjesus self-requested a review August 22, 2024 10:10
@sgpjesus
Copy link
Collaborator

I will actually open a new MR to try and relax some of the dependency versions

@sgpjesus sgpjesus merged commit 1e9e723 into dssg:master Aug 22, 2024
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.

3 participants