Commit graph

107 commits

Author SHA1 Message Date
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
David Arnold
8dabd2bae6
refactor: make the app source accessor explicit
The parent folder of a python module (inside `./site-packages`) can be
`./lib`. Separate code paths that depend on the app source into its own
getter so that patching that function becomes easier in those cases
where the python module is not served from the source checkout.
2023-08-20 01:11:05 +02:00
Ankush Menat
7af8f6a8ff
refactor: replace usage of mktemp (#22093) 2023-08-17 11:03:02 +00:00
barredterra
b553ed98d8 refactor: inline immediately returned variable
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
Suraj Shetty
fe25fe1db1 feat: A flag (--save-metafiles) to save esbuild metafiles
- Useful for analysing bundle size
2023-06-26 09:14:17 +05:30
Suraj Shetty
5581f960da chore: Update node version requirement in build config 2023-06-26 09:14:17 +05:30
Ankush Menat
4c08689744 perf: defer psutil import 2023-06-24 15:22:01 +05:30
Ankush Menat
8a37d6d278
perf: reduce memory usage of background processes (#21467)
* perf: defer translation.py imports

This indirectly imports babel which isn't really required most of the
time.

* perf: defer gzip import

* perf: move validate_and_sanitize_search_inputs

This causes all sorts of indirect imports and increases memory usage

* perf: defer requests module imports

* perf: defer system settings import

* perf: defer LOG_DOCTYPES import

Causes many indirect imports

* perf: defer update_site_config

* perf: defer notifications import

* perf: remove unused import

* perf: defer safe exec import

* test: memory usage overhead
2023-06-23 12:51:45 +05:30
Ankush Menat
3005e66e45 refactor!: Drop previously deprecated code 2023-06-13 16:00:43 +05:30
gavin
440825a372
refactor: which > find_executable (#18872)
Use shutil from the standard library instead of distutils to find
executables in PATH
2022-11-14 18:15:38 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Ankush Menat
d35d7ffbe2 fix: remove bare exception catching
A bare except catches lots of things (like generator iteration end) and should never be used.
2022-06-28 18:05:00 +05:30
Gavin D'souza
b696fa6da5 perf: Pre-compile and re-use regexp pattern
Converted all possible usages of re.* that weren't compiling the regex
separately and re-using it. Separated out the compiled patterns as
global variables. Repetitive patterns could be made DRY-er.

Would be nicer to have all regexes in a single module so that we could
re-use better, keep track of outdated, and keep checks for possible
reDos' etc
2022-06-08 14:07:38 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Gavin D'souza
d72aeca18f chore!: Deprecate frappe.utils.minify
* Remove dead code from build.py
* Whitespaces & imports style fixes
2022-02-11 20:22:56 +05:30
Ankush Menat
121533cf13
refactor: remove chalk dependency 2021-10-20 12:46:05 +05:30
gavin
fbe925b42c
Merge pull request #14238 from resilient-tech/autoreload_on_build
feat: automatically reload web pages whenever JS/CSS assets are rebuilt
2021-10-19 14:13:04 +05:30
Sagar Vora
770bda8cc6 fix: use cint, as os.environ only contains string values 2021-10-19 04:04:00 +05:30
Pruthvi Patel
d99403393a fix: rename auto-reload to live-reload 2021-10-18 17:52:33 +05:30
Ankush Menat
e6bbc698d0
ci: fail CI if asset bundling fails (#14364)
* ci: fail CI if asset bundling fails

* chore: formatting

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2021-10-08 11:40:31 +05:30
Gavin D'souza
d8020672b0 refactor(minor): Built Assets Management 2021-09-21 16:20:15 +05:30
Sagar Vora
01d69b67c7 feat: automatically reload web pages whenever JS/CSS assets are rebuilt 2021-09-17 12:33:36 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
4e7526066f Merge branch 'develop' into drop-py2-code 2021-05-28 10:51:39 +05:30
Faris Ansari
23406d031a fix: Store assets.json directly in assets folder
assets.json stores assets of all apps, so doesn't make sense to put it in frappe folder
2021-05-27 11:50:56 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Gavin D'souza
33ba6494f8 Merge branch 'develop' into deprecation-warnings 2021-05-19 13:18:13 +05:30
Gavin D'souza
8328e03d0d fix: Unstrip better to handle multi line outputs in smaller
terminal sizes
2021-05-19 13:17:29 +05:30
Faris Ansari
f6cd91be58 fix: Show warning for incompatible node version 2021-05-18 16:47:38 +05:30
Faris Ansari
f8ca990a83 Merge remote-tracking branch 'upstream/develop' into esbuild 2021-05-16 11:26:43 +05:30
Gavin D'souza
7930b84b71 Revert "fix(build): Use NamedTemporaryFile from mktemp"
This reverts commit 085290630e.
Breaks via https://github.com/frappe/frappe/pull/13145/checks?check_run_id=2573309928
2021-05-13 12:28:22 +05:30
Gavin D'souza
085290630e fix(build): Use NamedTemporaryFile from mktemp 2021-05-13 11:11:45 +05:30
Gavin D'souza
6581ed886a Revert "fix: Don't re-copy node_modules if public already has it"
This reverts commit 548eb079c8.

Seems to break UI components. Learnt this from Cypress UI tests
ref: https://github.com/frappe/frappe/pull/13145/checks?check_run_id=2567366717
2021-05-12 21:00:18 +05:30
Gavin D'souza
098f1564f3 refactor: bench build
* Deprecate --make-copy and --restore options for build in favour of --hard-link
* Show feedback for linking/copying application assets
2021-05-11 21:15:20 +05:30
Gavin D'souza
548eb079c8 fix: Don't re-copy node_modules if public already has it
public folder already has a symlink to node_modules. So we can just
check if the realpath already exists and ignore copying it again if the
same exists
2021-05-11 20:09:21 +05:30
Gavin D'souza
e54b1d5835 refactor: Link static assets from apps to sites/assets 2021-05-11 15:23:02 +05:30
Gavin D'souza
b5a121a1cb fix: Drop compatability code
* Use raw text for regex patterns to avoid Deprecation warnings
2021-05-11 15:19:35 +05:30
Faris Ansari
41d9bc64e1 fix: Run build command only in bench build 2021-05-07 14:49:19 +05:30
Faris Ansari
add84065ad Merge remote-tracking branch 'upstream/develop' into esbuild 2021-05-07 12:55:04 +05:30
Gavin D'souza
0ad122421d fix: Don't hide warnings unnecessarily 2021-05-05 18:51:51 +05:30
Faris Ansari
d290f41abd fix: Support for built assets downloading 2021-05-04 06:52:07 +05:30
Faris Ansari
9f4edaedbb fix: bench build command
- Add --apps option
- Add --production option
- Add --apps option for bench watch command
- Add --skip_frappe in esbuild
2021-05-02 15:13:41 +05:30
Suraj Shetty
358a9fabea
fix: max_old_space_size limit for node processes (#12494)
Co-authored-by: Gavin D'souza <gavin18d@gmail.com>
2021-03-01 16:43:18 +05:30
Aditya Hase
9614886fa5
perf: Remove requests from import tree 2021-02-19 21:14:12 +05:30
Gavin D'souza
f1cd3388ba style: Black-ish + fixed typos + Optimized imports 2020-11-17 16:29:54 +05:30
Gavin D'souza
86dd74f277 perf: Maintain set of created paths to reduce path.exists calls 2020-10-13 17:53:46 +05:30
Gavin D'souza
f5e1cdc5ce fix: Restore assets during bench init 2020-10-13 17:25:05 +05:30
Gavin D'souza
043e6804f4 chore: Add error message if something goes wrong 2020-09-08 19:45:26 +05:30
Gavin D'souza
7f61fa68fc fix: Consistent spacing and cases for messages 2020-09-08 16:01:59 +05:30
Gavin D'souza
5cf3b2416c chore: Drop dead code 2020-09-08 15:30:09 +05:30