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

build: Add Pipenv for dependency management #12

Merged

Conversation

jordan-gillard
Copy link
Contributor

@jordan-gillard jordan-gillard commented Feb 25, 2024

Summary

This PR adds Pipenv for improved dependency management.

Rationale

  1. Pipenv automatically creates and manages virtual environments.
  2. The Pipfile.lock file locks dependencies to ensure consistent dependencies across environments, reducing "it works on my machine" issues.
  3. Pipenv enhances project security by checking for known dependency vulnerabilities.
  4. Pipfile is more readable and clear compared to requirements.txt, it also has a really neat [scripts] section.
  5. Pipenv distinctly separates development and production dependencies. This will make developers who want to work on this project & users who want to install from PyPI live's easier.
  6. Last but not least it's endorsed by the Python Packaging Authority.

I would like to make some enhancements to this project (like adding tests - #11), which would require installing pytest. I don't want to make pytest a production dependency. Users who just want to use the script shouldn't have to install it. So I decided a good first step to enhancing EDGAR is to add a nicer dependency manager. Users can still use requirements.txt for the original workflow. In the future developers can generate requirements.txt via pipenv requirements > requirements.txt.

Pipenv is great. Another alternative is Poetry. Please lmk if you would like further explanation/justification for this PR.

.gitignore Outdated Show resolved Hide resolved
EDGAR_RSS_custom.py Outdated Show resolved Hide resolved
Pipfile Show resolved Hide resolved
@GalenReich GalenReich added the enhancement New feature or request label Feb 26, 2024
@GalenReich
Copy link
Collaborator

I didn't spot this PR before merging #10, but in general am very much in favour of adding better dependency management 🙌

@jordan-gillard
Copy link
Contributor Author

I didn't spot this PR before merging #10, but in general am very much in favour of adding better dependency management 🙌

@GalenReich Rad. I'll refactor this to account for the latest changes. Probably not until Wednesday tho 🙂

@jordan-gillard
Copy link
Contributor Author

jordan-gillard commented Mar 2, 2024

@GalenReich lmk what you think.

Edit: I saw last night that other Bellingcat Python projects use Poetry. Would you prefer that? It's no big

Pipfile Show resolved Hide resolved
Copy link
Collaborator

@GalenReich GalenReich left a comment

Choose a reason for hiding this comment

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

This looks great! 🙌 Thanks for sorting this - it'll be much more reliable I'm sure! No worries about using pipenv over poetry, we have a mix of projects using each. Just the one open question about installing the dev dependencies.

README.md Outdated

```shell
pip3.12 install pipenv # Installs Pipenv
pipenv install # Installs all dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be pipenv install --dev? As otherwise black is not installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good eye. Yes, you are correct. Addressed here: 93bc4b1

Copy link
Collaborator

@GalenReich GalenReich left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@GalenReich GalenReich merged commit ebc1859 into bellingcat:main Mar 5, 2024
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