tarbell-project / tarbell Goto Github PK
View Code? Open in Web Editor NEWA Flask-based static site authoring tool.
Home Page: https://tarbell.readthedocs.io/en/latest/index.html
License: BSD 3-Clause "New" or "Revised" License
A Flask-based static site authoring tool.
Home Page: https://tarbell.readthedocs.io/en/latest/index.html
License: BSD 3-Clause "New" or "Revised" License
@ryanmark I'm seeing this trying pip install tarbell
Downloading/unpacking tarbell
Running setup.py egg_info for package tarbell
/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'
warnings.warn(msg)
/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'egg_info'
Complete output from command python setup.py egg_info:
/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'
warnings.warn(msg)
/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'egg_info'
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /usr/local/var/pip/pip.log
Run project through validators before publishing. Send out an automated email to folks specified in config.py?
Use s3cmd to remove a remote bucket
In some cases it would seem the set up script is installing, say, requests 2.0.1 but then tarbell throws an error because it requires 2.0.0. I'm still a little foggy on why this is happening. Can you use inequality style requirements with setuptools?
Add/remove as necessary for display and upload purposes... there are some places where slashes are doubled up. This is not a show stopper, the current S3 upload seems to handle it OK.
The tarbell_install
function in cli.py
needs to use the new project model introduced in beta-2...
$ tarbell configure
Configuring Tarbell. Press ctrl-c to bail out!
/Users/davideads/.tarbell already exists
Would you like to reconfigure Tarbell? All existing files will be backed up. [y/N] y
Would you like to use Google spreadsheets [Y/n]? y
Login in to Google and go to https://code.google.com/apis/console/ to create an app and generate the
client_secrets.json authentication file. You should create credentials for an `installed app`. See
http://tarbell.readthedocs.com/#correctlink for more information.
Where is your client secrets file? [~/Downloads/client_secrets.json] ~/.tarbell/client_secrets.json
Copying /Users/davideads/.tarbell/client_secrets.json to /Users/davideads/.tarbell
-- Backing up /Users/davideads/.tarbell/client_secrets.json to /Users/davideads/.tarbell/client_secrets.json.2013-11-09T21:14:42.928907.backup
Traceback (most recent call last):
File "/usr/local/bin/tarbell", line 9, in <module>
load_entry_point('tarbell==0.9b2', 'console_scripts', 'tarbell')()
File "/usr/local/lib/python2.7/site-packages/tarbell/cli.py", line 59, in main
command.__call__(args)
File "/usr/local/lib/python2.7/site-packages/tarbell/cli.py", line 638, in __call__
return self.fn(*args, **kw_args)
File "/usr/local/lib/python2.7/site-packages/tarbell/configure.py", line 37, in tarbell_configure
settings.update(_setup_google_spreadsheets(path))
File "/usr/local/lib/python2.7/site-packages/tarbell/configure.py", line 106, in _setup_google_spreadsheets
shutil.copy(secrets_path, path)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 119, in copy
copyfile(src, dst)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 69, in copyfile
raise Error("`%s` and `%s` are the same file" % (src, dst))
shutil.Error: `/Users/davideads/.tarbell/client_secrets.json` and `/Users/davideads/.tarbell/client_secrets.json` are the same file
Allow custom routes to be registered and properly published.
It might make sense if we want to offer hooks to do things like gzip assets. And s3cmd is fussy / user unfriendly to configure.
Works fine is Downloads
location is specified, which is silly.
Create branches for 0.9-preview, 0.9-beta1.
TypeError: static_url() takes exactly 1 argument (2 given)
Serve example:
$ tarbell serve
Visit http://127.0.0.1:5000 in your browser to view base
* Running on http://127.0.0.1:5000/
* Restarting with reloader
Visit http://127.0.0.1:5000 in your browser to view base
Switch example:
$ tarbell switch readme
Switching to readme.
Visit http://127.0.0.1:5000 in your browser to view readme
* Running on http://127.0.0.1:5000/
* Restarting with reloader
Switching to readme.
Visit http://127.0.0.1:5000 in your browser to view readme
Everything seems to work fine...
Proposed
tarbell list
Aliases: tarbell projects
List projects.
$ tarbell list
Use `tarbell switch <projectname>` to work on a project.
under-the-gun Under the Gun /news/local/crime/under-the-gun Last update 12-01-2012 @ 10:00am by Heather Billings
democracy-denied Democracy Denied /news/local/politics/democracy-denied Last update 01-17-2013 @ 01:32pm by Jen Lindner
hadiyas-friends Hadiya's Friends /news/local/crime/hadiyas-friends Last update 01-16-2013 @ 09:05am by Alex Bordens
school-utilization School Utilization /news/local/education/school-utilization Last update 01-19-2013 @ 11:15am by Abe Epton
All commands need documentation in the docs.
https://github.com/newsapps/flask-tarbell/blob/master/tarbell/docs/reference.rst
Use python context managers instead of decorators to ensure the execution environment is in the tarbell root.
Instead of:
@ensure_site
def tarbell_newproject(args, path):
print path
Use:
def tarbell_newproject(args):
with ensure_site() as path:
print path
See http://docs.python.org/release/2.5.2/lib/typecontextmanager.html
We should also only use this where necessary. I introduced it in part while trying a different server strategy.
Some day, this context manager can set up the virtualenv as well which will help achieve our 1.0 goals.
e.g. the that is passed to the preview flask view function.
It's possible for CSS or JS files to contain character sequences that break Jinja's parser. This causes a Jinja template error when trying to serve the files. Trap the error and print an error message in the preview server.
The current base template should become more of a dependency system. Base assets and templates should be mounted under current project directory and can be directly overridden with templates/assets of the same name in the project's 'static' dir.
Instead of our own library, let's just use s3cmd. We may have to store our own credentials though.
We should either downgrade requests or add a Python version requirement.
Proposed
tarbell newproject <projectname (optional)>
Aliases: tarbell create <projectname>
Create a new Tarbell project that uses optional directory name <projectname>
.
$ tarbell create
@TODO stuff related to create
Even when user opts to create a spreadsheet (and one is successfully created), no spreadsheet key is imported, and Google Doc settings are commented out.
If they have [email protected], they need to put in the full one, as sometimes people use gmail but have non @gmail.com accounts.
If you leave the Tarbell preview server idle, you get an error like:
https://gist.github.com/rnagle/7235405
I believe this is coming from the code that's supposed to handle reconnecting to Google drive when the cache is stale and the connection is lost, which is reloading too much and causing register_blueprint to be called after the first request.
Proposed
tarbell serve --project/-p <projectname (optional)>
Manually run a Tarbell preview server. Defaults to parent directory or local config.
No project
(litfest) $ tarbell serve
Running Tarbell preview server for "Lit Fest 2013". To preview this site, visit
http://localhost:5000/
To stop the server, run
tarbell stop
Improve the project by editing the files in </path/to/project>.
Project specified
$ tarbell serve --project elections-general-2013
Running Tarbell preview server for "2013 General Elections". To preview this site, visit
http://localhost:5000/
To stop the server, run
tarbell stop
Improve the project by editing the files in </path/to/project>.
Error
$ tarbell serve
No active project. Work on a new project with `tarbell switch <projectname>`
or specify a project with the `--project` flag.
tarbell stop
Stop the currently running server.
(hadiyas-friends) $ tarbell stop
Stopping preview server for "Hadiya's Friends"...
Done!
Error
$ tarbell stop
No server running. Oh well!
I am hoping @ryanmark has some good patterns for creating the Tarbell command line app in a sane way.
Dropping s3cmd means not calling the s3cmd --configure
command from configure.py
and instead asking about and writing some values to our configuration file ourselves. Bonus points if it can configure buckets by name, but that could be a beta-4 task, too.
Proposed
tarbell newsite <site git repository (optional)> <target directory (optional)>
Create a new site based on a git repository (by default, Chicago Tribune News Apps open source template will be used). By default, the command will prompt for a directory. If a target directory is specified, it will be used.
$ tarbell newsite https://github.com/newsapps/tarbell-template
What domain do you plan to publish to? (e.g. http://apps.chicagotribune.com)
[Required]: projects.mydomain.tld
Where would you like to install `tarbell-template`?
[Default: /home/eads/Repos/projects.mydomain.tld]
Installing `tarbell-template` in /home/eads/Repos/projects.mydomain.tld
...
Done!
Would you like to set up Amazon S3 publication now? [y/N] Y
Awesome!
What's your production bucket (e.g. projects.mydomain.tld)?
What's your staging bucket (e.g. beta.projects.mydomain.tld)?
What's your Amazon S3 access key ID?
What's your Amazon S3 access key?
Get from Chicago Tribune repo
There's a hardcoded "default" for the creds in the tarbell_publish
function in cli.py
. This needs to read the correct bucket configuration and fall back to default if it doesn't exist.
git submodules can be kind of weird, but the current inheritance model is a little jacked... your history gets polluted with that of the upstream repo, which doesn't make a ton of sense.
Keep root directly clean to better handle updates.
Creating of a ~/.tarbell/hooks.py
file that can accomodate pre/post command hooks to run (e.g. to allow custom linting on site generation or custom repo setup on new project creation).
Proposed
tarbell switch <projectname (required)>
Aliases: tarbell workon <projectname (required)>
Use the switch
command to work on an existing project. By default, this command activates the default virtual environment and runs a local preview server.
Flags:
--no-env
: Don't activate Python virtualenv.
--no-server
: Don't run preview server.
$ tarbell switch hadiyas-friends
You are now working on "Hadiya's Friends". To preview this site, visit
http://localhost:5000/
To stop the development server, run
tarbell stop
Publish to staging:
tarbell publish
Publish to production:
tarbell publish -t production
(hadiyas-friends) $
Conflicting projects
$ tarbell switch gamechangers
Project `gamechangers` exists in:
[1] /home/eads/Repos/apps.chicagotribune.com
[2] /home/user/Code/mysite.com
Which project would you like to switch to? [1]
No project
$ tarbell switch truancy
Project 'truancy' does not exist. To create a new project with this name, run:
tarbell newproject truancy
tarbell deactivate
Deactivate a project.
(rabies) $ tarbell deactivate
No longer working on Rabies.
$
Proposed
tarbell publish --project/-p <projectname (optional)> --target/-t <target (optional)>
Publish a project to Amazon S3.
Basic
(democracy-denied) $ tarbell publish
This will publish "Democracy Denied" to Staging at:
http://apps.beta.tribapps.com/news/local/democracy-denied
Do you want to continue (y/N):
Rendering HTML...
Uploading to Amazon S3...
Done!
Specify target
(democracy-denied) $ tarbell publish --target production
This will publish "Democracy Denied" to Production at:
http://apps.tribapps.com/news/local/democracy-denied
Do you want to continue (y/N):
Rendering HTML...
Uploading to Amazon S3...
Done!
Specify project and target
$ tarbell publish --project restaurant_app --target restaurant_production
This will publish "Chicago Tribune Restaurant Reviews" to Restaurant Production at:
http://restaurants.chicagotribune.com/entertainment/dining/reviews
Do you want to continue (y/N):
Rendering HTML...
Uploading to Amazon S3...
Done!
tarbell unpublish --project/-p <projectname (optional)> --target/-t <target (required)>
Delete a project from the specified target.
Specify target
(gamechangers) $ tarbell unpublish --target production
This will remove "Game Changers" from Production at:
http://apps.chicagotribune.com/sports/hawks/gamechangers
Do you want to continue (y/N):
Deleting files...
Done!
Specify project and target
$ tarbell unpublish --project under-the-gun --target staging
This will remove "Under The Gun" from Staging at:
http://apps.beta.tribapps.com/news/local/under-the-gun
Do you want to continue (y/N):
Deleting files...
Done!
For OS X, Xcode will be required. Our script should
install brew
brew install python stack (new python, pip, virtualenv, virtualenv-wrapper)
pip install tarbell
clone new tarbell template somewhere
For ubuntu, our script should:
apt-get install python stack
pip install tarbell
clone new tarbell template somewhere
Proposed
tarbell update
Update the current project with any base updates.
(hadiyas-friends) $ tarbell update
This command will update your current project's dependencies to their latest versions.
Here are the outstanding changes:
v1.01: Fix bug in navigation, upgrade to Flask-Tarbell v1.1.
v1.02: Update Google analytics component to use spreadsheet variables.
Would you like to continue (y/N):
Merging base changes...
Installing new requirements....
It worked! Your project is up to date.
Error
$ tarbell update
No project specified. To work on a project, run:
tarbell switch <projectname>
To list available projects, run:
tarbell list
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.