Giter VIP home page Giter VIP logo

Comments (11)

giswqs avatar giswqs commented on July 17, 2024 1

I just added you as the owner of the package on PyPI. Check your email.

from open-buildings.

giswqs avatar giswqs commented on July 17, 2024

I am working on it now.

from open-buildings.

giswqs avatar giswqs commented on July 17, 2024

We can use click for the CLI. The commands need to be added cli.py, which can call functions in open_buildings.py
https://click.palletsprojects.com/en/8.1.x/
https://github.com/opengeos/open-buildings/blob/main/open_buildings/cli.py

from open-buildings.

cholmes avatar cholmes commented on July 17, 2024

So I built up the click interface in the open_buildings.py, see

@cli.command('convert')
and
@cli.command('benchmark')

So do we just need to move the click definitions ones to the cli.py?

from open-buildings.

cholmes avatar cholmes commented on July 17, 2024

The 'usage' stuff in https://github.com/opengeos/open-buildings#functionality was generated by the CLI I had - and I managed to get it so I could use the CLI, but failed to get it so it would install right. Your new package definitely installs it right - just not sure how to hook it up.

from open-buildings.

giswqs avatar giswqs commented on July 17, 2024

Correct. Just move the cli interface from the main module to cli.py. It should work. The entry point is in setup.py.

https://github.com/opengeos/open-buildings/blob/main/setup.py#L44

    entry_points={
        'console_scripts': [
            'open_buildings=open_buildings.cli:main',
        ],
    },

I think the problem with your previous repo was that the command in the entry_points has hyphens rather than undersores. Commands should have not hyphens.

https://github.com/cholmes/google-buildings-tools/blob/main/setup.py#L10

    entry_points={
        'console_scripts': [
            'google-buildings-cli=google_buildings_cli:main',
        ],
    },

from open-buildings.

cholmes avatar cholmes commented on July 17, 2024

Ok, I think I got it working, and bumped to a 0.0.4 release.

How do I push to pypi? I just signed up - https://pypi.org/user/cholmes/

from open-buildings.

giswqs avatar giswqs commented on July 17, 2024

It is automatically pushed to pypi once a release is created.

https://pypi.org/project/open-buildings/

from open-buildings.

cholmes avatar cholmes commented on July 17, 2024

It is automatically pushed to pypi once a release is created.

https://pypi.org/project/open-buildings/

Oh cool! I tried once but failed to update the versions, then forgot to check on the one after I did it right. Thanks!

from open-buildings.

cholmes avatar cholmes commented on July 17, 2024

Ah darn, I thought I had the CLI working, as it was returning responses, but I think I didn't actually hook it up right:

Traceback (most recent call last):
  File "/Users/cholmes/repos/venv/gob/bin/open_buildings", line 33, in <module>
    sys.exit(load_entry_point('open-buildings==0.0.4', 'console_scripts', 'open_buildings')())
  File "/Users/cholmes/repos/venv/gob/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/cholmes/repos/venv/gob/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/cholmes/repos/venv/gob/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/cholmes/repos/venv/gob/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/cholmes/repos/venv/gob/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/cholmes/repos/venv/gob/lib/python3.9/site-packages/open_buildings/cli.py", line 54, in benchmark
    results = process_benchmark(
NameError: name 'process_benchmark' is not defined

How do I get two python files to work with one another? Like how do I properly call the definitions in https://github.com/opengeos/open-buildings/blob/main/open_buildings/open_buildings.py from the cli (https://github.com/opengeos/open-buildings/blob/main/open_buildings/cli.py) - I moved the definitions, but was hoping since they were in the same directory it'd work.

from open-buildings.

cholmes avatar cholmes commented on July 17, 2024

Ok, think I figured this out, just need the import statements. Going to close this in the hope that the CLI is truly working in 0.5. Would be great if someone could confirm that to be true...

from open-buildings.

Related Issues (20)

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.