question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Django: Dependency management

See original GitHub issue

The Django branch has done away with pipenv in favor of a setup.py and just setting up environments manually.

I understand that this is far faster for builds, but in my opinion that advantage comes at the cost of convenience. I also don’t love that it’s inconsistent with our dependency management for bot.

I’d like to hear more opinions about this though. It is a shame that pipenv is slowing down our builds by several orders of magnitude, but I do think that there is a solution for this to be found in some sort of clever caching, and I also don’t know if 10 minute build times is a real problem.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:26 (26 by maintainers)

github_iconTop GitHub Comments

4reactions
lemonsauruscommented, Feb 4, 2019

I also hate using the setup.py for the django packages we publish to PyPI, and would be happy if we could have a single tool across all our repos that solved both publishing, dependency locking, and virtual environment creation. That, plus faster build times, seems like a worthwhile trade overall for what seems like minor inconveniences in return. And I know that some of the members of our dev team (including @jchristgit who is spearheading the Django rewrite) are really in hate with pipenv, so I’d be happy to entertain a competent alternative if only so they’ll be happy, too.

For these reasons, I think we should give this a try and see how it works out. we can always change our minds later, this is hardly a major change.

1reaction
jb3commented, Feb 4, 2019

I copied across all the dependencies from the setup.py file into an example pyproject.toml which looks like this:

[tool.poetry]
name = "pydis-site"
version = "0.1.0"
description = "Django application for the Python Discord server."
authors = ["Your Name <you@example.com>"]
license = "MIT"

[tool.poetry.dependencies]
python = "^3.7"
django = "^2.1"
djangorestframework = "^3.9"
djangorestframework-bulk = "^0.2.1"
django-crispy-forms = "^1.7"
django-hosts = "^3.0"
django-environ = "^0.4.5"
django-filter = "^2.1"
psycopg2-binary = "^2.7"
uwsgi = "^2.0"

[tool.poetry.dev-dependencies]
flake8 = "^3.7"
flake8-bandit = "^2.1"
flake8-bugbear = "^18.8"
flake8-import-order = "^0.18.0"
flake8-string-format = "^0.2.3"
flake8-tidy-imports = "^2.0"
pep8-naming = "^0.8.0"
mccabe = "^0.6.1"
coverage = "^4.5"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

When running poetry install from no virtualenv it takes 1 minute and 4 seconds on my MacBook to install all the production dependencies and 1 minute 14 seconds to install the dev dependencies as well (I may have some caching going on but I tried to eliminate it).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Practices for Python Dependency Management
If you're reading this in 2018, hopefully there will be some easier ways to manage Python dependencies! Notes. If you're used to other...
Read more >
Managing Application Dependencies
This tutorial walks you through the use of Pipenv to manage dependencies for an application. ... Pipenv is a dependency manager for Python...
Read more >
Which Python Dependency Manager Should I Choose?
Which of Pip, Pipenv, Conda, the ActiveState Platform and many more Python dependency managers suit your needs better? Find out here!
Read more >
What's the best practice to deploy (manage dependency) ...
What's the best practice to deploy (manage dependency) the django reusable apps in a real production project? Ask Question. Asked 11 years, 2 ......
Read more >
How To Manage Python Dependencies
Python dependency management is essential to the well-being of your projects. If your Python application relies on third-party libraries and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found