How to create a python package on repl.it!
Introduction
In this tutorial, I'm gonna show you how to create a python package and publish it to pypi. Many people say this is impossible on repl.it. It is not. Though you can't do it using a generic approach, but using poetry, you can do it quite easily.
Part 1: coding your package
Start by creating a python repl. Then go to the bash shell (CTRL + SHIFT + S or CMD + SHIFT + S
) and type poetry new mypackage
. **Replace the mypackage with your package name. If when you import it, you want it to have underscores (my_package
) , use dashes (my-package
). Here is what you should see:
Go to package-name/package-name/__init__.py
. You should see one thing:
This is where you add your package code. I'll add some basic stuff:
Part 2: Publishing your package
Now you can publish your package so others can use it! Create an account on pypi. In the bash shell, type cd package-name
. Again, replace package-name with your package name. After that, type poetry update
to update the dependencies for your package. Then type poetry build
. Then poetry publish
. When it asks for them, enter you pypi credentials. You are good to go!
To create a new release, simply change line one of package-name/package-name/__init__.py
to 0.1.1, and line three of package-name/pyproject.toml
. poetry update
, poetry build
, and poetry publish
!
What now?
Check out https://python-poetry.org/docs and https://python-poetry.org/docs/pyproject to do more.
That's it!
I have automated it: Click here!
Wow, that's really cool! @WhatDoWeDoNow
This is amazing! Thank you so much! If you want to see it, the name of it is "tilecode"
Cool! You can also add change the beginning of pyproject.toml from
[tool.poetry] name = "tilecode" version = "0.0.0" description = "" authors = ["WhatDoWeDoNow"]
to
[tool.poetry] name = "tilecode" version = "0.0.0" description = "" authors = ["WhatDoWeDoNow"] documentation = "<.md file>"
to add documentation!
@WhatDoWeDoNow
@isaiah08 Okay :)
IT'S IMPOSSIBLE, LOOK BELOW
I'm trapped when Poetry asks my PyPI password:
Step 1:
Step 2:
Step 3:
Step 4:
AND IT DOESN'T LET ME PUT MY PASSWORD
NOW IT SAYS A RUNTIMEERROR:
Poetry could not find a pyproject.toml file in /home/runner/commonpy or its parents
Can you invite me to the repl? I might be able to solve it that way. @RixTheTyrunt
The password is hidden. Your still typing it in, but it won't show it. @RixTheTyrunt
You also can't publish a package called commonpy because somebody has already done so: https://pypi.org/project/commonpy/ @RixTheTyrunt
WUT
CODEPY???
PROGRAMPY!!!
YAHOO!!! I JUST NEEDED TO MAKE A LITTLE BASH CHANGE! ( *bruh* )
Nice, I never knew how to do this
Neither did i till 10 minutes before i posted this :) @IntellectualGuy
there is no pyproject.toml
so i cant update it
@Anpang Click "show hidden files" and select
pyproject.toml
@WhatDoWeDoNow there is no pyproject.toml
@WhatDoWeDoNow even if i clicked show hidden filoes
Try creating a new repl and trying it again. You may have deleted it by mistake or something. It should be in the part of the files sidebar that is called "Packager Files"

@Anpang