I created a ticket:
https://bitbucket.org/blais/beancount/issues/72/consider-installing-with-setuptools-again

It would need a lot more testing, e.g., on Windows, Mac, etc., in order to
make sure this works and if I recall all the crazy time I sunk into this,
I'm pretty sure I don't want to burn all that time all over again. I'll
reconsider it but it's at the very bottom of the list of things I need to
do. The price to pay to install the other dependencies explicitly is really
small IMO (and you don't have to install setuptools, which is a plus).







On Wed, Oct 7, 2015 at 6:44 PM, Gary Peck <[email protected]>
wrote:

>
>
> On Thursday, July 2, 2015 at 3:14:33 PM UTC-7, Martin Blais wrote:
>>
>> On Thu, Jul 2, 2015 at 3:23 PM, Martin Blais <[email protected]> wrote:
>>
>>>
>>> I'd been having problems with setup.py in that it's supposed to be able
>>> to install dependencies by default, so in theory you shouldn't have to
>>> install anything but Beancount now. It hadn't been working before.
>>>
>>> Here's some background, in case anyone's interested: Python has two
>>> active supporting projects for packaging:
>>>
>>> (1) distutils, which comes with it in the stdlib, and
>>> (2) setuptools, which is newer and better, but which needs to be
>>> installed on top of the stdlib.
>>>
>>> There's a deep history of why that is and many projects have come and
>>> gone trying to make this better (e.g. distribute). The main issue with
>>> disutils is that it does not support automatic installation of dependencies
>>> (it's really old but a ton of packages still depend on it, that's the price
>>> of popularity). Setuptools does support it, the packager can declare
>>> dependencies and pip3 should be able to pull in and install all
>>> requirements automatically.  I could not get setuptools to install my
>>> dependencies due to a namespace collision with the 'parser' module (was my
>>> fault).
>>>
>>> Now that I've made changes, Beancount supports setuptools and installs
>>> dependencies automatically. If you don't have setuptools installed, it
>>> falls back on distutils (and you have to install the dependencies manually,
>>> e.g. it's a one-liner:  "pip3 install python-dateutil lxml bottle ply").
>>>
>>
>> Okay, an update: the state of setuptools / distutils Python distribution
>> tools is in a really sorry state indeed. I've spend much of my afternoon
>> dealing with some more setuptools brokenness and running around its sad,
>> sad source code. When I use
>>
>>   python3 setup.py build_ext -i
>>
>> with setuptools installed, it puts the _parser.so library under
>> src/python and not under src/python/beancount/parser where it should be, so
>> that's a no go.
>>
>> This is using setuptools v15. Manually installing the latest v18 puts the
>> .so in the right place but there is an annoying warning about not running
>> it with pip3.
>>
>> #$&*# this. No seriously, I've had enough. I want to spend my time
>> building features instead of packaging, and I've wasted the better part of
>> a beautiful vacation day just dealing with setuptools and reading
>> conflicting information on the web. I'm ditching support for setuptools.
>>
>> Beancount will use distutils, which is basic, comes with all versions of
>> Python, and does the right thing by default. It's only drawback is that you
>> need to install the dependencies manually. It won't do the dependencies
>> automatically. It's a one-liner to install dependencies. No big deal in my
>> book.
>>
>> Python seriously needs a brand new, rewritten from scratch packaging
>> system.
>>
>
> I fully understand your pain and frustration with setuptools, but I'm
> hoping you might reconsider. With a few small changes to setup.py, I have
> not been able to find an installation method that fails. If you let me know
> environments where the installation fails, I'm happy to try to fix those
> environments too. I'm trying to get others in my company to use beancount
> for our bookkeeping and it's really nice to be able to point people at a
> single installation command, as well as being able to use tools like pipsi
> to install beancount.
>
> I tested the following commands under Ubuntu 15.04 and (a) a virtualenv
> with python 3.4.3, pip 7.1.0, and setuptools 18.0.1, as well as (b) a
> pyvenv with python 3.4.3, pip 1.5.6, setuptools 12.2:
>
> - pip3 install -e . (this is recommended by the python packaging guide for
> development installs rather than using "python3 setup.py install" directly)
> - pip3 install .
> - python3 setup.py install (yes, you get an annoying warning about not
> running it under pip, but everything works)
> - python3 setup.py build_ext -i (copies _parser.so to
> src/python/beancount/parser)
>
> Here's a diff of the changes I had to make. I think the reason you were
> having trouble with _parser.so getting copied to the right place is because
> the first argument to Extension needs to be a python package path, not a
> filesystem path.
>
>
> diff -r b5d8ae469380 setup.py
> --- a/setup.py Mon Oct 05 11:31:52 2015 +0800
> +++ b/setup.py Wed Oct 07 15:36:42 2015 -0700
> @@ -18,7 +18,7 @@
>
>  # Import setup().
>  setup_extra_kwargs = {}
> -from distutils.core import setup, Extension
> +from setuptools import setup, Extension
>
>  # Unused support for setuptools. Setuptools is seriously broken:
>  #
> @@ -132,7 +132,7 @@
>      scripts=install_scripts,
>
>      ext_modules=[
> -        Extension("beancount/parser/_parser",
> +        Extension("beancount.parser._parser",
>                    sources=[
>                        "src/python/beancount/parser/lexer.c",
>                        "src/python/beancount/parser/grammar.c",
> @@ -142,6 +142,13 @@
>
>  '"{}"'.format(hash_parser_source_files()))]),
>      ],
>
> +    install_requires=[
> +        'python-dateutil',
> +        'bottle',
> +        'ply',
> +        'lxml',
> +    ],
> +
>      # Add optional arguments that only work with some variants of setup().
>      **setup_extra_kwargs
>  )
>
>
> Thanks,
> Gary
>
> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/957bf596-26da-4f6b-b72d-512e9d20ce4b%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/957bf596-26da-4f6b-b72d-512e9d20ce4b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to