Skip to content

Commit c7d4902

Browse files
init
0 parents  commit c7d4902

17 files changed

+900
-0
lines changed

.coveragerc

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# .coveragerc to control coverage.py
2+
[run]
3+
branch = True
4+
source = pyforest
5+
# omit = bad_file.py
6+
7+
[paths]
8+
source =
9+
src/
10+
*/site-packages/
11+
12+
[report]
13+
# Regexes for lines to exclude from consideration
14+
exclude_lines =
15+
# Have to re-enable the standard pragma
16+
pragma: no cover
17+
18+
# Don't complain about missing debug-only code:
19+
def __repr__
20+
if self\.debug
21+
22+
# Don't complain if tests don't hit defensive assertion code:
23+
raise AssertionError
24+
raise NotImplementedError
25+
26+
# Don't complain if non-runnable code isn't run:
27+
if 0:
28+
if __name__ == .__main__.:

.gitignore

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.DS_Store
2+
3+
# Temporary and binary files
4+
*~
5+
*.py[cod]
6+
*.so
7+
*.cfg
8+
!.isort.cfg
9+
!setup.cfg
10+
*.orig
11+
*.log
12+
*.pot
13+
__pycache__/*
14+
.cache/*
15+
.*.swp
16+
*/.ipynb_checkpoints/*
17+
18+
# Project files
19+
.ropeproject
20+
.project
21+
.pydevproject
22+
.settings
23+
.idea
24+
tags
25+
26+
# Package files
27+
*.egg
28+
*.eggs/
29+
.installed.cfg
30+
*.egg-info
31+
32+
# Unittest and coverage
33+
htmlcov/*
34+
.coverage
35+
.tox
36+
junit.xml
37+
coverage.xml
38+
.pytest_cache/
39+
40+
# Build and docs folder/files
41+
build/*
42+
dist/*
43+
sdist/*
44+
docs/api/*
45+
docs/_rst/*
46+
docs/_build/*
47+
cover/*
48+
MANIFEST
49+
50+
# Per-project virtualenvs
51+
.venv*/
52+
.vscode/*
53+
examples/*.py

AUTHORS.rst

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
============
2+
Contributors
3+
============
4+
5+
Original Authors
6+
===============
7+
8+
* Florian Wetschoreck <https://github.com/FlorianWetschoreck>
9+
* Guido Drechsel <https://github.com/guido611>
10+
* Tobias Krabel <https://github.com/tkrabel>

CHANGELOG.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=========
2+
Changelog
3+
=========
4+
5+
Version 0.1
6+
===========
7+
8+
- Initial implementation

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 8080 Labs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# pyforest - lazy-import of all popular Python Data Science libraries. Stop writing the same imports over and over again.
2+
3+
pyforest lazy-imports all popular Python Data Science libraries so that they are always there when you need them. If you don't use a library, it won't be imported. When you are done with your script, you can export the Python code for the import statements.
4+
5+
- [Demo in Jupyter Notebook](#demo-in-jupyter-notebook)
6+
- [Demo in Python Shell](#demo-in-python-shell)
7+
- [Using pyforest](#using-pyforest)
8+
- [Installation](#installation)
9+
- [FAQs](#faqs)
10+
- [Contributing](#contributing)
11+
- [About](#about)
12+
- [Join our community and grow further](#join-our-community-and-grow-further)
13+
14+
15+
16+
## Demo in Jupyter Notebook
17+
<!-- ![demo](https://bamboolib.com/pyforest/pyforest_demo_in_jupyter.png) -->
18+
![demo](https://bamboolib.com/pyforest/pyforest_demo_in_jupyter.gif)
19+
20+
21+
## Demo in Python Shell
22+
![demo](https://bamboolib.com/pyforest/pyforest_demo_in_python_shell.png)
23+
24+
25+
## Using pyforest
26+
pyforest lazy-imports all popular Python Data Science libraries with a single line of code:
27+
28+
`from pyforest import *`
29+
30+
And if you use Jupyter or IPython, you can even skip this line because pyforest adds itself to the autostart.
31+
32+
When you are done with your script, you can export all import statements via:
33+
`active_imports()`
34+
35+
36+
Which libraries are available?
37+
- We aim to add all popular Python Data Science libraries which should account for >99% of your daily imports. For example, `pd from pandas, np from numpy, sns from seaborn, plt from matplotlib.pyplot, or OneHotEncoder from sklearn` and many more. In addition, there are also helper modules like `os, re, tqdm, or Path from pathlib`.
38+
- You can check all imports and add new ones in the [pyforest imports](src/pyforest/imports.py).
39+
40+
> In order to gather all the most important names, we need your help. Please open a pull request and add the [imports](src/pyforest/imports.py) that we are still missing.
41+
42+
43+
## Installation
44+
From the terminal, enter:
45+
46+
`pip install pyforest`
47+
48+
And you're ready to go.
49+
50+
Please note, that this will also add pyforest to your IPython default startup settings.
51+
52+
53+
## Frequently Asked Questions
54+
55+
- "I need to always explicitly write down the libraries I used at the top of my scripts." Of course, you can export the import statements for all used libraries with `active_imports()`.
56+
57+
- "Doesn't this slow down my Jupyter or Python startup process?" No, because the libraries will only be imported when you actually use them. Until you use them, the variables like `pd` are only pyforest placeholders.
58+
59+
- "Why can't I just use the typical IPython import?" If you were to add all the libraries that pyforest includes, your startup time might take more than 30s.
60+
61+
- "I don't have and don't need tensorflow. What will happen when I use pyforest?" Tensorflow is included in pyforest but pyforest does not install any dependencies. You need to install your libraries separately from pyforest. Afterwards, you can access the libraries via pyforest if they are included in the [pyforest imports](src/pyforest/imports.py).
62+
63+
- "Will the pyforest variables interfere with my own local variables?" Please make sure that you import pyforest at the beginning of your script. Then you will always be safe. You can use your variables like you would without pyforest. The worst thing that can happen is that you overwrite a pyforest placeholder and thus cannot use the placeholder any more (duh).
64+
65+
- "What about auto-completion on lazily imported modules?" It works :) As soon as you start the auto-completion, pyforest will import the module and return the available symbols to your auto-completer.
66+
67+
68+
## Contributing
69+
In order to gather all the most important names, we need your help. Please open a pull request and add the imports that we are still missing to the [pyforest imports](src/pyforest/imports.py). You can also find the guidelines in the [pyforest imports file](src/pyforest/imports.py)
70+
71+
72+
## About
73+
pyforest is developed by Florian, Tobias and Guido from 8080 Labs. Our goal is to improve the productivity of Python Data Scientists. Other projects that we are working on are [edaviz.com](https://edaviz.com) and [bamboolib.com](https://bamboolib.com)
74+
75+
76+
## Join our community and grow further
77+
If you
78+
- like our work or
79+
- want to become a faster Python Data Scientist or
80+
- want to discuss the future of the Python Data Science ecosystem or
81+
- are just interested in mingling with like-minded fellows
82+
83+
then, you are invited to [join our slack](https://join.slack.com/t/fasterpyds/shared_invite/enQtNzExNDMxNzQ3NTU0LTNhMjI3MTM5ZGZlN2Y4NWIwOWUxZDg4ODE1MzkyNTc1NDhmNjg5ZGZhYmI1ZjBkNzgzMTI3MDcxNWMzZDA0NGQ).
84+

examples/demo.ipynb

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"# from pyforest import * # not needed because of auto_import"
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": null,
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"df = pd.read_csv(\"titanic.csv\")"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"metadata": {},
25+
"outputs": [],
26+
"source": [
27+
"sns.distplot(df.Age)"
28+
]
29+
},
30+
{
31+
"cell_type": "code",
32+
"execution_count": null,
33+
"metadata": {},
34+
"outputs": [],
35+
"source": [
36+
"active_imports()"
37+
]
38+
}
39+
],
40+
"metadata": {
41+
"jupytext": {
42+
"cell_metadata_filter": "-all",
43+
"notebook_metadata_filter": "-all"
44+
},
45+
"kernelspec": {
46+
"display_name": "Python 3",
47+
"language": "python",
48+
"name": "python3"
49+
},
50+
"language_info": {
51+
"codemirror_mode": {
52+
"name": "ipython",
53+
"version": 3
54+
},
55+
"file_extension": ".py",
56+
"mimetype": "text/x-python",
57+
"name": "python",
58+
"nbconvert_exporter": "python",
59+
"pygments_lexer": "ipython3",
60+
"version": "3.7.4"
61+
}
62+
},
63+
"nbformat": 4,
64+
"nbformat_minor": 2
65+
}

0 commit comments

Comments
 (0)