Can this code, to convert string to integer, be made more compact?
Styling

Try to make the code follow the PEP 8 Style Guidelines, this will make your code follow the Python conventions, and also more readable. So do 
if l == 1 instead of if l==1, my_atoi instead of myAtoi, etc

Code structure

It seems that page requires the code to be inside a class. Leaving the exercise aside for a moment:
You don't need that function inside a class, because you are never using anything of the class itself. It makes more sense to define that method outside the class, and without the (unused) self parameter.

Skiping whitespaces

while(i&lt;l and s[i]==" "):
    i+=1
    if i==l:
        return 0



You don't need those parenthesis on the while in Python.
Your code might not detect some whitespace characters like \t (it seems the exercise accepts that though); use the method isspace(). 
Instead of checking i == l on every iteration (when it could only happen in the last one), check it once you are out of the loop. This allows us to remove the special treatment to empty strings: if s is empty, it won't enter the loop and i == l, so it will return 0.


while i &lt; l and s[i].isspace():
    i += 1

if i == l:
    return 0


Sign

Your code to handle the sign is too complicated. Instead of keeping ispos and isnegative, you could just keep a factor that is either 1 or -1. So instead of 

ispos = False
if(s[i]=="+"):
    ispos = True
    i+=1
isnegative = False
if(s[i]=='-' and not ispos):
    isnegative = True
    i+=1


you can do

factor = -1 if s[i] == '-' else 1
# Skip the sign character if necessary
if s[i] == '-' or s[i] == '+':
    i += 1


Reading the number

if(i&lt;len(s) and not s[i].isnumeric() and s[i]!='+' and s[i]!='-'):
    return 0
while(i&lt;l):
    if s[i].isnumeric():
        res += s[i]
    else:
        break
    i+=1



If we have already parsed the sign, why accept another sign again? 
Be careful, isnumeric() accepts things like ½, which you probably don't want; use isdigit() instead.
EDIT: As noted in the comments, isdigit() will accept things like "¹". So it's probably better to just do s[i] in '0123456789'
It's good practice (and helps avoid unexpected bugs) to declare variables the closest possible to where they are used. You declare res = "" at the beginning of your function, but haven't used it until now.
The while and if can be condensed into a single, more compact loop:


res = ""
while i &lt; l and s[i].isdigit():
    res += s[i]
    i += 1

# You can check if an string is empty doing this:
if not res:
    return 0


Arrived to this point, if the function hasn't returned, we know res contains a number. The way you handle the valid range, before applying the sign, is not very intuitive; it's better if you first apply the sign.

x = factor * int(res)
if x &gt; (1 &lt;&lt; 31):
    return (1&lt;&lt;31)
elif x &lt; -((1 &lt;&lt; 31) - 1):
    return (1 &lt;&lt; 31) - 1
else:
    return x


Or it might be even better to clamp your number using min and max:

return max(-(1 &lt;&lt; 31) + 1, min(1 &lt;&lt; 31, factor * int(res)))


Final code

I have removed the special case of l == 1 because it is already handled by the rest of the code. This is my final code (untested):

def my_atoi(s: str) -&gt; int:
    l = len(s)

    while i &lt; l and s[i].isspace():
        i += 1

    if i == l:
        return 0

    factor = -1 if s[i] == '-' else 1
    # Skip the sign character if necessary
    if s[i] == '-' or s[i] == '+':
        i += 1

    res = ""
    while i &lt; l and s[i].isdigit():
        res += s[i]
        i += 1

    if not res:
        return 0

    return max(-(1 &lt;&lt; 31) + 1, min(1 &lt;&lt; 31, factor * int(res)))