0

I want to move the program to another environment, eg A to B.

  1. At A, I first issue pipenv lock to update the Pipfile.lock.
  2. I copy the Pipfile.lock from A to B.
  3. At B, I issue pipenv install --ignore-pipfile to create the new environment from the Pipfile.lock. I notice that it will also create a Pipfile but without any packages in the [package] section.

Is this the correct behaviour ? I find the Pipfile misleading if I were to read it as it does not reflect the packages installed.

Should I delete it or I should keep it ?

Or I've made a mistake in my procedure ?

Thanks very much !

EBDS
  • 1,244
  • 5
  • 16
  • 2
    In short, you must always have a `Pipfile` and you will have a `Pipfile.lock` most of the time. While this behavior is somewhat confusing and poorly documented, `--ignore-pipfile` creates a `Pipfile` because `pipenv` always needs that to exist. See this answer for more info: https://stackoverflow.com/a/52951378. Do note the comments under that answer as well. – kalatabe Dec 22 '21 at 15:58
  • @kalatabe Thanks. So the point is Pipfile is always present. In my case, its not use but is generated. My concern is that it does not reflect the actual environment and is misleading. Any idea how I could generate a proper Pipfile to reflect the true environment ? – EBDS Dec 23 '21 at 02:00
  • 1
    Creating a new environment should be done with the Pipfile present, and optionally the Pipfile.lock. Don't just move the lock file. – kalatabe Dec 23 '21 at 07:45
  • @kalatabe ic, I probably had the misunderstanding that Pipfile is for development because I can update it and Pipfile.lock is to move to production because it's a "lock" (I thought it locks the environment as in baselining it). So I just move the Pipfile.lock over (the baseline). So now I would move both Pipfile and Pipfile.lock over. – EBDS Dec 24 '21 at 01:18
  • Moving the Pipfile over to non-production environment, do people usually remove the development section from the Pipfile or move the Pipfile over intact ? – EBDS Dec 24 '21 at 01:19
  • 1
    `pipenv install` by default does not install `[dev-packages]`, only `pipenv install -d` does that: `-d, --dev Install both develop and default packages. [env var: PIPENV_DEV]` . So as long as you build your production deploys without `-d` you won't get any dev-time dependencies installed. – kalatabe Dec 25 '21 at 10:39

0 Answers0