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

explore python dependency management #1295

Closed
alangenfeld opened this issue Apr 24, 2019 · 29 comments
Closed

explore python dependency management #1295

alangenfeld opened this issue Apr 24, 2019 · 29 comments
Labels
dependencies dev-infra Ways to improve development of dagster type: project Big Projects
Projects

Comments

@alangenfeld
Copy link
Member

Problem: dependencies are encoded explicitly and implicitly in several places - setup.py, requirements.txt, tox.ini, dev env setup and CI jobs. This sucks.

We should have a single source of truth and then use that to generate what we need. In addition to solving our current problems, a good system here can empower stuff like determining what modules (and their recursive deps) to test as a function of changed files.

@alangenfeld
Copy link
Member Author

@alangenfeld
Copy link
Member Author

at minimum should we move to something with a lockfile like pipenv?

@mgasner
Copy link
Contributor

mgasner commented May 9, 2019

https://github.com/sdispater/poetry

@alangenfeld
Copy link
Member Author

relevant incident report:

https://scikit-learn.org/stable/whats_new.html#version-0-21-0 released which broke all of our builds since it dropped support for anything Python 3.4 and below https://github.com/scikit-learn/scikit-learn/releases

We had some slowness fixing this due to not getting the order of editable installs in one place, see https://dagster.phacility.com/D75

@mgasner
Copy link
Contributor

mgasner commented Jul 18, 2019

#1567

@mgasner
Copy link
Contributor

mgasner commented Jul 26, 2019

python-poetry/poetry#34

@mgasner
Copy link
Contributor

mgasner commented Jul 26, 2019

@mgasner mgasner added this to the 0.5.5 milestone Jul 26, 2019
@mgasner
Copy link
Contributor

mgasner commented Jul 26, 2019

@mgasner
Copy link
Contributor

mgasner commented Jul 29, 2019

@mgasner
Copy link
Contributor

mgasner commented Jul 30, 2019

We could check in requirements.txt files created by pip freeze, etc., but I think this sends the wrong message (you must develop using these specific versions) for an open source project.

@mgasner
Copy link
Contributor

mgasner commented Jul 30, 2019

@mgasner
Copy link
Contributor

mgasner commented Jul 31, 2019

tox:

whitelist_externals = poetry
skip_install = true
commands =
    poetry install -v
    poetry run pytest tests/

https://medium.com/@DJetelina/making-a-python-library-how-the-ecosystem-changed-in-2-5-years-a3b5eb16d7df

@mgasner
Copy link
Contributor

mgasner commented Jul 31, 2019

RTD issues:
readthedocs/readthedocs.org#4912

@mgasner
Copy link
Contributor

mgasner commented Aug 5, 2019

python-poetry/poetry#1245 is now fixed on poetry:develop

@schrockn schrockn removed this from the 0.6.0 milestone Sep 4, 2019
@mgasner
Copy link
Contributor

mgasner commented Oct 7, 2019

cd ../dagster && rm poetry.lock && poetry install
cd ../dagster-graphql && rm poetry.lock && poetry install
cd ../dagit && rm poetry.lock && poetry install

@mgasner
Copy link
Contributor

mgasner commented Dec 11, 2019

https://dephell.org/

@mgasner
Copy link
Contributor

mgasner commented Dec 11, 2019

@orsinium
Copy link

I recommend to have a look at the next combination:

  • poetry as format
  • dephell to generate requirements.txt/setup.py for compatibility
  • dephell to run tests (on CI) too.

Related docs:

Dephell's own config can be helpful: https://github.com/dephell/dephell/blob/master/pyproject.toml

The main idea is to make as many environments as possible with dephell environments and extra dependecies. One environment for one command. For example, test environment for dephell:

[tool.dephell.pytest]
from = {format = "poetry", path = "pyproject.toml"}
envs = ["main", "tests"]
command = "python -m pytest tests/"

...

[tool.poetry.dev-dependencies]
pytest = "*"
requests-mock = "*"
aioresponses = "*"
...

[tool.poetry.extras]
tests = ["aioresponses", "pytest", "requests-mock"]

@schrockn
Copy link
Member

Wow @orsinium dephell might be the tool I've been waiting for. All of our setup.py's and requirements.txt's under code-generation is definitely what I think the structure should be. Thanks a ton for the pointer.

@natekupp
Copy link
Contributor

Per discussion here: https://dagster.phacility.com/D1750 we should also update .buildkite/images/docker/snapshot-update.sh as part of our dependency management refresh / this project.

