DEV Community

Mario Hernandez
Mario Hernandez

Posted on

Open Source Project: from idea to package

So, it's time you -yes, you, the one writing this- should give something back to the opensource community that you like and never contributed.

Let's begin then, what would you like to do? Oh, you don't know? It's too simple? There are tons of options? OK OK, relax, dial back, didn't you said you needed to code that api client because there wasn't on PyPi? Why don't you code that? Cool!

Environment

First you need to set up virtualenv for that, and i think you'll need requests for th... poetry? what's that?, oh nice!

After you install poetry, create the project with poetry new project-name. This API Client it' supposed to connect to flow.cl a payment broker? and PyFlow it's the best name you could think of? Let's better name it PyFlowCL.

$ poetry new pyflowcl
Created package pyflowcl in pyflowcl

You should have a folder called pyflowcl with everything you need to start, now we need to make the GIT Repo.

$ cd pyflowcl
$ git init
Initialized empty Git repository in /home/mariofix/pyflowcl/.git/
$ git remote add github git@github.com:mariofix/pyflowcl.git

And that's it really, start coding and we'll pick up down the road.

A few considerations

Since this is not a private project, you should consider reading about PEPs (or PSR as you know in PHP), which are proposals for Python, among the most interesting -for me- are PEP-8, PEP-257, PEP-20.

Don't be afraid to look up other projects, you don't know everything and you might get inspired, you can even take someone else's code and start from there (you can fork PyKhipu and modify it to make it usable with Flow) whatever you choose to do, remember to honor the licenses because you'll need to pick one for the project, and for that you have https://choosealicense.com

https://gitignore.io is also a cool tool to create your .gitignore file

First Version

First release already? wow, that was fast. Publish it then, remember to create the pull request to the main branch in your repository.

You will need to update your pyproject.toml file, to add the info necessary for PyPi, my recomendations are: name, version, description, authors, license, readme, repository, classifiers

First you need to build it, easy with Poetry

$ poetry build
Building pyflowcl (0.1.1)
 - Building sdist
 - Built pyflowcl-0.1.1.tar.gz

 - Building wheel
 - Built pyflowcl-0.1.1-py3-none-any.whl

There are more options to the build process, you can find them in the documentation.

If you don't have a PyPi account, it's time to create one, once you have it, just publish it

$ poetry publish

Publishing pyflowcl (0.1.1) to PyPI
Username: mariofix
Password: 
 - Uploading pyflowcl-0.1.1-py3-none-any.whl 100%
 - Uploading pyflowcl-0.1.1.tar.gz 100%

There, it wasn't as hard as you thought it'll be, now you are responsible to make the updates, fix bugs and all that.
Remember, this is the first of many.

GitHub logo mariofix / pyflowcl

Cliente para comunicacion con API de flow.cl

Top comments (0)