Hi everyone:
I put together the initial iteration of pyprojroot at SciPy 2019 and gave a Lightning Talk on it. I also got to meet Leah during the BoF where I first pitched the project.
pyprojroot
a utility package that tries to find the root directory (using pathlib
!) of a given project to nudge people into not using hard-coded paths. I’m hoping this can be tested for edge cases in the community and eventually be submitted as a package under pyOpenSci.
So far it seems to be working on a local setup (local scripts, local notebooks, local REPL). And would like to see where the boundaries are with various deployment scripts and remote kernels (I’m not sure if it’ll work in this case, see this issue: https://github.com/ipython/ipython/issues/10123
(sorry it’s not clickable, I’m new and only allowed 2 links )
Here’s an example taken from the current project README.md
In [1]: from pyprojroot import here
In [2]: import pandas as pd
In [3]: !pwd
/home/dchen/git/hub/scipy-2019-pandas/notebooks
In [4]: !ls
01-intro.ipynb 02-tidy.ipynb 03-apply.ipynb 04-plots.ipynb 05-model.ipynb Untitled.ipynb
In [5]: !ls ../data
billboard.csv country_timeseries.csv gapminder.tsv pew.csv table1.csv table2.csv table3.csv table4a.csv table4b.csv weather.csv
In [6]: pd.read_csv(here('./data/gapminder.tsv'), sep='\t').head()
Out[6]:
country continent year lifeExp pop gdpPercap
0 Afghanistan Asia 1952 28.801 8425333 779.445314
1 Afghanistan Asia 1957 30.332 9240934 820.853030
2 Afghanistan Asia 1962 31.997 10267083 853.100710
3 Afghanistan Asia 1967 34.020 11537966 836.197138
4 Afghanistan Asia 1972 36.088 13079460 739.981106
In [7]: here('./data/gapminder.tsv')
Out[7]: PosixPath('/home/dchen/git/hub/scipy-2019-pandas/data/gapminder.tsv')