Testers for pyprojroot package

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 :stuck_out_tongue: )

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')
3 Likes

:wave::wave: Welcome to pyopensci @chendaniely !! I just want to clarify! You are looking for people to test out your package?? if that is the case, i’m happy to post on twitter to see if we can rally a few folks and then ofcourse let’s see if anyone here might have time as well!! we really should start using our pyopensci twitter handle at some point :slight_smile: but i can use my account for the time being!!

all - anyone interested in testing out a package??!

1 Like

Thanks @lwasser for the tweet!

Yep, need people to test out the package and let me know if something doesn’t work and stuff.
I just fixed a “problem” where I used f-strings which limited the package to Python 3.6+, but I’m pretty sure I’ll be keeping it at the pathlib level so it’ll be Python 3.4+.

Right now I only have a few files/folders I use as a stop conditoin to find the root project path

proj_files=['.git', '.here', '*.Rproj', 'requirements.txt', 'setup.py'] (yes I’m checking for RStudio projects…)

You can always put in a .here file to force a stop, but for anyone else who uses a python IDE, I’d be interested to know if they have their own versions of python projects, and if they create a special file or project within the IDE. I can always add those to a the list of files/folders to search and stop for.

1 Like

thanks for the awesome information.

welcome @alexsunny123 to pyopensci!

thanks my issue has been fixed.