Giter VIP home page Giter VIP logo

Comments (3)

apoclyps avatar apoclyps commented on June 6, 2024

Hi @larsks πŸ‘‹

Thanks for raising this issue. I will spend some time on it over the next few days however if you want to attempt to solve it and submit a pull request, I would be more than happy to review it.

From the issue you shared above, we should be defaulting to AutoConfig() on L9 within reviews/config/settings.py in

# configures decouple to use settings.ini or .env file from another directory
if REVIEWS_PATH_TO_CONFIG := os.environ.get("REVIEWS_PATH_TO_CONFIG", None):
config = AutoConfig(search_path=REVIEWS_PATH_TO_CONFIG)
else:
config = AutoConfig()

This makes use of python-decouple which uses AutoConfig() to do the following:

This is a lazy Config factory that detects which configuration repository you’re using.

It recursively searches up your configuration module path looking for a settings.ini or a .env file.

Optionally, it accepts search_path argument to explicitly define where the search starts.

Depending on where AutoConfig runs from, it may be possible it's running from where reviews is installed and not the current working directory. To support the current working directly this may need to be updated to specify the search_path=os.getcwd()

from reviews.

larsks avatar larsks commented on June 6, 2024

With reviews installed in /home/lars/.local/pipx/venvs/reviews/lib/python3.11/site-packages/reviews, and run from /home/lars/projects/kola, the search path for .env is:

71595 newfstatat(AT_FDCWD, "/home/lars/.local/pipx/venvs/reviews/lib64/python3.11/site-packages/reviews/config/.env", 0x7ffe0d108070, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.local/pipx/venvs/reviews/lib64/python3.11/site-packages/reviews/.env", 0x7ffe0d108070, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.local/pipx/venvs/reviews/lib64/python3.11/site-packages/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.local/pipx/venvs/reviews/lib64/python3.11/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.local/pipx/venvs/reviews/lib64/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.local/pipx/venvs/reviews/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.local/pipx/venvs/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.local/pipx/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.local/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/lars/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)
71595 newfstatat(AT_FDCWD, "/home/.env", 0x7ffe0d1080d0, 0) = -1 ENOENT (No such file or directory)

...which is of course silly. I think just passing . to AutoConfig() will probably do the right thing.

from reviews.

apoclyps avatar apoclyps commented on June 6, 2024

Thank you for your pull request @larsks - this will be made available in the 0.5.1 release of reviews

relates to:

from reviews.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.