https://github.com/andrewpetrochenkov/list-imports.py
:snake: list python file imports
https://github.com/andrewpetrochenkov/list-imports.py
cli python
Last synced: about 2 months ago
JSON representation
:snake: list python file imports
- Host: GitHub
- URL: https://github.com/andrewpetrochenkov/list-imports.py
- Owner: andrewpetrochenkov
- License: unlicense
- Created: 2019-03-15T12:24:35.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-12-03T21:03:29.000Z (about 5 years ago)
- Last Synced: 2025-04-06T11:47:29.034Z (9 months ago)
- Topics: cli, python
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://pypi.org/project/list-imports/)
[](https://unlicense.org/)
[](https://github.com/andrewp-as-is/list-imports.py/actions)
### Installation
```bash
$ [sudo] pip install list-imports
```
#### Examples
```python
import list_imports
imports = list_imports.get("file.py")
```
from string:
```python
imports = list_imports.parse(open("file.py").read())
```
absolute imports only
```python
list(filter(lambda i:i[0]!='.',list_imports.get("file.py")))
```
cli:
```bash
$ find . -type f -name "*.py" | xargs python -m list_imports
$ find . -type f -name "*.py" | xargs python -m list_imports | awk -F"." '{print $1}'
```