Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32276 > unrolled thread

Shipping python modules - best practices?

Started byrambius <rambiusparkisanius@gmail.com>
First post2012-10-27 07:02 -0700
Last post2012-10-27 14:41 -0700
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Shipping python modules - best practices? rambius <rambiusparkisanius@gmail.com> - 2012-10-27 07:02 -0700
    Re: Shipping python modules - best practices? Demian Brecht <demianbrecht@gmail.com> - 2012-10-27 14:39 -0700
    Re: Shipping python modules - best practices? Demian Brecht <demianbrecht@gmail.com> - 2012-10-27 14:41 -0700

#32276 — Shipping python modules - best practices?

Fromrambius <rambiusparkisanius@gmail.com>
Date2012-10-27 07:02 -0700
SubjectShipping python modules - best practices?
Message-ID<12ec4164-7711-4498-9bee-62c8b242aaa5@googlegroups.com>
Hello,

I developed some moderate-sized python scripts that I would like to distribute as python modules. I have never shipped modules before and I read http://docs.python.org/distutils/index.html. I was able to generate a source distribution, but I still have some questions.

1) My module contains some unit tests in separate scripts. I want to execute them when I generate the source distribution. How can I do it?

2) When I install 3rd party modules, I see some of them executing their unit tests during the installation. How can I do it? How can I provide an option to the user to ignore possible test failures?

3) I generate some html documentation with pydoc. How shall I distribute it with the module?

Thank you very much in advance.

Regards
rambius

[toc] | [next] | [standalone]


#32292

FromDemian Brecht <demianbrecht@gmail.com>
Date2012-10-27 14:39 -0700
Message-ID<mailman.2946.1351373963.27098.python-list@python.org>
In reply to#32276
1) IMHO, these should be two distinct steps. You will definitely want to run unit tests without sdist and likewise, I'm sure you'll want to sdist without unit tests. Personally, if I wanted to combine the two, I'd create tasks in a makefile and just run something along the lines of: make unit sdist

2) I don't understand why you'd want to run unit tests during installation. Unit tests are generally used pre-commit to ensure everything's working as expected in your environment and post commit to ensure there are no knock-on effects caused by your changes to the current code base. Running them during installation seems rather strange and useless to me..

3) Docs are generally stored in a /doc directory at the root of your project. I haven't used pydoc, but if it's anything like sphinx, then best practice is to commit the source for your docs and have the users using the project generate the static content themselves (usually done through a make target).

On 2012-10-27, at 7:02 AM, rambius <rambiusparkisanius@gmail.com> wrote:

> Hello,
> 
> I developed some moderate-sized python scripts that I would like to distribute as python modules. I have never shipped modules before and I read http://docs.python.org/distutils/index.html. I was able to generate a source distribution, but I still have some questions.
> 
> 1) My module contains some unit tests in separate scripts. I want to execute them when I generate the source distribution. How can I do it?
> 
> 2) When I install 3rd party modules, I see some of them executing their unit tests during the installation. How can I do it? How can I provide an option to the user to ignore possible test failures?
> 
> 3) I generate some html documentation with pydoc. How shall I distribute it with the module?
> 
> Thank you very much in advance.
> 
> Regards
> rambius
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Demian Brecht
@demianbrecht
http://demianbrecht.github.com



[toc] | [prev] | [next] | [standalone]


#32293

FromDemian Brecht <demianbrecht@gmail.com>
Date2012-10-27 14:41 -0700
Message-ID<mailman.2947.1351374094.27098.python-list@python.org>
In reply to#32276
I should also mention that these are just my personal best practices that I've put together during my time working with/on OS projects. You'll almost never find two projects with identical packaging, so really at the end of the day, it's totally up to you and your particular project requirements.

On 2012-10-27, at 2:39 PM, Demian Brecht <demianbrecht@gmail.com> wrote:

> 1) IMHO, these should be two distinct steps. You will definitely want to run unit tests without sdist and likewise, I'm sure you'll want to sdist without unit tests. Personally, if I wanted to combine the two, I'd create tasks in a makefile and just run something along the lines of: make unit sdist
> 
> 2) I don't understand why you'd want to run unit tests during installation. Unit tests are generally used pre-commit to ensure everything's working as expected in your environment and post commit to ensure there are no knock-on effects caused by your changes to the current code base. Running them during installation seems rather strange and useless to me..
> 
> 3) Docs are generally stored in a /doc directory at the root of your project. I haven't used pydoc, but if it's anything like sphinx, then best practice is to commit the source for your docs and have the users using the project generate the static content themselves (usually done through a make target).
> 
> On 2012-10-27, at 7:02 AM, rambius <rambiusparkisanius@gmail.com> wrote:

Demian Brecht
@demianbrecht
http://demianbrecht.github.com



[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web