@mgasner mgasner added the type: project Big Projects label Feb 3, 2020
@mgasner mgasner changed the title [project] explore python dependency management explore python dependency management Feb 3, 2020
@mgasner
Copy link
Contributor

mgasner commented Mar 29, 2020

python-poetry/poetry#1245 has landed (in the new poetry-core package) and dev on poetry looks like it has picked up again -- i'll revisit this (with an eye to moving to poetry/dephell) soon

@mgasner
Copy link
Contributor

mgasner commented Mar 30, 2020

current dependency hell:

ERROR: apache-airflow 1.10.9 has requirement future<0.17,>=0.16.0, but you'll have future 0.18.2 which is incompatible.
ERROR: apache-airflow 1.10.9 has requirement pandas<1.0.0,>=0.17.1, but you'll have pandas 1.0.3 which is incompatible.
ERROR: botocore 1.15.32 has requirement docutils<0.16,>=0.10, but you'll have docutils 0.16 which is incompatible.
ERROR: boto3 1.9.253 has requirement botocore<1.13.0,>=1.12.253, but you'll have botocore 1.15.32 which is incompatible.
ERROR: snowflake-connector-python 2.2.2 has requirement botocore<1.15,>=1.5.0, but you'll have botocore 1.15.32 which is incompatible.

@shao-shuai
Copy link

current dependency hell:

ERROR: apache-airflow 1.10.9 has requirement future<0.17,>=0.16.0, but you'll have future 0.18.2 which is incompatible.
ERROR: apache-airflow 1.10.9 has requirement pandas<1.0.0,>=0.17.1, but you'll have pandas 1.0.3 which is incompatible.
ERROR: botocore 1.15.32 has requirement docutils<0.16,>=0.10, but you'll have docutils 0.16 which is incompatible.
ERROR: boto3 1.9.253 has requirement botocore<1.13.0,>=1.12.253, but you'll have botocore 1.15.32 which is incompatible.
ERROR: snowflake-connector-python 2.2.2 has requirement botocore<1.15,>=1.5.0, but you'll have botocore 1.15.32 which is incompatible.

I got the pandas error as well, did you find solution?

@natekupp natekupp added this to the Future Release milestone Jun 1, 2020
@natekupp natekupp added this to To do in Core via automation Oct 7, 2020
@mgasner mgasner modified the milestone: Future Release Oct 7, 2020
@natekupp natekupp moved this from Needs Triage to Backlog in Core Nov 9, 2020
@mgasner
Copy link
Contributor

mgasner commented Dec 8, 2020

I think we should do a couple of things in concert over the Xmas holidays when hopefully the rate of commits slows down a little: move to poetry with pants to manage monorepo builds (deprecating some of our homegrown build scripting), use cookiecutter or copier for project templating. This should also set us up for a cleaner conda story.

some refs
https://www.pantsbuild.org/docs/how-does-pants-work
https://github.com/mitodl/ol-data-pipelines/blob/putting_on_pants/pants.toml
https://cookiecutter.readthedocs.io/en/1.7.2/
https://copier.readthedocs.io/en/stable/
https://github.com/dojeda/poetry2conda

@natekupp
Copy link
Contributor

natekupp commented Dec 8, 2020

@mgasner definitely onboard w/ poetry.

thoughts on pants vs. bazel vs. please.build? maybe worth a comparison/eval?

@mgasner
Copy link
Contributor

mgasner commented Feb 16, 2021

tried to use poetry in the internal stuff and its editable installs still don't work right

@orsinium
Copy link

I started to use flit for my projects.

To automate things like venv creation and deps installation, I use taskfile.
Example: https://github.com/life4/deal/blob/master/Taskfile.yml
Installation on CI is also easy: https://github.com/life4/deal/blob/master/.drone.star#L13-L19

@alangenfeld alangenfeld added the dev-infra Ways to improve development of dagster label Mar 30, 2021
@mgasner
Copy link
Contributor

mgasner commented May 13, 2022

fwiw poetry is much improved from when i looked at it in december 2020, editable installs now seem to work

@sryza
Copy link
Contributor

sryza commented Mar 20, 2024

We've made some big changes since this was filed and it's mandate is very general. Closing.

@sryza sryza closed this as completed Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies dev-infra Ways to improve development of dagster type: project Big Projects
Projects
No open projects
Core
Backlog
Development

No branches or pull requests

10 participants