Git Product home page Git Product logo

optimus's Introduction

optimus's People

Contributors

meodudlye avatar sveetch avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

optimus's Issues

Imports local settings from another settings does not work

The dummy technic used to import the settings seems to bring problem like if you try to import a local settings file in another settings file it fail,

For example if from a "prod_settings.py" i put :

from settings import *

And after i try to use it like so :

optimus-cli build --settings=prod_settings

It will fail with an exception like this :

Traceback (most recent call last):
File "/home/django/Emencia/sveetch_vrac/optimus_builds/bin/optimus-cli", line 10, in <module>
    parser.dispatch()
File "/home/django/Emencia/sveetch_vrac/optimus_builds/lib/python2.6/site-packages/argh/helpers.py", line 381, in dispatch
    return dispatch(self, *args, **kwargs)
File "/home/django/Emencia/sveetch_vrac/optimus_builds/lib/python2.6/site-packages/argh/helpers.py", line 270, in dispatch
    for line in lines:
File "/home/django/Emencia/sveetch_vrac/optimus_builds/lib/python2.6/site-packages/argh/helpers.py", line 354, in _execute_command
    for line in result:
File "/home/django/Emencia/sveetch_vrac/optimus_builds/lib/python2.6/site-packages/argh/helpers.py", line 337, in _call
    result = args.function(args)
File "/home/django/Emencia/sveetch_vrac/optimus_builds/lib/python2.6/site-packages/optimus/cli/build.py", line 25, in build
    settings = import_project_module(args.settings)
File "/home/django/Emencia/sveetch_vrac/optimus_builds/lib/python2.6/site-packages/optimus/conf.py", line 20, in import_project_module
    settings_mod = imp.load_module(name, fp, pathname, description)
File "/home/django/Emencia/sveetch_vrac/optimus_builds/zik_building/prod_settings.py", line 7, in <module>
    from zik_building.settings import *
ImportError: No module named zik_building.settings

The settings import technic should use something like Django wich push the projet path to the pythonpath.

babel.cfg deprecation ?

I don't find anymore documentation about this file which was the reference config a long time ago and so i'm unable to find the right location for it in project templates (at root ? in project ? ... ?).

And is it still really implemented ? Maybe it have moved to another file ?

