2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-14 09:14:04 +00:00
Commit Graph

1993 Commits

Author SHA1 Message Date
Gavin D'souza
a2ccc30bc3 fix: Initialize bench in get-app with --init-bench 2021-11-29 18:34:58 +05:30
Gavin D'souza
877e812fbb fix: Patch to move archived_sites to archived/sites
This patch runs only if Frappe >= v14. Doesn't do anything else

Frappe PR: https://github.com/frappe/frappe/pull/15060
2021-11-26 18:53:13 +05:30
Gavin D'souza
b7994e21b1 fix: Show warning while using experimental features
This shows a "WARNING:..." whenever any --use-feature flag is used
2021-11-26 16:28:18 +05:30
Gavin D'souza
1b2bb87ab7 refactor: Bench verbosity
It's off by default. If you want it enabled, pass --verbose or -v
following `bench`. The verbosity only changes how pip installs work.
Other stuff is immaterial at this point.

Eg: bench -v setup requirements
2021-11-26 16:24:56 +05:30
Gavin D'souza
6081690d7b refactor(minor): python packages setup 2021-11-26 12:47:29 +05:30
Gavin D'souza
4798992abf chore: Update setup.py
* Add long description using README.md
* Add project URLs. This will brighten up
  https://pypi.org/project/frappe-bench/ a bit
* Update contact, license info, etc
* Add project classifiers
2021-11-26 12:00:29 +05:30
Gavin D'souza
d63a9883e0 feat(minor): Bench.python property that points to env python 2021-11-26 11:54:32 +05:30
Gavin D'souza
27128c7c18 fix: Import bench.cli
For whatever reason, Travis complained saying "AttributeError: module 'bench' has no attribute 'cli'" but works fine locally :')
2021-11-18 19:02:22 +05:30
Gavin D'souza
a8564f3991 chore: Mark methods under job/step 2021-11-18 18:26:48 +05:30
Gavin D'souza
7c653db703 refactor: CLI entry point
* Optimized condiitonal checks
* Removed warnings for src, --version
* Handled positional shifts due to usages of --use-feature (by
  set.intersection)
* Raise Exception always instead of hiding the traceback
2021-11-18 18:26:39 +05:30
Gavin D'souza
225fce5be6 fix: Show bench init job via bench get-app (conditional)
This happens when dynamic-feed is enabled
2021-11-18 18:13:14 +05:30
Gavin D'souza
f230778972 refactor: CLI Rendering Engine
* Hanlde job-step renders
* Use context manager for managing renders and state
* Job and Step remain process agnostic - neither are dependant on the
  other
2021-11-18 18:10:01 +05:30
Gavin D'souza
6d10d75bb1 fix: Show pip's help menu when --help is passed in pip command 2021-11-18 18:07:32 +05:30
Gavin D'souza
7c4b6cea2b style: Black-ish + Flake8 2021-11-18 12:02:37 +05:30
Gavin D'souza
b92fb1401b feat: Pass --use-feature='dynamic-feed' for new CLI 2021-11-18 12:02:03 +05:30
Gavin D'souza
806d543fac fix: Show traceback if error occurs during init, get outside bench dir 2021-11-18 01:04:02 +05:30
Gavin D'souza
f117959801 feat: Dynamic Output rendering
Each operation can be broken down to multiple jobs. For instance, the
update operation can be broken down into: setting up bench dirs, env,
backups, requirements, etc.

Each step has a lot of output since Frappe requires a lot of complex
stuff to be done as a pre-requisite. Bench tries to simplify a lot in a
single command. Once, a step is completed, it's output is not really
required. So, we can ignore it to reduce the noise.

Here's where the `bench.cli.fancy` variable kicks in. Along with the
refactored log and new step wrapper, it makes the above thing possible.

At this point, there's no way to set this var from the end user...given
I'm still developing this. In the later commits, the idea is to pass a
flag similar to pip's --use-feature flag.
2021-11-18 01:00:04 +05:30
Gavin D'souza
3995b9237b fix: raise (by default) when exec_cmd fails 2021-11-18 00:41:37 +05:30
Gavin D'souza
cd1f526d09 perf: Cache Bench and App instantiation 2021-11-18 00:39:48 +05:30
Gavin D'souza
ac07d8dc52 refactor: bench.utils.log
Maintain `bench.LOG_BUFFER` for entire process when `bench.cli.fancy` is set
2021-11-18 00:36:13 +05:30
Gavin D'souza
747be65f92 refactor(minor): switch branch
* Don't update node packages twice (already managed via
  update_requirements)
* Don't reload bench.utils - this made sense back when bench was updated
  along with the apps
* Fix utils namespaces. Import instead of ....
2021-11-18 00:31:51 +05:30
Gavin D'souza
58e3d4931b refactor: bench update workflow
* Separate out branch validation logic
* Add type hints
* Raise named Exception "CannotUpdateReleaseBench" instead of SystemExit
* Use "newer" APIs wherever possible
2021-11-18 00:18:10 +05:30
Gavin D'souza
4655f6e785 refactor(minor): Dependency resolving
* Added a requirements method under BenchSetup
* Resolve Frappe dependencies prior to other apps
* Fixed issues with missing path in update_env_pip
2021-11-18 00:10:25 +05:30
Gavin D'souza
84d1b209ba chore: Added Typing + styling 2021-11-18 00:03:42 +05:30
Gavin D'souza
cd252d3476 refactor: setup dev requirements
* Remove unwanted log message 🤢. It was inconsistent...this had to be
  done...rip
