PavelKunyavskiy's blog

By PavelKunyavskiy, history, 9 years ago, In English

Everyone on this site heard about problem preparing tool, maintained by MikeMirzayanov called polygon.

It have a lot of advantages, like automatic checks of everything you can imagine. But also, it have several very annoying things. The main one for me is necessity of synchronizing solutions and generators files by hand, between polygon and your local copy. So I had written a tool, which can do it.

Tool is published on github, with instructions how to install it. You are welcome with any new features/suggestions (I'm not knowing python very well, to be honest).

Known problems:

  • Not tested good enough, probably buggy
  • Installation script working strange. Anyone knowing python better? Any better ways to distribute?
  • Sometimes lost of session is not detected and script fails with strange non-readable errors. relogin helps
  • Parsing html pages can be not stable enough with changing polygon. Waiting for better api from MikeMirzayanov and codeforces team.
  • Vote: I like it
  • +192
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Thank you!

For me, it will be comfortable to put all the files in a single folder (without solutions/ and src/) + also process resources in the same way as files/solutions.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    And update on init will be nice.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It seems running polygon-cli in solutions/ directory causes an error No session known. Use relogin or init first.

    Is any way to run something like polygon-cli status and polygon-cli diff [file]?

  • »
    »
    9 years ago, # ^ |
    Rev. 2   Vote: I like it +15 Vote: I do not like it

    Answering to all three at time.

    1. One directory. This is quite easy to change. Probably it's better to be configurable. (done: --flat option)
    2. update on init. Quite logical, easy to do.
    3. No session. There is no .polygon-cli folder in solutions. Looking in parent folder colud be good idea (done)
    4. poligon-cli list is something like status
    5. diff is not implemented, but why not. (done)
»
9 years ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

About the installation: try adding your package to PyPI. That way the package may be installed (together with all dependencies) in a single command like pip install polygon-cli.

Btw, what kind of failures do you see with setup.py? If it's on Windows, it may be UAC which may require elevation in order to create scripts in Python34\Scripts

  • »
    »
    9 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    I second this, that way requirements.txt will be created as well, which lists the packages your package depends on, so that you do not have to install them manually.

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What's with the "Installation script working strange" ? I think I can help.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    For me, it works fine. But i had tested on several friends, before publishing here. Some of them had requirements not installed automatically. Some had errors on imports of local files while running. Second issue was probably fixed by changing import xxx to from . import xxx, but i'm not sure it's good way.

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      I have had that second issue before and I think that the only way to use custom libraries over a console script installation is using the '.' syntax. We can accept SystemError in case of absolute import failure to revert back to real import.

      try:
      	from . import xxx
      except SystemError:
      	import xxx
      

      I will install your script and see how it works on my system.

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

This tool is amazing. Thank you so much.

»
8 years ago, # |
  Vote: I like it +23 Vote: I do not like it

I'm trying to use this tool, since I'd prefer it over the polygon webinterface. But I noticed that the problem statement does not get downloaded, and it seems that this is because it is not exposed by the polygon API. Am I correct? It would be great if that were possible!

As a side note: since polygon internally seems to use a version control system, why can't that be exposed as well, next to the API? Either read-only, or even better: read/write with commit-hooks checking that updates adhere to the internal data format of polygon.

»
3 years ago, # |
  Vote: I like it -9 Vote: I do not like it

При импорте из архива не добавляются баллы за тесты и зависимости групп (в xml они есть). Это не предусмотрено или я что-то делаю не так? Баллы есть при генерации тестов из скрипта, но его как раз нет, есть готовые тесты в архиве.