pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Allow configuring pipenv though a config file

Open ericriff opened this issue 4 years ago • 6 comments

Pipenv supports a lot of configurations though environmental variables. This is useful but those are not persistent and can't be pushed to a VCS. For example if we have a team of devs working on the same repo, I would like to commit a config file that Pipenv would pick up so all the devs have Pipenv configured the same way.

Thanks!

ericriff avatar Sep 22 '20 14:09 ericriff

Have you tried adding them to a .env file?

Mause avatar Sep 22 '20 14:09 Mause

Have you tried adding them to a .env file?

https://github.com/pypa/pipenv/issues/2197#issuecomment-445754721

ericriff avatar Sep 22 '20 15:09 ericriff

I've tried adding a .env file with PIPENV_VENV_IN_PROJECT=1 and it does not get used when creating the virtualenv on the master branch. Perhaps we can move the dotenv loading earlier in the process.

matteius avatar Mar 17 '22 01:03 matteius

@matteius not sure about a .env, although anticipating dotenv loading would make sense on it's own.

It would be good to have a dedicated persistent config spec. One idea below - inspired on another package manager - but could be added (ideally) directly to the Pipfile.

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[virtualenvs]
in-project = true       # default would be false
directory = ".venv"   # default would be .venv as well

[packages]
pymongo = "*"
flask = "*"

# ...

My use case would be based such as in this .vscode/settings.json. I just want to clone and do a pipenv install without worrying about setting variables, or creating the .venv manually before installing. It's right there with the code.

{
  "python.linting.pylintEnabled": true,
  "python.linting.pylintPath": ".venv/bin/pylint",
  "python.formatting.autopep8Path": ".venv/bin/autopep8"
}

epomatti avatar May 28 '22 02:05 epomatti

@epomatti Any interest in working on a prototype PR of this?

matteius avatar May 28 '22 03:05 matteius

@matteius sorry, won't be able to.

epomatti avatar Jun 03 '22 22:06 epomatti

Essentially there are two styles of pipenv config --

1.) Config that is project wide and lives in the Pipfile 2.) Config that is environment specific and lives as an env var or in the .env file.

We are working to improve the interfaces to pipenv but I don't have bandwidth or necessarily think its a good idea to support a json config at this time. That being said we can extend the config options that are available to suit more use cases. If there are virtualenv or other options we want to support, please open new ticket(s) for these.

matteius avatar Mar 02 '23 03:03 matteius