Comments (6)
Well, it's mentioned in the docs, that for CLI all common components are required. Besides that, it's recommended to install CLI using pipx.
from faker-file.
I guess I missed that in the docks. No worries. Your tool, your prerogative.
from faker-file.
That's not what I meant. Obviously, it's made to soften the pain of other devs like me. Just thinking logically, trying to do what's best. Conditionally checking installed packages, loading everything lazily and on-demand is possible, but requires efforts and if not justified - is a waste of time.
As far as I can see, the main purpose of the CLI is to generate a dummy file for manual testing. Like, whenever I need to do manual testing and need different formats, instead of searching the internet, I just use CLI, which is installed using pipx
on my local machine. Pipx creates isolated environments. No dependency hell.
For automated testing, it's indeed highly optional. You don't need any components, except Faker
. Basic formats, like TXT, ZIP, TAR, BIN, CSV are then supported. Risks of dependency hell or inappropriate licenses is quite minimal.
What's your use-case?
from faker-file.
Sorry, didn't mean to come off snippy. Wasn't my intent. Was just playing with the tool and thought you'd want to know.
Conditional checking is a pain, I agree. A simple fix might be to wrap the loading piece in try/except and print out a message saying "need to pip install faker-file[common] to use the CLI"
from faker-file.
Done in 0.16.1.
from faker-file.
Ah, I was just checking the statistics and found out you were mentioning this project in the podcast.
One thing that hasn't been briefly mentioned in the docs, but probably one of the things you were wondering about.
The returned value of any file generation (whether you choose that to be a real file or bytes) is not really a string (path to the file) or bytes, but a wrapper around these objects. In case if files it's a StringValue
and in case of bytes - BytesValue
.
I have made a demo in Jupyter notebook for interactive presentations. If you're curious, you better run it from cloned repository (as it depends on a Django Kernel for Jupyter notebook, provided by django-extensions
package).
from faker import Faker
from faker_file.providers.docx_file import DocxFileProvider
FAKER = Faker()
FAKER.add_provider(DocxFileProvider)
file = FAKER.docx_file()
print(file) # will print relative path to the file from the given `root_path` directory.
print(file.data["filename"]) # will print absolute path to the file
print(file.data["content"]) # will print the text content of the file
These objects do have metadata stored in a data
property. Data contains a lot of handy information to support tests, but one common thing that every file format has is the filename
, which is an absolute path to the file. The reasoning is briefly explained here.
from faker-file.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faker-file.