Skip to content

Python support - #7

Open
HKay wants to merge 13 commits into
schlangenprogrammiernacht:masterfrom
HKay:python_support
Open

HKay wants to merge 13 commits into
schlangenprogrammiernacht:masterfrom
HKay:python_support

Conversation

@HKay

@HKay HKay commented May 27, 2022

Copy link
Copy Markdown

Add "build container" for python bots. Complete with abstraction api

  • missing: documentation

@cfr34k

cfr34k commented May 28, 2022

Copy link
Copy Markdown
Contributor

Hi, thanks for your effort! I'm sure this will be interesting for many people :)

I have taken a look now and tried writing a basic bot with your framework. The basic setup looks good to me and it seems to work quite well, but I still have a few comments/questions/suggestions:

  • I notice that you copy the whole framework to /spndata. Is there any specific reason to do so? /spndata should only contain bot-specific files; everything else (especially the bot framework) is already available in the container. So basically you can just make the compile step a no-op (or maybe some kind of syntax check on /spndata/usercode.py?). Then, during the run step, you can copy /spndata/usercode.py into your bot framework and run main.py there.
  • There is currently no helpful feedback to the user when an exception is thrown. That makes it very hard to debug errors because the bot simply stops due to a “fatal communication error”. I suggest to catch any exceptions that occur during init() or step() and log them using the api.log() function.
  • There are a few imports in api.py that are not used (at least time and math). Please remove those that are not necessary.
  • The objects returned from api.getFood() and api.getSegments() are not subscriptable, so random access (like api.getFood()[42]) is not possible without reading all elements and converting them to a list, which is not very efficient. Could you make all the iterable objects subscriptable, please?

Related Pull Request for the website: schlangenprogrammiernacht/website#22

@citronalco

citronalco commented Jan 23, 2024 •

Copy link
Copy Markdown

@HKay @cfr34k Seems to work!

When starting a bot, this build output gets logged:

pylint: Command line or configuration file:1: UserWarning: 'BaseException' is not a proper value for the 'overgeneral-exceptions' option. Use fully qualified name (maybe 'builtins.BaseException' ?) instead. This will cease to be checked at runtime when the configuration upgrader is released.
pylint: Command line or configuration file:1: UserWarning: 'Exception' is not a proper value for the 'overgeneral-exceptions' option. Use fully qualified name (maybe 'builtins.Exception' ?) instead. This will cease to be checked at runtime when the configuration upgrader is released

I'm unsure if pylint is very useful here at all.

@citronalco

citronalco commented Feb 3, 2024 •

Copy link
Copy Markdown

those superflous pylint warnings should either get fixed or silenced.
besides that it's working pretty good!
@HKay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants