Comments (14)
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.
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.
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.
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.
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.
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.
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
pyfrc/pyfrc/mains/cli_deploy.py
Line 388 in c94b21b
from pyfrc.
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
pyfrc/pyfrc/mains/cli_deploy.py
Line 388 in c94b21b
Oh, this is perfect. I 100% agree, i can modify #196 to reflect this.
from pyfrc.
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.
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.
Super cool @auscompgeek! does this require transfering the .git
to the robot though?
from pyfrc.
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.
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.
Fixed in #196
from pyfrc.
Related Issues (20)
- Vision Simulator Referencing Old PhysicsInterface
- Remove exec from frcRunRobot.sh HOT 2
- pyfrc.physics.core uses deprecated imp module HOT 1
- [BUG]: tests do not clear solenoid usage
- [BUG]: slow deploy HOT 2
- [BUG]: VisionSim computes the angle in radians HOT 1
- Add mypy or pyright checker on deploy HOT 1
- PhysicsEngine should be a Protocol for type checking HOT 3
- pyfrc tests don't work with pytest-xdist HOT 1
- Change pkg-resources stuff to not require strict versioning HOT 1
- Read team number/robot hostname from pyproject.toml HOT 1
- Basic tests don't run on blue or red alliance HOT 1
- Deploy fails because os.getlogin fails HOT 3
- [BUG]: Tests and Debugger don't get along well. HOT 1
- [BUG]: impossible to use profiler subcommand on sim
- [BUG] Cleanup doesn't occur correctly if tests fail HOT 1
- Run tests in subprocess instead of reloading robot code
- [BUG]: wpilib.SendableChooser subscriptions not cleaned between tests
- [BUG]: 2 second timeout on robot init is occasionally hit in tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyfrc.