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

Question: dev/deploy workflow #2489

Closed
0bsearch opened this issue Jul 2, 2018 · 9 comments
Closed

Question: dev/deploy workflow #2489

0bsearch opened this issue Jul 2, 2018 · 9 comments

Comments

@0bsearch
Copy link

0bsearch commented Jul 2, 2018

Hi. I'm looking for some guide/tutorial on using pipenv in development-delivery cycle, currently I'm missing two key points in docs:

  1. What is proper way to deploy microservice based on Pipfile[.lock] (i.e., how to build docker container?).
    My feeling is that during deployment only .lock should be read, as described set of dependencies developed/tested with, but it's not clear what's the proper way:
    • sync seems to be appropriate (reads .lock file, installs packages), but doesn't support --system (addressed in Support --system to pipenv sync #2227) ­— which is default approach while building containers
    • install --system is ok for installing in container, also support --deploy — is it defferent from sync? Docs says "This will fail a build if the Pipfile.lock is out–of–date" — does it check against PyPI or Pipfile?
    • install --ignore-pipfile — is it the same as sync?
  2. What's the way to use editable installs while developing? Pretty often I develop library and app (using that library) at the same time — to ensure compatibility/ease of interface use/etc.
    While working with pip I can do one-timer like pip install -e path/to/local/lib, or manage some requirements-dev that's local for every developer. During dev install we can feed all requirement files, for CI — only libraries from upstream.
    I'm looking for something similar with pipenv — support for [dev-packages] is perfect in terms of handling priorities during install and locking, but I can't put there any "per developer"-specific configuration. And afaik, pipenv can not work with multiple Pipfiles.
@uranusjr
Copy link
Member

uranusjr commented Jul 2, 2018

  1. Indeed sync need --system. PR welcomed.
  2. install --deploy checks against Pipfile.
  3. Yes, install --ignore-pipfile is essentially sync. (cc @techalchemy do we want to deprecate/remove it?)
  4. pipenv install -e works as you expect it to. Did you read the documentation? It is mentioned multiple times IIRC.

@uranusjr
Copy link
Member

uranusjr commented Jul 2, 2018

Closing because there is not an issue here.

@uranusjr uranusjr closed this as completed Jul 2, 2018
@0bsearch
Copy link
Author

0bsearch commented Jul 3, 2018

@uranusjr , thanks for clarification on sync.

Regarding pipenv install -e — yes, I've read the docs, idk if my post looks like I haven't.
Issue is that I want to install local editable dependency (or even non-editable), but don't want to touch neither Pipfile or .lock. Because local path to editable deps on my environment is different from other people. Or, lets say, I prefer to use ipdb, while other devs use pudb. This is matter of preference, and has nothing to do with project deps. I thought this can be achieved with --ignore-pipfile --skip-lock, but this seems to have no effect while installing single package.

@uranusjr
Copy link
Member

uranusjr commented Jul 3, 2018

Pipfile can contain a relative path, so as long as the project structure is the same accoss machines, the environment should be reproducible for everyone. (This is, I believe, a general best practice for collaborative projects anyway.) I thought this is relatively obvious in the documentation, which led me into believing you missed that part of the documentation.

If you really don’t want to add your package into Pipfile, pip is always available via pipenv run pip. Maybe you are just not aware of that solution?

@0bsearch
Copy link
Author

0bsearch commented Jul 3, 2018

Nope, I'm aware of run pip. Maybe my usecase is relatively rare.

Anyway, I see, probably using pip "directly" is only option here, thanks.

@butla
Copy link

butla commented Jul 3, 2018

@uranusjr Maybe there should be an issue leaving only one solution for doing sync or install --ignore-pipfile? You want me to create that?

I also came here wondering whether I should run sync or install in my Docker image :) I think I'll just use sync and have pipenv run in the image command, so that the application and it's requirements is separated from the rest of the image. This shouldn't do anything wrong, and it'll separate my Python code from awscli, which is used in the entrypoint (deploying to AWS ECS).

@uranusjr
Copy link
Member

uranusjr commented Jul 3, 2018

It’s probably a good idea to have an issue to list all install and sync modes, try to make sense of their various usages, and come up with a more conherent combination…

@butla
Copy link

butla commented Jul 3, 2018

Ok, I'll try to create a good case for this at some point.

@txomon
Copy link

txomon commented Jul 16, 2018

I just ran into this, and the steps I am doing have the problem that are creating a virtualenv inside the docker, which is not nice, but better than the alternatives

In theory the steps should just be:

  • Copy Pipfile.lock to docker
  • Run pipenv sync --system
  • Commands run normally

Using pipenv install --system --ignore-pipfile --deploy

Doesn't work, and I have no idea how to workaround on it.

Step 7/11 : RUN pipenv install --ignore-pipfile --system --deploy
 ---> Running in 74849d6693e8
Warning: --system is intended to be used for pre-existing Pipfile installation, not installation of specific packages. Aborting.

Using pipenv install --ignore-pipfile --deploy

Doesn't work,

Step 7/11 : RUN pipenv install --ignore-pipfile --deploy $REQ
 ---> Running in 3cc1ca26caf4
Creating a virtualenv for this project...
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pipenv/cli.py", line 435, in install
    selective_upgrade=selective_upgrade,
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1759, in do_install
    pypi_mirror=pypi_mirror,
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 609, in ensure_project
    three=three, python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 556, in ensure_virtualenv
    do_create_virtualenv(python=python, site_packages=site_packages, pypi_mirror=pypi_mirror)
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 879, in do_create_virtualenv
    crayons.red(project.pipfile_location, bold=True),
TypeError: __str__ returned non-string (type NoneType)

Using install alone

It will regenerate the lock, which makes no sense. I would rather use a pip freeze output

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

No branches or pull requests

4 participants