Skip to content

Commit

Permalink
Use tensorflow-rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Jan 5, 2017
1 parent 8ca7dca commit a258b32
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 50 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third/tensorflow-rakefile"]
path = third/tensorflow-rakefile
url = https://github.com/raviqqe/tensorflow-rakefile
58 changes: 8 additions & 50 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,22 @@
README_FILE = 'README.md'
VENV_DIR = '.venv'
IN_VENV = ". #{VENV_DIR}/bin/activate &&"


def vsh *args, **kwargs
sh([IN_VENV, *args.map{ |x| x.to_s }].join(' '), **kwargs)
end
require_relative './third/tensorflow-rakefile/tfrake.rb'
include TFRake


def task_in_venv name, &block
task name => %i(clean venv) do |t|
block.call t
end
end


task :venv do
sh "python3 -m venv #{VENV_DIR}" unless File.directory? VENV_DIR

vsh "pip3 install --upgrade #{%w(
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0-cp35-cp35m-linux_x86_64.whl
pytest
pdoc
autopep8
).join ' '}"

vsh 'python3 setup.py install'
end
README_FILE = 'README.md'


task :clean do
sh 'git clean -dfx'
end
define_tasks('qnd', define_pytest: false)


task_in_venv :module_test do
task_in_venv :pytest do
Dir.glob('qnd/**/*_test.py').each do |file|
vsh :pytest, file
end
end


task_in_venv :script_test do
vsh('python3 test/empty.py')
vsh 'python3 test/empty.py'

Dir.glob('test/*.py').each do |file|
vsh :python3, file, '-h'
Expand Down Expand Up @@ -85,7 +59,7 @@ end


task :test => %i(
module_test
pytest
script_test
mnist_simple
mnist_distributed
Expand Down Expand Up @@ -134,20 +108,4 @@ them.
end


task_in_venv :html do
vsh 'pdoc --html --html-dir docs --overwrite qnd'
end


task :doc => %i(html readme_examples)


task_in_venv :format do
sh "autopep8 -i #{Dir.glob('**/*.py').join ' '}"
end


task :upload => %i(test clean) do
sh 'python3 setup.py sdist bdist_wheel'
sh 'twine upload dist/*'
end
task :doc => %i(pdoc readme_examples)
1 change: 1 addition & 0 deletions third/tensorflow-rakefile
Submodule tensorflow-rakefile added at 0cb4e1

0 comments on commit a258b32

Please sign in to comment.