Open grimen opened 5 years ago
I think my efforts may be confounded by the fact that I'm running in a Python virtual environment.
@jfavrod Would you be able to share example code I could run locally to reproduce? I use this library in Python Virtual Environment successfully, but it is possible there are edge cases I have not stumbled onto.
I set up a simplified example...
$ tree .
├── Dockerfile
├── Pipfile
├── Pipfile.lock
└── src
└── index.py
1 directory, 4 files
Here's the contents of the Dockerfile:
$ cat Dockerfile
FROM python:3.7
RUN mkdir -p /app/src
WORKDIR /app
RUN pip install pipenv
COPY Pipfile /app/Pipfile
COPY Pipfile.lock /app/Pipfile.lock
RUN pipenv install
CMD ["pipenv", "run", "python", "src/index.py"]
Also the contents of the Pipfile:
$cat Pipfile
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
rootpath = "*"
[requires]
python_version = "3.7"
And finally the index.py file:
$ cat src/index.py
import rootpath
print(rootpath.detect())
When I run the container, here's the output:
$ docker container run -v ${PWD}/src:/app/src --rm agsync-api-py
None
I just tried from the above, and it works. I tried to make the example more like the situation where I was experiencing the problem, but it still works.
rootpath.detect(pattern='Pipfile')
I just found out the code I was working on is no longer maintained, so I won't be contributing to it (or working on this issue anymore). I do believe I'll be using the rootpath
module in future Python projects though. Thank you!
OK, good. Thank you for raising the concert, I should add some more docs/examples for sure whenever I get a moment to do that.
From the README:
It would be nice to see an example of how to override the detection pattern.
In a docker container
rootpath.detect()
returnsNone
. I copied in myPipfile
, and I've triedrootpath.detect(pattern='Pipfile')
- as well as with regular expression args - and I'm still gettingNone
.