Project Reader
Read and summarize the files in your projects. An easy way to achieve the following:
Count the number of lines in your project.
Visualize the hierarchy of the files in your project.
Create a summary of all files.
Using project reader from console
This entails running project_reader module in console python -m project.read. It takes one positional argument and two other optional arguments. The positional argument is the path of the project.
python -m project.read "C:\Users\admin\django projects\blog-site"
Optional one is the folders to ignore in a comma-separated string.
python -m project.read "C:\Users\admin\django projects\blog-site" --ignore ".idea, .vscode"
Optional two is the final output file.
python -m project.read "C:\Users\admin\django projects\blog-site" --output "blog_site_tree.txt"
OR
python -m project.read "C:\Users\admin\django projects\blog-site" --ignore ".idea, .vscode" --output "blog_site_tree.txt"
This will output a file a tree visualizing you project.
Go ahead and run the line below to learn more
python -m project.read -h
Using project reader in python code or from the interpreter
You can choose to use from the interpreter or in your code using the help of project.folder_reader.py and project.folder_visualizer.py
Folder visualizer (project.folder_visualizer.py)
Example 1
question_1.py - 38
question_2(factorial).py - 66
question_21.py - 45
.IDEA
github projects 2.iml - 11
misc.xml - 5
modules.xml - 9
workspace.xml - 17
DICTIONARIES
muremwa.xml - 5
---- END OF DICTIONARIES ----
---- END OF .IDEA ----
DESC
Run the code below
from project.folder_visualizer import assign_classes, draw
klasses = assign_classes('test_FOLDER_GITHUB_PROJECTS_2.txt')
draw(klasses, file_name="results.txt")
This is the output in “results.txt”
Example 2
GITHUB_PROJECTS_2
|
|---- question_1.py (38 lines)
|
|---- question_2(factorial).py (66 lines)
|
|---- question_21.py (45 lines)
|
|---- .IDEA
| |
| |---- github projects 2.iml (11 lines)
| |
| |---- misc.xml (5 lines)
| |
| |---- modules.xml (9 lines)
| |
| |---- workspace.xml (17 lines)
| |
| |---- DICTIONARIES
| | |
| | |---- muremwa.xml (5 lines)
|
|---- DESC
Folder reader (project.folder_reader.py)
Contains the following classes:
KillerFolder - extends the Folder class from project.folder_visualizer.py but adds the following methods (eq) and statement and the path property.
KillerFile - extends the File class from project.folder_visualizer.py but adds the path property
FolderStore - extends the in-built list class. It stores only KillerFolder objects.
RootDoesNotExist - an exception that is raised when one tries to access the root KillerFolder object of a FolderStore object that has none.
Contains the following functions:
kill_project - takes in a path of the folder to read, reads and returns a string representative of the files and folders similar to [example 1](#Example 1) above. You can add a keyword argument called ignore to show what folders to ignore.
print_statement - takes the statement from kill_project and writes it to a file and returns the name of that file. Usually FOLDER_SOMETHING.txt
Using project.folder_reader.py (demonstrated using the folder names TOP)
import os
from project.folder_reader import kill_project, print_statement
# change into the folder you want to read
os.chdir(os.getcwd() + "\\TOP")
# get the statement
statement = kill_project(os.getcwd(), ignore=['.vscode', '.idea'])
# write the statement to a file
file_name = print_statement(statement) # the file_name can be passes into folder_visualizer.assign_classes()
The last line writes to a file called “FOLDER_TOP.txt”
file.txt - 1
VO
s.txt - 1
KO
l1.txt - 1
---- END OF KO ----
---- END OF VO ----
XO
n.txt - 1
BO
temp.txt - 1
---- END OF BO ----
JO
sd.txt - 1
PO
l.txt - 1
---- END OF PO ----
---- END OF JO ----
---- END OF XO ----
Notice how the folder ‘.idea’ was ignored.
Metadata
Release files for project-reader 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| project-reader-0.0.3.tar.gz | 10.5 kB | Without provenance | Details for project-reader-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| project_reader-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for project_reader-0.0.3-py3-none-any.whl |
Total release size: 20.9 kB
Release files / project-reader-0.0.3.tar.gz
| Download URL | project-reader-0.0.3.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f63d68e92c820a524a720d6e7593113bbe8283d7e740d669aa28d2e415f12ec
|
|
BLAKE2b-256 checksum How to use checksums |
2b138902bf9f7d675c242a92c67f51a522e20ced833ba86d2b0046d904d8f2e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.7
|
Release files / project_reader-0.0.3-py3-none-any.whl
| Download URL | project_reader-0.0.3-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49ddda1e9ed0fd66d372a044be7bb4087fbfbfa9742781a21c2c528b246efe67
|
|
BLAKE2b-256 checksum How to use checksums |
0fed22b484f2d714ea0a2e300f05b6600d19af203d5c2cfcf1c8b25c816bd5ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.7
|
Security for project-reader 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.