Code Monkey home page Code Monkey logo

pynt's People

Contributors

beregond avatar blutack avatar calumjeadie avatar jabbalaci avatar rags avatar theinemann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pynt's Issues

Documentation

I can't tell if I'm missing where the documentation is, or if the page (http://rags.github.io/pynt/) is supposed to be the documentation. If the latter, there's a line:

"Tasks can be ignored with the task(ignore=True)"

I can't figure out what this means.

I like the design, BTW. Very clean.

Enhancement: Markdown output from docstrings

Is there any interest in the community for a Markdown output from the @task() docstrings? If so, I can submit a PR.

In my project, I adopted the standard of:

@task()
def start_server(server='localhost', port = '80'):
    """Start the server

    This task starts the HTTP server on localhost:80 (by default)

    - Args:
        - `server` (`str`, optional): The server IP address. Defaults to 'localhost'.
        - `port` (`str`, optional): The port number. Defaults to '80'.
    """

    print('Starting server at %s:%s' % (server, port))

@task(start_server) #Depends on task with all optional params
def stop_server():
    """Stop the server

    This task stops the running server
    """
    print('Stopping server....')

This would create the following output:

$ pynt -l -m

Raw

---
## start_server

`Start the server`

This task starts the HTTP server on localhost:80 (by default)

- Args:
    - `server` (`str`, optional): The server IP address. Defaults to 'localhost'.
    - `port` (`str`, optional): The port number. Defaults to '80'.

---
## stop_server

`Stop the server`

This task stops the running server

Formatted:


start_server

Start the server

This task starts the HTTP server on localhost:80 (by default)

  • Args:
    • server (str, optional): The server IP address. Defaults to 'localhost'.
    • port (str, optional): The port number. Defaults to '80'.

stop_server

Stop the server

This task stops the running server

Tests fail because names of pytest executable are hardcoded

It happens because of this:

pynt/build.py

Line 18 in c0fbbc4

subprocess.call(["py.test-2.7"] + list(args))

In my system, I have both Python 2 and 3 (maybe it's worth dropping Python 2 support already?). Executables are named py.test and py.test3.

To maintain backwards compatibility, it's probably worth wrapping those subprocess calls and if they fail - try generic names.

Use of "its" vs. "it's"

Several places in the help you say "it's" which means "it is" when you actually want to use a possessive "its"

The easiest way to test this is when you see an "it's", say it out loud "it is," and see if that makes sense. If it doesn't, remove the apostrophe.

Feature request: better logging for nested tasks

Use case: I have a main task that performs actions on items of an iterable, so instead of specifying the one-item task as dependency, I call it directly. Here's my code:

#!/usr/bin/env python3

from pynt import task

ITEMS = ["foo", "bar"]


@task()
def item_task(item):
    print(item)


@task()
def main_task():
    for item in ITEMS:
        item_task(item)


__DEFAULT__ = main_task

This is the output I'm getting:

[ build.py - Starting task "main_task" ]
foo
bar
[ build.py - Completed task "main_task" ]

Since item_task() is a task too, I'd prefer the following output:

[ build.py - Starting task "main_task" ]
[ build.py - Starting task "item_task" with argument "foo"]
foo
[ build.py - Completed task "item_task" ]
[ build.py - Starting task "item_task" with argument "bar"]
bar
[ build.py - Completed task "item_task" ]
[ build.py - Completed task "main_task" ]

Maybe even with nested tasks indented:

[ build.py - Starting task "main_task" ]
    [ build.py - Starting task "item_task" with argument "foo"]
    foo
    [ build.py - Completed task "item_task" ]
    [ build.py - Starting task "item_task" with argument "bar"]
    bar
    [ build.py - Completed task "item_task" ]
[ build.py - Completed task "main_task" ]

Needs version information

Would like to be able to say:
pynt -v
To find out what version I'm running (to make sure I'm up-to-date).

build-focused pynt installing conflict with postman's api security testing module pynt

I previously had no problem installing via pip pynt. Recently I changed my setup and had to reinstall the modules I frequently used, and came up with this new "pynt". Since its postman's api that is being installed I have no way to access the commands of these module. Is there any way to work around this and ignore postman's module? For more information just search pynt postman in google. Thanks in advance, cheers!

Spelling errors for "pynt -h"

pynt -h produces:
C:\Users\Bruce>pynt -h
usage: pynt-script.py [-h] [-l] [-f file] [task [task ...]]

positional arguments:
task perform specified task and all it's dependancies
...

On the last line shown above, the "it's" should be "its" and "dependancies" should be "dependencies"

imp.load_source makes it hard to import build utilities

I have some functions I wanted to get out of the build.py file because they were getting bigger than the build script. I tried importing, e.g. import foo, but this line in pynt prevents it:

module = imp.load_source(path.splitext(path.basename(args.file))[0], args.file)

This is some weird loading that allows loading from pip installed, but not from code in the same directory as build.py.

The above line is also deprecated in python 3.

Here is a nasty hack to get around it.

sys.path.append(os.path.join(os.path.dirname(__file__), '.'))
from build_utils import check_is_aws, skip_if_no_change, execute_with_environment

I don't know the motivation was for using imp.load_source, but it makes pynt more difficult to use. When I get a chance I'll review navio's version & see if it has been solved there.

Using pynt on build server

Hi,
I really like pynt and would like to use it as a build tool for some of my python projects.
My builds are already using docker to allow me to create a container, install my dependencies and then run the tests. To use pynt as a build system I need to install it outside the container on the build server. Do you have any ideas on the easiest way to do that (assuming I can't just pip install things on the build server)?

[question] How to get the parameters of a task? Is it possible?

I would like to use pynt for a Java project. The caller task looks like this:

@task()
def run():
    cmd = "java -cp build/classes/java/main adder.Adder"
    print(cmd)
    os.system(cmd)

Let's suppose that we can pass command-line arguments to the Java program:

bash$ java -cp build/classes/java/main adder.Adder 5 6
11

and it adds them together. Would it be possible to pass these arguments to a task and then forward them to the Java program? I want a call like this:

bash$ pynt run 5 6
11

At the moment pynt thinks that "5" is another task and drops an error that it doesn't exist.

Ability to hide a task from doc output

I have a complex chain of tasks that I don't want to be all exposed/available
when using pynt.

I can use internal python functions instead, but I really like the simplicity of chaining tasks and having consistent logs etc...

Adding @task(hide=True) might be a nice addition

So it looks something like that:
@task(hide=True)
def build():
'''Build for distribution'''

@task(hide=True)
def upload():
'''Upload build'''

@task(hide=True)
def install():
'''Install new build distribution'''

@task()
def restart_server:
''Restart the server'''

@task(build, upload, install, restart_server)
def deploy_prod():
'''Build & deploy app to production server. Then restart server.'''
print("Deployment Complete!")

At the moment, they are all exposed as tasks, and can appear in pynt output:
Tasks in build file build.py:
build Build for distribution
clean Clean build directory.
deploy_prod Build & deploy app to production server. Then restarts server.
install Install new build distribution''
restart_server Restart pserve on remote
upload Upload the latest build to server

Py2 is mixed with Py3

In the README example, Python 2 is mixed with Python 3:

@task()
def clean():
    '''Clean build directory.'''
    print 'Cleaning build directory...'

@task()
def _copy_resources():
    '''Copy resource files. This is a private task. "pynt -l" will not list this'''
    print('Copying resource files')

I mean the prints. Unify them for Python 3.

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.