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


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

Announce: PyPrimes 0.2.1a

Started bySteven D'Aprano <steve@pearwood.info>
First post2015-01-08 04:35 +0000
Last post2015-01-08 22:20 +1100
Articles 8 on this page of 28 — 10 participants

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


Contents

  Announce: PyPrimes 0.2.1a Steven D'Aprano <steve@pearwood.info> - 2015-01-08 04:35 +0000
    Re: Announce: PyPrimes 0.2.1a Ben Finney <ben+python@benfinney.id.au> - 2015-01-08 18:12 +1100
      Re: Announce: PyPrimes 0.2.1a Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-08 22:16 +1100
        Re: Announce: PyPrimes 0.2.1a Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-01-08 23:32 +0100
          Re: Announce: PyPrimes 0.2.1a Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-09 11:41 +1100
            Re: Announce: PyPrimes 0.2.1a Chris Angelico <rosuav@gmail.com> - 2015-01-09 11:50 +1100
              Re: Announce: PyPrimes 0.2.1a alister <alister.nospam.ware@ntlworld.com> - 2015-01-09 09:05 +0000
                Re: Announce: PyPrimes 0.2.1a Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 22:01 +1100
                  Re: Announce: PyPrimes 0.2.1a alister <alister.nospam.ware@ntlworld.com> - 2015-01-09 11:42 +0000
            Where to learn current best Python packaging practices (was: Announce: PyPrimes 0.2.1a) Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 12:11 +1100
              Re: Where to learn current best Python packaging practices (was: Announce: PyPrimes 0.2.1a) Rustom Mody <rustompmody@gmail.com> - 2015-01-08 17:39 -0800
              Re: Where to learn current best Python packaging practices (was: Announce: PyPrimes 0.2.1a) Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-08 17:42 -0800
                Re: Where to learn current best Python packaging practices Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 13:37 +1100
        PyPI files should not change their payload (was: Announce: PyPrimes 0.2.1a) Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 10:55 +1100
          Re: PyPI files should not change their payload (was: Announce: PyPrimes 0.2.1a) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-09 11:38 +1100
        Using a ChangeLog as a canonical source of package metadata (was: Announce: PyPrimes 0.2.1a) Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 11:06 +1100
          Re: Using a ChangeLog as a canonical source of package metadata (was: Announce: PyPrimes 0.2.1a) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-12 05:17 +1100
            Re: Using a ChangeLog as a canonical source of package metadata Ben Finney <ben+python@benfinney.id.au> - 2015-01-12 07:21 +1100
              Re: Using a ChangeLog as a canonical source of package metadata wxjmfauth@gmail.com - 2015-01-11 12:37 -0800
                Re: Using a ChangeLog as a canonical source of package metadata Steven D'Aprano <steve@pearwood.info> - 2015-01-12 05:44 +0000
                  Re: Using a ChangeLog as a canonical source of package metadata wxjmfauth@gmail.com - 2015-01-12 05:24 -0800
                    Re: Using a ChangeLog as a canonical source of package metadata Steven D'Aprano <steve@pearwood.info> - 2015-01-13 06:59 +0000
                      Re: Using a ChangeLog as a canonical source of package metadata wxjmfauth@gmail.com - 2015-01-13 00:09 -0800
                        Re: Using a ChangeLog as a canonical source of package metadata Steven D'Aprano <steve@pearwood.info> - 2015-01-13 08:22 +0000
            Re: Using a ChangeLog as a canonical source of package metadata Ben Finney <ben+python@benfinney.id.au> - 2015-01-14 21:59 +1100
        Re: Using a ChangeLog as a canonical source of package metadata (was: Announce: PyPrimes 0.2.1a) Chris Angelico <rosuav@gmail.com> - 2015-01-09 11:16 +1100
    Re: Announce: PyPrimes 0.2.1a Christian Gollwitzer <auriocus@gmx.de> - 2015-01-08 08:27 +0100
      Re: Announce: PyPrimes 0.2.1a Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-08 22:20 +1100

Page 2 of 2 — ← Prev page 1 [2]


#83608 — Re: Using a ChangeLog as a canonical source of package metadata

Fromwxjmfauth@gmail.com
Date2015-01-12 05:24 -0800
SubjectRe: Using a ChangeLog as a canonical source of package metadata
Message-ID<c82ac862-9f9a-41b6-b774-a8506e0a4f88@googlegroups.com>
In reply to#83595
Le lundi 12 janvier 2015 06:46:20 UTC+1, Steven D'Aprano a écrit :
> On Sun, 11 Jan 2015 12:37:03 -0800, wxjmfauth wrote:
> 
> > 1) I downloaded pyprimes-0.2.1a.tar.gz 
> > 2) I extracted the relevant part,
> > the py files, the pyprimes subdirectory,
> > awful.py, compat23.py, factors.py, test.py, .......... and put in
> > d:\junk
> 
> That is not the way packages work.
> 
> pyprimes is a package, which means it has to stay together in a single 
> directory called "pyprimes", with a file called "__init__.py" inside it. 
> It is not a set of independent modules.
> 
> Please read the README file, it explains the correct way to install 
> pyprimes. You should use the setup.py installer script.
> 
> If you insist on manually doing this, you can copy the *entire* pyprimes 
> package directory. That is, unpack the tar.gz file to something like this:
> 
> 
> pyprimes/
> +-- CHANGES.txt  
> +-- LICENCE.txt
> +-- MANIFEST  
> +-- README.txt
> +-- setup.py
> +-- src/
>     +-- pyprimes/
>         +-- __init__.py
>         +-- awful.py
>         +-- factors.py
>         +-- test.py
>         etc.
> 
> 
> Copy the *entire* folder pyprimes/src/pyprimes/ and move that somewhere 
> into your PYTHONPATH. 
> 
> Or instead you can:
> 
> cd pyprimes/src  # ***NOT*** pyprimes/src/pyprimes !!!
> 
> 
> and run python from there.
> 
> 
> -- 
> Steve

