It's not a sailing ship. You're not going to have any kind of grapple of sufficient strength to withstand spacegoing levels of power. You can get away with that MAYBE against the kind of pansyass chemrockets we presently use, but against anything capable of generating meaningful, "going somewhere" levels of thrust, it ain't happening.
Pirates, realistically, don't need to board hostile ships at all, and they certainly aren't interested in cargo. Pirates TODAY aren't interested in cargo. What possible kind of space cargo would be worth jacking? Mineral ores? 3D Printed Chinese Crap? No, pirates want ransoms. The ideal target of a pirate is therefore some kind of passenger liner. A pirate, therefore, can jack a ship, quite likely without boarding it, simply by pointing a weapon at the ship and demanding cooperation under threat of destruction. It may not ever actually be necessary to board the ship at all: They're your hostages even without ever having to go over there, and they certainly aren't going to jump overboard and spacewalk away, so you don't need to confine them to anything. You point your guns at the ship, demand that the ship come with you, or not, since you might very well be able to ransom them in-place, and your work is done.
Even a civilian ship would be basically impossible to board if it were resisting. You can't even board a contemporary spacecraft that doesn't want to be boarded. Far easier to just threaten them to achieve compliance.