* Fix missing import - install_python_dev_dependencies
* Don't setup node + python requirements when --dev flag is passed
2021-11-17 23:56:55 +05:30
Gavin D'souza
30e3e725a8 fix: Show traceback on bench init failure
Other changes:
* Invoke internal init function instead of invoking click
command. This was done to avoid handling random Exceptions that are done
in the command definition
* os.chdir after initializing new bench in get_app
2021-11-17 23:55:15 +05:30
Gavin D'souza
a192240cec fix: Check if app is installed in env via initialize_apps
Consequence: Bench.apps only will have valid frappe apps that are installed in env
2021-11-17 23:51:28 +05:30
Gavin D'souza
67e5db6979 chore: Drop dead code
bench.prepare_staging module wasn't being utilized from any internal
APIs. Dropped it ;)
2021-11-17 23:49:11 +05:30
Gavin D'souza
b6fc562b48 refactor: get_app flow
* Changes in get_app fix path/cwd issues and order of resolving deps: py
  -> dev py -> yarn
* Pass verbosity in setup_app_dependencies via get_app
* Say hi to new utils: get_available_folder_name, get_traceback
2021-11-17 23:45:30 +05:30
Gavin D'souza
4ba5422b65 fix: Move logging to lower level App.get API 2021-11-15 12:40:20 +05:30
Gavin D'souza
13ed9beca5 fix: frappe app can exist without public folder
other change:
* sync apps.txt manually after dep apps are also setup; right before
  build step
2021-11-15 12:39:33 +05:30
Gavin D'souza
5170048d6d style: Black-ish app.py for readability 2021-11-15 12:37:43 +05:30
Gavin D'souza
68c0549c18 refactor(get_app): Workflow for clones/install 2021-11-15 12:37:03 +05:30
Gavin D'souza
79980c3c55 fix: Archived app naming, apps.txt sync
* apps.txt wasn't being synced in time so the build was failing, this
  changes that
* Apps archived on the same day weren't being numbered properly...it
  went from _1 to _1_2 and so forth. This is fixed to show _1, _2 and so
  on
2021-11-13 14:54:08 +05:30
Gavin D'souza
c636c7c133 fix: Use test frappe app - frappe_docs instead of wiki or chat 2021-11-13 14:27:45 +05:30
Gavin D'souza
6890d98847 feat: Add alias for remove-app: rm, remove 2021-11-13 14:27:25 +05:30
Gavin D'souza
e074a1d886 fix: Show traceback in dev mode and set exit code on errors 2021-11-13 14:26:37 +05:30
Gavin D'souza
6123cd5b49 feat: Restart process manager for develop mode 2021-11-13 14:24:39 +05:30
Gavin D'souza
3709682231 fix: Handle collisions while moving apps 2021-11-13 14:23:49 +05:30
Gavin D'souza
17edb4797b fix: Don't fetch meta for rm app 2021-11-13 14:23:08 +05:30
Gavin D'souza
1330e66d07 style: Flake8 + Black-ish
Tried styling and following standards over teh following modules:
* bench.app
* bench.bench
* bench.exceptions
* bench.utils
2021-11-13 03:01:55 +05:30
Gavin D'souza
d2fba5fe52 fix: Cleanup import hell (contd) 2021-11-13 02:53:32 +05:30
Gavin D'souza
e2fd9de921 fix: Cleanup import hell
There was this bug that said `bench.utils.bench` doesn't have attribute
VERSION or whatever bench/__init__ was supposed to have. Now
bench/utils/__init__ had an `import bench` statement that was supposed
to ask for the top level module...but conflicted with the utils.bench
namespace. Changed the line in utils to `from bench import PROJECT_NAME,
VERSION` and it just works now...oh well

Other changes made were an attempt to cleanup and simplify the multi
level dotted path calls
2021-11-13 01:48:30 +05:30
Gavin D'souza
b2e0fd15c6 ci: Don't install bench in sudo 2021-11-13 00:25:01 +05:30
Gavin D'souza
fafb29477c test: Use frappe/chat as the test install app 2021-11-13 00:24:32 +05:30
Gavin D'souza
c4b8391716 fix: Raise and handle Exception class
* Instead of sys.exit, raise ValidationError
* Let's not handle BaseException, just Exception
* Use ValidationError instead of invalid syntax raise str
2021-11-13 00:20:05 +05:30
Gavin D'souza
e08a12477d chore: Get rid of import * utils 2021-11-13 00:19:12 +05:30
Gavin D'souza
a2ecb398dd ci: Use Nodejs version 14 for Tests 2021-11-12 23:15:49 +05:30
Gavin D'souza
4d1ddc4722 refactor: Bench.sync => Bench.apps.sync
* Added missing imports
* Fixed broken import paths
2021-11-12 22:13:27 +05:30
Gavin D'souza
71d178dde9 fix: sync apps file in init, imports and no warn in CI 2021-11-12 20:31:25 +05:30