We have to find to enhance things, for now we may assume it as broken, however not any error is raised with Jinja and PO/MO files, but it may be with using the po CLI (didn't tested it again yet).

Make CherryPy optionnal

Remove dependancy in setup.py but only after we documented how to install it (with pip) to have the runserver.

Add HTTPS_ENABLED setting

New optional boolean setting which default will be False. If set to True, prefix on SITE.web_url will be https.

Docs: Explains Page object

We need to detail the Page object for the usual overridable methods like get_context(), to avoid the need to look at the sources.

Check action on command line

The command line need of a "check" action to check if all defined source (templates, assets, etc..) are in place to help to debug an error on build.

Also, this new action should be announced at the end of creating a new project with the "init" action.

Command to init a new project

At first it will simply load a project structure with the required files (settings, etc..) to start a new project configured with Optimus.

Bad name for setting EXTRA_BUNDLES

Seems a bad name for this setting since there is not other BUNDLE setting, so in fact this is not extra bundles, just the bundles to use.

Check this in code and if it's true, change it. Maybe think to keep the old name and reflect it for backward compatibility ?

Big cleaning for sanity and update for Python3 support

Major rewrite for better software quality.

  • Test coverage with pytest and tox;
  • Renaming and restructuring modules (every stuff around page goes to 'pages', stuff for i18n goes to 'i18n', etc..);
  • Code documentation using sphinx+napoleon;
  • Code quality coverage with flake8;
  • Rewrite usage documentation;
  • Better and maintained asset filters #21;
  • Rewrite commandline scripts with 'click' #23;

Restore restructured view

Currently not unittested, too light documentation and maybe not accurate.

Have to write it again or move it to a plugin.

Use cookiecutter instead of homemade templates

Shipped project templates (used through init command) have been made with a homemade system which is very basic and not easy to maintain.

We must migrate to cookiecutter to maintain these templates, at least the "basic" and "i18n", maybe add another new one for something more useful like a full config with Bootstrap.

The best would be to use cookiecutter programmatically inside the "init" command so user does not have to install cookiecutter himself.

Log output more readable

The output in the terminal console is not really readable in watch mode.

  • each rebuild should be espaced ?
  • Usage of more indentation ?
  • Find a solution to not have the rst documents source displayed in the context dict, this is so annoying..

Better doc

Reorganize this in README and a doc/ with sphinx

Fix rstview to 0.2.1

Actually Optimus install will install rstview==0.3.x.

Since this version is a major refactoring, its usage with Optimus won't work. 0.2.1 is the last safe version from the old rstview.

Watch command option to watch for another sources

Actually the watcher only watch for changes in the sources assets and templates, this is good for simple templating issues.

But for ReSTructured pages, it does not watch for their RST sources changes. It will be nice to have an option for this.

i18n command

Add some command options to help to manage translations with pybabel instead of using various command like :

pybabel extract -F babel.cfg -o locale/messages.pot .
pybabel init -l fr -d locale -i locale/messages.pot
pybabel update -l en_US -d locale -i locale/messages.pot
pybabel compile -f -d locale

Try to see if PO files can be watched for an auto rebuild.

Modernize watcher

As #6 and #20 already stated, watcher is not efficient as it could be.

The watcher should be able to:

  • Watch for changes on statics without webassets since now we have frontend stack with node-sass and webpack which can handle the compilation and optimization, but without webasset bundle usage the inspector won't be able to see changes anymore;
  • Watch for a single file or full directory changes from the "source to synchronize";
  • Watch for change on views or any other code except the settings;

Add context and settings to template context

This would enable to perform context introspection and usage of settings from template without to customize get_context from a page view.

Since this is special variables they will have to prefixed with low dashe like _context and _settings.

Careful on context, it should be a shallow copy of context, since passing context in context would cause issue (too many recursive call, etc..).

This addon should be processed inside pages.view.base.PageViewBase.render() after call of get_context and just before passing context to jinja template render.

Assets watching

Actually, the "watch" command does not really watch for assets, and so a change on the css sources are not directly visible, you have to rebuild because the "webassets" tag in templates use a path to his internal cache (like "static/.external-webassets/") and not a direct path to the "real" css.

So the assets need to be watched and rebuilded, actually working with Optimus is a little painful if you have to work in "live" on your SCSS/CSS files.

Page sitemap

There is no actually any method to have the full page sitemap to create sitemap tree or even a menu from a template.

Currently the only way is to maintain a (almost) hardcoded page sitemap from settings or other variable and give it through page get_context method, but this wont really able to have all page informations.

Page builder should perform a scan of every registered pages with their page object datas and store it into a dynamic registry that would be reachable from view (starting from render() routine) that could be also passed to template context.

Page view and mechanics to drive pages from JSON/YAML

We could have a file like pages.json which would define some page configurations (the one available on base view like title, template, destination, etc..) and it could be enabled by default.

It could be an helper which would fill the PAGES settings with available item from JSON file.

This could simplify a lot a way to have an automatic sitemap as required from #27, still it won't implement it for other usage without the pages.json or with additional custom views.

  • We will have to add a new setting to define the JSON filename to read
  • Maybe another one to enable the JSON file usage to build pages ?
  • How to manage root index ?
  • Should we accept a page option to define a python to a View class to manage each page item ?

Increase code style quality

The project is very old and although i maintened some style quality, there was still too much done with old quality ideas.

All in all, the bigger issues is the usage of single quotes, and sometime double quotes. Also, tests was not checked with Flake8.

So first, we should run Black on application and tests, at least it will fix everything to double quotes (when possible), then enable Flake8 on tests and fix returned issues.

Tasks:

  • Rename test structure;
  • Use Black on "optimus" module and "tests", ignore the starters;
  • Use Flake8 on "optimus" module and "tests" to fix every issues;
  • Documentation is possibly broken because of many changes and also not up to date with these changes;

Server mode

Add a server mode with a simple http server to avoid for the user to install a http server.

This should be in a command like "runserver".

This should be cool if it can be combined with the watch mode.

Bad error for pages exception

If a "pages.py" raise an exception like an invalid syntax, this will raise a log error "Unable to load settings file", this should be something like "Unable to load pages map file".

Watch command dont works on OSX

im on ios and when i lanuch optimus watch it looks to works well, but in fact nothing appends and my modificiation aren't captured buy the watcher.
Holy hell do you think about mac User or are you a linux fanatic :p

my console :
Starting page builds
Scanning page: index.html
Scanning page: index_fr_FR.html
Launching the watcher, use CTRL+C to stop it

But it dont help you , it would be too easy , and not fun.
Have a good time with this , dude :)

Raise click.Abort when CRITICAL level log is used ?

logs.init_logger should raise a click.Abort when a log with "critical" level is throw, so no need to add click.Abort in code and API could simply throw a critical log to stop process instead of frontend code catching exception to do it itself.

PageViewBase.template_name should be optional

For some specific cases where the page is builded without any template, like a JSON view which is built from code, we don't need a template.

But mechanic from watcher always try to open template to inspect (for parent template relations), then if a view fill a dummy filepath, it will lead to an exception from Jinja failing to open template file.

To do it properly, PageViewBase should be ignored from inspection then a new view for real template.

We can't do it for back compatibility issues, so PageViewBase should stay as it is and we will create a new view like RawViewBase which will be ignored from inspection scanning for parent relation.

Maybe add also a new view like TemplateViewBase for explicit inspection scanning and register PageViewBase for deprecation ?

Better static files synchronization (FILES_TO_SYNC setting)

Despite its name setting FILES_TO_SYNC only accept directories to sync since code use copytree. And there is no watcher to trigger a rebuild when some files synced again.

  • Rename setting to a more accurate name;
  • Ensure this can manage files and directories;
  • Add an optional new handler to watch on files and directories when they are synced to trigger a rebuild for pages;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.