heroku / heroku/heroku-buildpack-python

Add support for config vars in pip requirements files

Open
#1,451 6 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Ruby
Stars
993
Forks
1.8k
Avg merge
10h 50m
Merged PRs (30d)
10

Description

Unsure if I'm somehow doing something wrong or this is by design. According to Pip's documentation, I can include a private repo in my requirements.txt as a dependency. Since the repo is private and hosted on GitHub, I need to provide a personal access token. Of course, I do not want that token included in source code, so I configure it in Heroku's Config Vars. But it doesn't seem to work for me. However works fine when running locally.

For example, requirements.txt:
```
aiohttp
cryptography
cachetools
sqlalchemy==1.4.46
git+https://${GITHUB_TOKEN}@github.com/user/repo.git@main
```

This is the error I get from Heroku. It appears, it does not resolve the GITHUB_TOKEN environmental variable that is defined in the Config Vars.
```
-----> Installing requirements with pip
Collecting git+https://****@github.com/user/repo.git@main (from -r requirements.txt (line 9))
Cloning https://****@github.com/user/repo.git (to revision main) to /tmp/pip-req-build-imw3lwma
Running command git clone --filter=blob:none --quiet 'https://****@github.com/user/repo.git' /tmp/pip-req-build-imw3lwma
fatal: could not read Password for 'https://${GITHUB_TOKEN}@github.com': No such device or address
error: subprocess-exited-with-error
```

Is there a workaround or something I'm missing? Thanks

https://pip.pypa.io/en/stable/reference/requirements-file-format/#using-environment-variables

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.