-1

I work in PyCharm and I wish that I hadn't run the whole code every time because it takes a lot of time. Especially when I'm making a small change. Is there some kind of checkpoint? To run only the part that I did some change to it. Something like cells in Jupyter Notebook. Thank you in advance and sorry for my English.

  • without knowing why your code takes a long time, it's hard to say. There are breakpoints, which will pause code execution when they're hit. You can also add conditions to the breakpoints so they only activate for certain scenarios. If that's not what you mean, I would try using a smaller dataset while testing (if possible). – Byron Oct 12 '22 at 15:28
  • Not as far as I know. Try and find tricks to bypass long processing (pickling/unpiclking data ?). –  Oct 12 '22 at 15:28
  • Does this [question and answer combination](https://stackoverflow.com/q/23441657/8508004) not address your needs? In particular what is referenced in [his comment here](https://stackoverflow.com/questions/23441657/pycharm-run-only-part-of-my-python-file#comment96452960_23441657), about [PyCharm Scientific Mode with Code Cells](https://blog.jetbrains.com/pycharm/2018/04/pycharm-scientific-mode-with-code-cells/): "This means you can re-run only the part of the script you’re developing right now, without having to wait for reloading your data. ". – Wayne Oct 12 '22 at 15:32

1 Answers1

0

There is no built-in way to run a program starting from the middle.

If you can organize your program into independent pieces (functions), then you could run just the piece you want to test.

But sometimes you can't do that (maybe your program is like a house and you can't build just the roof, because the roof has to rest on the walls, which have to rest on the foundation).

John Gordon
  • 29,573
  • 7
  • 33
  • 58
  • You can give a yes/no answer to the existence of "some kind of checkpoint" built-in. –  Oct 12 '22 at 15:32