Lightning Talk - Pyramid and Pycharm
CC Attribution 3.0 Germany:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Piercy, Steve
How to use PyCharm to get you a working Pyramid project, fast.
 My name is Steve Piercy and today I'm going to demonstrate how to create a pyramid project in PyCharm Professional. Let's get started. From the file menu or this here welcome screen, select new project. For the project type, select pyramid. Let's give our project a name and a location. PyCharm automatically fills in the virtual environment location and the project name. For template language, I'm going to select gint2 and for a backend, I'm going to select SQL Alchemy for using an SQL Lite database. Click create to start project creation. Now right now, PyCharm is creating a virtual environment. It will then install packaging tools and upgrade them. After it's created that, after it's done that, it will install cookie cutter and its dependencies. Then it'll run the cookie cutter and create a pyramid run and debug configuration and finally pop open its readme text file. Now PyCharm is pretty cool. It runs the first three steps in this text file for you. So we can pick up where it left off by running these commands in the terminal. So we'll go ahead and do that. This will install our project in editable mode. And then install testing requirements. Next, we will generate an Alembic Revision and then upgrade to that revision. Then we will initialize our database and populate it with data. Then we will run test through pytest and we should get to test pass. Hey, that's pretty cool. Two of them passed. That's successful. And then we can start our project and view it in a web browser. Let's do that. Hey, that's pretty cool. That was easy. But hey, you know what? Maybe you don't like using the terminal so much and you like using pretty things. So PyCharm has you covered. First, let's take a look at this database. To open it up, you just double-click it. You can inspect schemas. You can see the tables. You can see the columns in a table and you can actually see the data inside of your database. That's pretty cool. All right. Well, what about running the project? Well, you can do that too. We have underneath our run and debug configurations. We can check and make sure that we open up the browser when we start the run configuration. So I'll do that. Let's run it and it should pop open a new window. Woohoo. That's pretty awesome. That's cool. Let's stop our configuration. We can also do some debugging if we like. But to do good debugging, we always have to set a break point. So let's set a break point right here and start running our debug configuration. Okay, that gets going. Pop open the window. Oh, hey, we can inspect the request. What's inside there? Lots of goodies. That's pretty cool. Let's step over this line of code. And then we can see, oh, it generated a select statement, an SQL statement. That's really cool. We can inspect that too. But hey, let's keep going. Let's actually run the statement and execute it. And we can see, oh, there's data there. Hey, that kind of matches up with our model. That's really cool. Okay, okay. I'm super excited, but I'm going to stop right there. But wait, there's one more thing. Let me show you how you can run your tests within PyCharm. We're going to do a PyTest configuration in the project directory. We'll copy that and paste it just to be right there and click OK. And then we'll run our tests in PyTest. Look at that. We got our whole test we executed to test. We can also run just one test at a time if we want. That's pretty cool. Woohoo! All right. I can't get too excited. But anyway, I just wanted you to see. I'm not a time, but go here to this web page, this GitHub page, for more information and get a discount of 20% off PyCharm Professional. Use the PLONE20 coupon code.
 My name is Steve Piercy and today I'm going to demonstrate how to create a pyramid project in PyCharm Professional.  Let's get started. From the file menu or this here welcome screen, select new project. For the project type, select pyramid.  Let's give our project a name  and a location.  PyCharm automatically fills in the virtual environment location and the project name.  For template language, I'm going to select gint2 and for a backend, I'm going to select SQL Alchemy for  using an SQL Lite database. Click create to start project creation.  Now right now, PyCharm is creating a virtual environment.  It will then install packaging tools and upgrade them.  After it's created that, after it's done that, it will install cookie cutter and its dependencies.  Then it'll run the cookie cutter and  create a pyramid run and debug configuration and finally pop open its readme text file.  Now PyCharm is pretty cool. It runs the first three steps in this text file for you.  So we can pick up where it left off  by running these commands in the terminal.  So we'll go ahead and do that. This will install our project in editable mode.  And then  install testing requirements.  Next, we will generate an Alembic Revision and then upgrade to that revision.  Then we will initialize our database and populate it with data.  Then we will run test through pytest and  we should get to test pass. Hey, that's pretty cool.  Two of them passed. That's successful. And then we can start our project  and view it in a web browser.  Let's do that. Hey, that's pretty cool.  That was easy. But hey, you know what? Maybe you don't like using  the terminal so much and you like using pretty things. So PyCharm has you covered.  First, let's take a look at this database. To open it up,  you just double-click it. You can inspect schemas. You can see the tables.  You can see the columns in a table and you can actually see the data inside of your database.  That's pretty cool.  All right. Well, what about running the project? Well, you can do that too. We have underneath our  run and debug configurations. We can check and make sure that we open up the browser when we start the run configuration.  So I'll do that.  Let's run it and it should pop open a new window. Woohoo. That's pretty awesome. That's cool. Let's stop our configuration.  We can also do some debugging if we like. But to do good debugging, we always have to set a break point.  So let's set a break point right here and start running our debug configuration.  Okay, that gets going. Pop open the window. Oh, hey, we can inspect the request. What's inside there? Lots of goodies.  That's pretty cool. Let's step over this line of code.  And then we can see, oh, it generated a select statement, an SQL statement. That's really cool.  We can inspect that too. But hey, let's keep going. Let's actually run the statement and execute it. And we can see, oh, there's data there.  Hey, that kind of matches up with our model. That's really cool. Okay, okay. I'm super excited, but I'm going to stop right there.  But wait, there's one more thing. Let me show you how you can run your tests  within PyCharm.  We're going to do a PyTest configuration  in the project directory.  We'll copy that and paste it just to be right there and click OK. And then we'll run our tests in PyTest.  Look at that. We got our whole test we executed to test. We can also run just one test at a time if we want. That's pretty cool.  Woohoo! All right. I can't get too excited. But anyway, I just wanted you to see.  I'm not a time, but go here to this web page, this GitHub page, for more information and get a discount of 20% off PyCharm Professional.  Use the PLONE20 coupon code.
Lightning_Talk_-_Pyramid_and_Pycharm_-_Steve_Pierc_2kB9Wtg0j4s_0_4859.png Lightning_Talk_-_Pyramid_and_Pycharm_-_Steve_Pierc_2kB9Wtg0j4s_4860_5471.png Lightning_Talk_-_Pyramid_and_Pycharm_-_Steve_Pierc_2kB9Wtg0j4s_5472_5627.png Lightning_Talk_-_Pyramid_and_Pycharm_-_Steve_Pierc_2kB9Wtg0j4s_5628_6743.png Lightning_Talk_-_Pyramid_and_Pycharm_-_Steve_Pierc_2kB9Wtg0j4s_6744_7492.png