osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to work on a package


Roel Schroeven <roel at roelschroeven.net> writes:
> I'm fairly comfortable writing Python code, but I only have experience
> writing scripts with perhaps a few supporting modules. Now I want to
> start writing a package, and I'm feeling a bit helpless: I'm not sure
> how to organize my work.

You may have a look at
"https://packaging.python.org/"; and
"https://packaging.python.org/tutorials/distributing-packages/#requirements-for-packaging-and-distributing";.

> In my way of thinking, I would have a working tree for the package (or
> even more than one), and also an installed version (once version 0.1
> or so is ready).
>
> For example, let's say I'm working on luaparser
> (https://github.com/boolangery/py-lua-parser). There are tests in
> directory luaparser/tests, and I want to execute those tests. So I
> execute, for example:
>
> $ python3 -m unittest test_ast.py

Likely, there are many ways to execute tests for your package.

I am using "setuptools" for packaging (an extension
of Python's standard "disutils"). Its "setup.py" supports the "test"
command. This means, properly set up, I can run tests
with "python setup.py test".