Packaging Publish Help

I am trying to make a python package using Poetry » https://replit.com/@SalladShooter/extras-py when I try to publish it I can put in my PyPI username but with the password I can’t type. Does anyone know why this is happening?

1 Like

You can type, it just doesn’t show the password for security reasons. The password is being typed in. (Same as how when you type your password on a website the letters are replaced with *)

2 Likes

Oh thank you let me try that, does pasting in the password work?

It should let you paste the password

When I did it said invalid or non-existent credentials I made an account and verified it, Profile of SalladShooter · PyPI

IIRC you you have to use your username and password, not email and password just incase you are doing that.

1 Like

If you are using your username and password double check that they are correct

It says I can’t upload that package with the name ‘pyextras’

Wait I have to pick another name, someone already made it.

I changed it, but now it says it can’t find my folder/file

@InvisibleOne one more thing, when I run the pip (the pip is pip install extras-py) and use the code from the package in my new project my function that I made isn’t defined, do you know why?

How are you trying to use it? A Repl link would be helpful.

@Fireup650 https://replit.com/@SalladShooter/TrustingMurkyParallelalgorithm I’m testing the package on this, if you want the package code go to the top of this post.

That’s a new one, lol.
Anyways, I’ll take a look.

Whoops, I forgot the p. That makes more sense then fire up, and php is a fox like a pup.

So reviewing your code, I know the issue. You’re referencing the parts of your package without importing them first. Either:

  1. import * from your package (not recommended)
from package import *
wait(5)
  1. import the package itself
import package
package.wait(5)
  1. import your package as something
import package as p
p.wait(5)
  1. import the stuff you need from your package
from package import wait
wait(5)

Also, verify your package is installed, as replit usually seems to fail to guess imports if they’re fairly new.

This will only work as expected if the imported module is a file, not a package. (Wild Card import will for the above examples, but like said by @Firepup650, is not recommended)

Here’s an example of a package structure:

package -
    __init__.py # Classifies this as package
    file.py # Includes wait()
    otherfile.py # Includes some other functions

Here’s what I mean in terms of importing:

from package.file import wait # Import specific function from a package's file
wait(5)

from package import file # Import specific file from a package
file.wait(5)

import package # Import every function within a package
package.file.wait(5) # Might be incorrect on this one

# Or import everything from a package, cluttering your namespace (highly not recommended)
from package import *
wait(5)
1 Like

In __init__.py you can do:

# I forgot how to import from a file in the same folder
# so this may be wrong
from .file import wait

and:

from package import wait
wait(5)
1 Like

IIRC, (could be wrong, I am about to go to bed), you can do this:

from file import wait

No, that would give an error to anyone importing your package. Of course, if my original thing doesn’t work, you can always do this in __init__.py

from package.file import wait