Class Manage File
Module manage create file
Cleanup
Cleanup()
Bases: CreateFileBaseAndUpdate
Source code in fenv\manage_file.py
599 600 601 602 603 604 605 |
|
remove_lib_not_default_in_env
remove_lib_not_default_in_env()
Removes all the libraries that are not in the default environment
Source code in fenv\manage_file.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
|
CreateFileBaseAndUpdate
CreateFileBaseAndUpdate(name, state)
Source code in fenv\manage_file.py
17 18 19 20 21 22 23 24 |
|
create_file_freeze
create_file_freeze()
It creates a file called "requirements.txt" and writes the string "black" to it
Source code in fenv\manage_file.py
74 75 76 77 78 79 80 81 82 |
|
create_file_gitignore
create_file_gitignore()
It creates a file called .gitignore and writes the string "*.pyc" to it
Source code in fenv\manage_file.py
84 85 86 87 88 89 90 91 |
|
create_file_main_py
create_file_main_py()
Create a file main.py and write a function called main() inside of it
Source code in fenv\manage_file.py
26 27 28 29 30 31 32 33 34 |
|
create_file_readme_md
create_file_readme_md()
It creates a file called readme.md and writes the markdown text to it
Source code in fenv\manage_file.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
create_folder
create_folder()
It creates a folder with the name of the argument passed to it
Example
create_folder("project_name")
Return
1 : if has folder already
Source code in fenv\manage_file.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
create_setting_vscode
create_setting_vscode()
It creates a file settings.json inside the virtual environment
env_path (str): The path to the virtual environment
Example
create_setting_vscode("env_path")
Return
None
Source code in fenv\manage_file.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
create_virtualenv
create_virtualenv()
It creates a virtual environment with the name you pass to it
Parameters:
Name | Type | Description | Default |
---|---|---|---|
virtual_env_name |
str
|
The name of the virtual environment you want to create. |
required |
Example
create_virtualenv("virtual_env_name")
Return
None
Source code in fenv\manage_file.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
process_create_base_file_and_update
process_create_base_file_and_update()
If the state is create, create the files main.py, freeze.py, gitignore.py, and readme.md. If the state is update, update the file readme.md
Source code in fenv\manage_file.py
209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
procress_only_create_project
procress_only_create_project()
It creates a virtual environment and a vscode settings file.
Source code in fenv\manage_file.py
223 224 225 226 227 228 229 230 231 |
|
run_install_module_base
run_install_module_base()
It installs the base Python modules
:param env: The environment object
Source code in fenv\manage_file.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
update_file_readme_md
update_file_readme_md()
It update a file called readme.md and writes the markdown text to it
Source code in fenv\manage_file.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
GitCloneVirtualENV
GitCloneVirtualENV(link)
Source code in fenv\manage_file.py
647 648 649 650 651 652 653 |
|
cmd_git_clone
cmd_git_clone()
"A function that is called when the user runs the command "git clone"."
Source code in fenv\manage_file.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
|
url_exists
url_exists()
The function "url_exists" is defined, but its implementation is missing.
Source code in fenv\manage_file.py
674 675 676 677 678 679 680 681 682 683 684 |
|
InstallModule
InstallModule(arg=None)
Module install module
Source code in fenv\manage_file.py
307 308 309 310 311 312 313 |
|
add_module_to_txt
add_module_to_txt()
It takes the argument from the command line and adds it to the requirements.txt file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
str
|
The arguments passed to the script |
required |
Example
add_module_to_txt("package_name")
Return
None
Source code in fenv\manage_file.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
install_package_all
install_package_all()
install all packages in requirements.txt file using pip install -r requirements.txt
Source code in fenv\manage_file.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
|
install_package_only
install_package_only()
It tries to install a package, if it fails, it prints a message
args (str): The arguments passed to the command.
Example
install_package_only("package_name")
Return
None
Source code in fenv\manage_file.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
|
install_required_package
install_required_package()
It checks if the platform is Windows, if it is, it runs the command:
.{self.env_directory}\Scripts\python.exe -m pip install
{self.package_name.install}
The problem is that it doesn't work
Source code in fenv\manage_file.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
OnlyVirtualEnv
OnlyVirtualEnv()
Module create only env
Source code in fenv\manage_file.py
237 238 239 240 241 242 |
|
create_name_env
create_name_env()
If the user enters a name for the virtualenv, the function will check if the name is in English only, if it is, it will return the name, if not, it will return a name automatically :return: The name of the virtual environment.
Source code in fenv\manage_file.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
|
create_name_env_auto
create_name_env_auto()
It creates a random name for the environment :return: A string
Source code in fenv\manage_file.py
244 245 246 247 248 249 250 251 252 |
|
create_virtualenv_not_change_dir
create_virtualenv_not_change_dir()
It creates a virtual environment with the name you pass to it
Parameters:
Name | Type | Description | Default |
---|---|---|---|
virtual_env_name |
str
|
The name of the virtual environment you want to create. |
required |
Example
create_virtualenv("virtual_env_name")
Return
None
Source code in fenv\manage_file.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
run_process
run_process()
It creates a virtual environment and a vscode settings file.
Source code in fenv\manage_file.py
290 291 292 293 294 295 296 297 298 299 300 301 |
|
UninstallModule
UninstallModule(arg)
Source code in fenv\manage_file.py
481 482 483 484 485 486 487 |
|
cmd_uninstall_package
cmd_uninstall_package()
It uninstalls a package from the virtual environment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
str
|
The arguments passed to the command |
required |
Example
cmd_uninstall_package("package_name")
Return
None
Source code in fenv\manage_file.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 |
|
process_run
process_run()
"A function that is called when the user runs the command "uninstall"."
The first line of the function is a docstring. It's a string that describes what the function does. It's a good idea to include a docstring for every function you write
args (str): The arguments passed to the command
Example
process_run("package_name")
Return
None
Source code in fenv\manage_file.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
|