-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows OS solution #20
Comments
To clarify, you can still use
Both are optional, and do not affect the structure or other configurations. The first is performed by the Unix shell extension The second is done using the Unix If you want to use Advanced - getting Unix functionality on WindowsIt is possible to have full Further details can be found in this Gist, or in the We would welcome any contributions that might find a non-administrator way of supporting Windows, and/or remove our Unix dependencies! |
On 1., there's a couple of Python tools that provide something similar in an OS-independent way:
Neither is as neat as On 2., |
Regarding 1., that sounds like a good thing to edit on the Gist/ RE: creating a |
As a starter for ten, I'd say worth clarifying in the docs that Windows support is sub-par, but still pretty good (and better than doing your own cookiecutter variant) - have been spinning up a few projects with this in our windows env and faced no issues, though granted have not got to the makefile stage! As someone who initially saw the project and thought "oh, not for me, I'm on Windows", would have been nice ;) Happy to pull/draft something if it helps! |
@Crimsoneer thanks for the feedback! There's some guidance here already as part of the I'm also playing around with a possible replacement for direnv for Windows users using python-dotenv - will show more when it's in a better state! |
@AndreasThinks - I've had a play around with getting cookiecutter https://github.com/ukgovdatascience/govcookiecutter.git --checkout windows-support-for-dotenvrc It includes a new function
It should:
More details available in the documentation for that branch. Minimum working example: from src.utils import load_dotenvrc
import os
load_dotenvrc()
print(os.getenv("DIR_DATA")) # should print out the folder path to the `data` folder Let me know if this works! Feel free to push changes to the branch too! If it does the job, I'll raise a PR! |
Oo, very exciting! I'm actually just working on my first project using the template, and am hoping to finish it off tomorrow and tie it up into a nice package/container, so shall give it a shot later this week and let you know how I get on. I was adding "sys.path.insert" and my working directory to each notebook, but this looks a lot cleaner. |
Great thanks! It's not a full replacement for direnv - mainly a bunch of regular expressions - but hopefully it will do the job for now!
|
Slightly nightmarish, but notebooks may not be so straightforward. Without inserting the from IPython.core.interactiveshell import InteractiveShell
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
from src.utils import load_dotenvrc # noqa: E402
# Load environment variables, and enable multiple outputs per cell
load_dotenvrc()
InteractiveShell.ast_node_interactivity = "all" # just to demonstrate you can add any code here you like! And then import it in the first cell of every notebook, i.e. import notebook_setup # must be before any imports from `src`! Not sure if this is the cleanest way to do it - everything else seems to require setting environment variables, which is kind of the whole point of direnv, before being able to load configuration files! |
Thoughts welcome on #28 - revising the way we handle environment variables so that direnv becomes optional may be a welcome change for Windows users! (Doesn't get around the manual loading requirements, e.g. using |
As a brief update, I think this issue will be resolved when issues #28 and #34 are resolved. Issue #28 should make all core Issue #34, as an extension of issue #28, should make it easier for Jupyter notebooks to use the |
I've also rebased the |
has there been any further update for Windows? I took a look through #28 but can't see anything after Oct last year. |
@harrietrs, not sure what progress has been made, although I see PR #48 was raised some time ago. Both @avisionh and I have now left @ukgovdatascience, but will tag @alexander-newton and @Jacobb164 (if they're still at ONS!) |
As a temporary workaround, I'm using python-dotenv for windows and it works quite well for me, eg
|
Hi @AndreasThinks I am currently in the process of updating govcookiecutter with this as one of my main priorities. Would love to hear if you have any other suggestions / requests for how govcookiecutter can be improve going forward. |
What's the update on how the latest release meets this requirement? |
This is an open-call for help to implement an Windows compatible framework for this. Currently, it has been tested and works on Unix-based systems such as macOS and Linux. What we are looking for is someone to adapt this or add extra features so it works on Windows OS.
The text was updated successfully, but these errors were encountered: