Giter VIP home page Giter VIP logo

Comments (14)

virtuald avatar virtuald commented on July 16, 2024 1

It would definitely be a requirement to not fail if it wasn't a git repo.

@auscompgeek you've been holding out on us!

from pyfrc.

KenwoodFox avatar KenwoodFox commented on July 16, 2024

I like the idea of this, especially passing things like username and hostname! Its always important to know who to blame. Im glad you jumped on this, a deploy.json would be a very handy way to do this.

Where would the logic of this hook best sit?

Ive used gitpython in the past for interacting with git repos via python but is there a simpler way that may depend on less extra libraries if we just want to get the hash and maybe a --dirty flag?

from pyfrc.

KenwoodFox avatar KenwoodFox commented on July 16, 2024

I think i found where this belongs: https://github.com/robotpy/pyfrc/blob/2022/pyfrc/mains/cli_deploy.py

Should we make a custom hooks system or just implement this single hook?

from pyfrc.

virtuald avatar virtuald commented on July 16, 2024

I haven't really thought through the requirements at this point. I think initially

If we wanted the user to be able to customize the json, we could define the following method in the robot:

class MyRobot(wpilib.TimedRobot):
    @staticmethod
    def deploy_hook(data):
        data["something"] = something

If we did that... we could add a deploy_data method to the robot instance if the user wanted to access it? Maybe that's a bit much though. Should think about how this would actually be used.

from pyfrc.

KenwoodFox avatar KenwoodFox commented on July 16, 2024

I like the idea of doing something custom with a similar format to how physics.py works, where its inert and says physics is not enabled if the file does not exist, but runs physics sim when it is present.

perhaps a similar system with a hooks.py? excecuting a few methods like deploy_hook() and test_hook()? Code to be run on the host doing the developing, seperate from robotinit and stuff that is meant to be for the robot

from pyfrc.

KenwoodFox avatar KenwoodFox commented on July 16, 2024

Could we make a build_info.json purely in deploy, never saving it to disk but passing it over sftp? it would keep it from showing up on the dev's machine. Though if you're using git to manage your robot, you'ld prolly add the json to your gitignore and saving it locally may not be a hassle.

from pyfrc.

virtuald avatar virtuald commented on July 16, 2024

If we went the json route, I have a strong preference for it only existing on the robot. We already make a temporary directory to copy data over, see

# Copy the files over, copy to a temporary directory first

from pyfrc.

KenwoodFox avatar KenwoodFox commented on July 16, 2024

If we went the json route, I have a strong preference for it only existing on the robot. We already make a temporary directory to copy data over, see

# Copy the files over, copy to a temporary directory first

Oh, this is perfect. I 100% agree, i can modify #196 to reflect this.

from pyfrc.

KenwoodFox avatar KenwoodFox commented on July 16, 2024

Not everyone uses git so it may be nice if it just ommits a git-revision rather than not inluding the other vars at all, that way code managed by other source control engines or not managed at all can still utilize the other values like hostname and build date that may be more helpful

from pyfrc.

auscompgeek avatar auscompgeek commented on July 16, 2024

Heh, I have a hack to include the git branch and commit hash in a deploy in my team's robot code. This gets called at the module level in our robot.py. https://github.com/thedropbears/pyrapidreact/blob/main/utilities/git.py

from pyfrc.

KenwoodFox avatar KenwoodFox commented on July 16, 2024

Super cool @auscompgeek! does this require transfering the .git to the robot though?

from pyfrc.

auscompgeek avatar auscompgeek commented on July 16, 2024

does this require transfering the .git to the robot though?

Nope! There's a few assumptions made here:

  • On our laptops, the code is always run from the git repo, and git is available in the environment it runs in.
  • The deploy skips dotfiles, hence .git is not present on the robot.
  • The deploy does not care about gitignore.
  • Running robot.py is the only way the code is deployed.

from pyfrc.

KenwoodFox avatar KenwoodFox commented on July 16, 2024

Interesting, so if its possible to run stuff like this at the module level on the dev laptop to generate artifacts for the bot, them #195 is not needed :3
ill still work on #196

from pyfrc.

virtuald avatar virtuald commented on July 16, 2024

Fixed in #196

from pyfrc.

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.