To tell you the truth, I'm unable to
put your product to work.

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


#83668 — Re: Using a ChangeLog as a canonical source of package metadata

FromSteven D'Aprano <steve@pearwood.info>
Date2015-01-13 06:59 +0000
SubjectRe: Using a ChangeLog as a canonical source of package metadata
Message-ID<54b4c269$0$2738$c3e8da3$76491128@news.astraweb.com>
In reply to#83608
On Mon, 12 Jan 2015 05:24:00 -0800, wxjmfauth wrote:

> To tell you the truth, I'm unable to
> put your product to work.


If you follow the instructions in the README, and it still doesn't work, 
that's a bug and I will be happy to fix it.

If you insist on doing things your own way, and breaking the package, 
then I cannot help you.



-- 
Steve

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


#83673 — Re: Using a ChangeLog as a canonical source of package metadata

Fromwxjmfauth@gmail.com
Date2015-01-13 00:09 -0800
SubjectRe: Using a ChangeLog as a canonical source of package metadata
Message-ID<d911aa4b-c1ad-40c1-a9c6-30e18897cace@googlegroups.com>
In reply to#83668
Le mardi 13 janvier 2015 08:00:06 UTC+1, Steven D'Aprano a écrit :
> On Mon, 12 Jan 2015 05:24:00 -0800, wxjmfauth wrote:
> 
> > To tell you the truth, I'm unable to
> > put your product to work.
> 
> 
> If you follow the instructions in the README, and it still doesn't work, 
> that's a bug and I will be happy to fix it.
> 
> If you insist on doing things your own way, and breaking the package, 
> then I cannot help you.
> 

No, I do not claim, your package is buggy.
I just wanted to toy with it without installing
it in the XXX\pythonXX directory structure.

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


#83675 — Re: Using a ChangeLog as a canonical source of package metadata

FromSteven D'Aprano <steve@pearwood.info>
Date2015-01-13 08:22 +0000
SubjectRe: Using a ChangeLog as a canonical source of package metadata
Message-ID<54b4d5e2$0$2738$c3e8da3$76491128@news.astraweb.com>
In reply to#83673
On Tue, 13 Jan 2015 00:09:04 -0800, wxjmfauth wrote:

> Le mardi 13 janvier 2015 08:00:06 UTC+1, Steven D'Aprano a écrit :
>> On Mon, 12 Jan 2015 05:24:00 -0800, wxjmfauth wrote:
>> 
>> > To tell you the truth, I'm unable to
>> > put your product to work.
>> 
>> 
>> If you follow the instructions in the README, and it still doesn't
>> work, that's a bug and I will be happy to fix it.
>> 
>> If you insist on doing things your own way, and breaking the package,
>> then I cannot help you.
>> 
>> 
> No, I do not claim, your package is buggy. I just wanted to toy with it
> without installing it in the XXX\pythonXX directory structure.


It is a pure Python package. Copy the package directory out of the tar 
ball and put it where Python can see it, and it will work.

If you need to read more about packages, start here:

https://docs.python.org/2/tutorial/modules.html#packages


-- 
Steve

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


#83743 — Re: Using a ChangeLog as a canonical source of package metadata

FromBen Finney <ben+python@benfinney.id.au>
Date2015-01-14 21:59 +1100
SubjectRe: Using a ChangeLog as a canonical source of package metadata
Message-ID<mailman.17711.1421233195.18130.python-list@python.org>
In reply to#83552
Ben Finney <ben+python@benfinney.id.au> writes:

> The idea is to parse from the Changelog the version metadata, and
> record it in Setuptools metadata. Then the ‘pkg_resources’ module of
> Setuptools allows programmatic access to that metadata.

One tricky aspect is: at what specific point should the Changelog be
parsed and the version metadata recorded in Setuptools package metadata?

At first I thought it should be done immediately on starting ‘setup.py’,
in order to have values to supply to the ‘setup()’ call. So I imported
the ‘version’ module which itself imports ‘docutils’ to have the reST
parsing available; then ‘setup.py’ continues by feeding the Changelog to
a function which parses it and emits values which are used to supply
parameters to ‘setup()’.

