Open Source Project: from idea to package
Tags: python, showdev, githunt
Published: 2020-08-15 03:29:30

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?**](https://dev.to/t/poetry), 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**.

```bash
$ 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.

```bash
$ 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](https://www.python.org/dev/peps/pep-0008/), [PEP-257](https://www.python.org/dev/peps/pep-0257/), [PEP-20](https://www.python.org/dev/peps/pep-0020/).

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

```bash
$ 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
```bash
$ 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](https://pypi.org/project/pyflowcl).

{% github mariofix/pyflowcl no-readme %}