As was revealed in a recent version of the code base, though, this
causes a circular dependency. Docutils is a third-party library, which
needs to be declared as a dependency and satsified before it can be
imported. But that dependency can't be declared until ‘setup()’ has run
to specify what the dependencies are!

So in a later release I've had to break that circle by introducing an
initial “unknown” state for the version information, in order to allow
‘setup()’ to run and get the dependencies installed. Then when the
‘setup.py egg_info’ command is run, the Changelog is parsed and the
version info metadata file is injected into the Setuptools metadata for
the distribution.

Rather more complicated than I would like, because of the need to have
‘setup()’ as a top-level call in ‘setup.py’. This would be more
straightforward if we could assume the commonly-deployed existence of a
*declarative* build system (such as Make); but in Python we're stuck
with ‘setup.py’ and its limitations for now. Fortunately, the hard work
of many people have made those much better in recent years.


I'm interested to know what people writing Python distributions think of
this approach. Again, the example I'm discussing is in ‘python-daemon’'s
code base, at <URL:https://alioth.debian.org/projects/python-daemon/>.

Eventually I might propose this to the Distutils folks as a possible
improvement, but I'd like to refine it more in the face of actual usage.

-- 
 \          “… a Microsoft Certified System Engineer is to information |
  `\     technology as a McDonalds Certified Food Specialist is to the |
_o__)                               culinary arts.” —Michael Bacarella |
Ben Finney

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


#83375 — Re: Using a ChangeLog as a canonical source of package metadata (was: Announce: PyPrimes 0.2.1a)

FromChris Angelico <rosuav@gmail.com>
Date2015-01-09 11:16 +1100
SubjectRe: Using a ChangeLog as a canonical source of package metadata (was: Announce: PyPrimes 0.2.1a)
Message-ID<mailman.17489.1420762590.18130.python-list@python.org>
In reply to#83324
On Fri, Jan 9, 2015 at 11:06 AM, Ben Finney <ben+python@benfinney.id.au> wrote:
> I've now produced a small Python library which knows how to transform a
> reST Changelog to package metadata; and how to get that package metadata
> into and out of a Python distribution with Distutils.
>
> The result is that I will never again upload the package with a mismatch
> between what the Changelog claims is the latest version, and what the
> package metadata says.
>
>
> This may be generally useful to others. I'm interested to know how
> people would expect to use this. As an extension to Distutils? As a
> third-party library? Something else?

I can't speak as a package maintainer (because I'm not one), but
speaking as an end user, I'm in favour of anything that guarantees
consistency like that. It's only occasionally an issue, but for
instance, if I clone someone's source code repository and then install
a package from there, it's not necessarily obvious from 'pip freeze'
that I have something that can't so easily be downloaded. If the
Changelog were guaranteed to show that, then I could easily see what's
going on (eg if a new entry is created, immediately after the version
release, adding an alpha version tag).

ChrisA

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


#83321

FromChristian Gollwitzer <auriocus@gmx.de>
Date2015-01-08 08:27 +0100
Message-ID<m8lbgt$sgd$1@dont-email.me>
In reply to#83317
Hi Steve,

Am 08.01.15 um 05:35 schrieb Steven D'Aprano:
> At long last, I am pleased to announce the latest version of PyPrimes, a
> pure Python package for working with prime numbers.

Nice.

> PyPrimes is compatible with Python 2 and 3, and includes multiple
> algorithms for the generating and testing of prime numbers, including the
> Sieve of Eratosthenes, Croft Spiral, Miller-Rabin and Fermat
> probabilistic tests.
>
> https://pypi.python.org/pypi/pyprimes/

I don't want to badmouth your effort, but it seems to me that this is 
still a collectino of rather simple algorithms. What about the AKS test, 
which is O(P) and deterministic for all primes, what about elliptic 
curve factorization or a quadratic sieve?

I'm sure that other people with better knowledge of number theory could 
propose some more generally useful algorithms.

	Christian

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


#83325

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2015-01-08 22:20 +1100
Message-ID<54ae6815$0$13010$c3e8da3$5496439d@news.astraweb.com>
In reply to#83321
Christian Gollwitzer wrote:

> Hi Steve,
> 
> Am 08.01.15 um 05:35 schrieb Steven D'Aprano:
>> At long last, I am pleased to announce the latest version of PyPrimes, a
>> pure Python package for working with prime numbers.
> 
> Nice.
> 
>> PyPrimes is compatible with Python 2 and 3, and includes multiple
>> algorithms for the generating and testing of prime numbers, including the
>> Sieve of Eratosthenes, Croft Spiral, Miller-Rabin and Fermat
>> probabilistic tests.
>>
>> https://pypi.python.org/pypi/pyprimes/
> 
> I don't want to badmouth your effort, but it seems to me that this is
> still a collectino of rather simple algorithms. What about the AKS test,
> which is O(P) and deterministic for all primes, what about elliptic
> curve factorization or a quadratic sieve?

It's a 0.2 version number, what do you expect? :-)

AKS may be O(P), but the constant factor is quite large. In practice I
expect that it will probably be slower than Miller-Rabin. Nevertheless,
I'll eventually include that.



-- 
Steven

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

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


csiph-web