Git Product home page Git Product logo

Comments (6)

wakemaster39 avatar wakemaster39 commented on May 23, 2024 1

You are correct, poetry 1.0.0b8 (latest) works just fine with this. I don't see a reason to clean this up, list of remaining issues in the 1.0 milestone release is getting pretty slim.

Thanks for the help getting me sorted. A great help to have dynamic versioning so I can completely replace my existing build chain away from pipenv and versioneer.

from poetry-dynamic-versioning.

mtkennerly avatar mtkennerly commented on May 23, 2024

Some initial questions:

  • How did you install poetry-dynamic-versioning (pip install or poetry add)? It needs to be installed through pip install in order for the patching mechanism to work.
  • What version of Poetry are you using?

from poetry-dynamic-versioning.

wakemaster39 avatar wakemaster39 commented on May 23, 2024

I did a pip install poetry-dynamic-versioning debug info on poetry is below

07:40 $ poetry debug:info

Poetry
======

 * Version: 0.12.17
 * Python:  3.8.0


Virtualenv
==========

 * Python:         3.8.0
 * Implementation: CPython
 * Path:           /Users/cahurst/code/support-apis/.venv
 * Valid:          True


System
======

 * Platform: darwin
 * OS:       posix
 * Python:   /Users/cahurst/.pyenv/versions/3.8.0

from poetry-dynamic-versioning.

mtkennerly avatar mtkennerly commented on May 23, 2024

I think the root of the problem may just be that Poetry 0.12.17 doesn't support Python 3.8.0, according to sdispater here: python-poetry/poetry#1540 (comment) . I ran into a different error when I tried to reproduce the issue (see below), but I suspect it's all related.

Here's what I tried for testing. Since I'm on Windows, I'm using Vagrant to make a Linux VM with pyenv:

Vagrant.configure('2') do |config|
  config.vm.provider 'virtualbox' do |vb|
    vb.memory = '2048'
    vb.cpus = 2
  end

  config.vm.box = 'ubuntu/bionic64'
  config.vm.provision 'shell', privileged: false, inline: <<~SHELL
    echo 'PATH=$PATH:~/.local/bin' >> ~/.bashrc
    echo 'export PATH="/home/vagrant/.pyenv/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(pyenv init -)"' >> ~/.bashrc
    echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc

    curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

    sudo apt-get update
    sudo apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
  SHELL
end

Then I launch it like this:

vagrant up
vagrant ssh
pyenv install 3.8.0
pyenv global 3.8.0

Now, if I install the same Poetry version you have, Poetry fails to start up at all because it can't find one of its dependencies:

curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
. ~/.poetry/env

$ poetry --help
Traceback (most recent call last):
  File "/home/vagrant/.poetry/bin/poetry", line 12, in <module>
    from poetry.console import main
  File "/home/vagrant/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/home/vagrant/.poetry/lib/poetry/console/application.py", line 6, in <module>
    from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

If I try with the latest prerelease of Poetry, then that works fine:

curl -LO https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
python get-poetry.py --version 1.0.0b8 --yes
. ~/.poetry/env

pip install poetry-dynamic-versioning
git clone https://github.com/mtkennerly/poetry-dynamic-versioning
cd poetry-dynamic-versioning/tests/project
poetry install
poetry build

from poetry-dynamic-versioning.

wakemaster39 avatar wakemaster39 commented on May 23, 2024

Can you try without using pyenv without it being the global interpretter. I worked around the 3.8.0 issue but I also have the same problem with python 3.7.3 To manage which python interpreter I am using, I use a python-version file.

$ pyenv install 3.7.3
$ git clone https://github.com/mtkennerly/poetry-dynamic-versioning
$ cd poetry-dynamic-versioning/
$ echo '3.7.3' > .python-version
$ python --version
          python 3.7.3
$ poetry build
    Creating virtualenv poetry-dynamic-versioning-py3.7 in /Users/cahurst/code/poetry-dynamic-versioning/.venv   
    Building poetry-dynamic-versioning (0.3.1)
     - Building sdist
     - Built poetry-dynamic-versioning-0.3.1.tar.gz

     - Building wheel
     - Built poetry_dynamic_versioning-0.3.1-py3-none-any.whl
$ rm -rf .venv
$ pip install poetry-dynamic-versioning
$ poetry build
    [DistributionNotFound]
    The 'jsonschema' distribution was not found and is required by the application

    build [-f|--format FORMAT]
$ poetry build -vvv
[DistributionNotFound]
The 'jsonschema' distribution was not found and is required by the application

Exception trace:
 /Users/cahurst/.poetry/lib/poetry/_vendor/py3.7/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /Users/cahurst/.poetry/lib/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /Users/cahurst/.poetry/lib/poetry/_vendor/py3.7/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /Users/cahurst/.poetry/lib/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /Users/cahurst/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/base_command.py in run() at line 136
   self.initialize(input_, output_)
 /Users/cahurst/.poetry/lib/poetry/console/commands/env_command.py in initialize() at line 18
   current_env = Env.get(self.poetry.file.parent)
 /Users/cahurst/.poetry/lib/poetry/console/commands/command.py in poetry() at line 62
   return self.get_application().poetry
 /Users/cahurst/.poetry/lib/poetry/console/application.py in poetry() at line 55
   from poetry.poetry import Poetry
 /Users/cahurst/.poetry/lib/poetry/poetry.py in <module>() at line 11
   from .json import validate_object
 /Users/cahurst/.poetry/lib/poetry/json/__init__.py in <module>() at line 4
   import jsonschema
 /Users/cahurst/.poetry/lib/poetry/_vendor/py3.7/jsonschema/__init__.py in <module>() at line 33
   __version__ = get_distribution(__name__).version
 /Users/cahurst/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pkg_resources/__init__.py in get_distribution() at line 481
   dist = get_provider(dist)
 /Users/cahurst/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pkg_resources/__init__.py in get_provider() at line 357
   return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
 /Users/cahurst/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pkg_resources/__init__.py in require() at line 900
   needed = self.resolve(parse_requirements(requirements))
 /Users/cahurst/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pkg_resources/__init__.py in resolve() at line 786
   raise DistributionNotFound(req, requirers)

build [-f|--format FORMAT]

from poetry-dynamic-versioning.

mtkennerly avatar mtkennerly commented on May 23, 2024

Interesting, I can reproduce it with Python 3.7.3 and Poetry 0.12.17, regardless of using pyenv global or a .python-version file. However, if I upgrade Poetry to 1.0.0b2 or newer, then it works. That was the release that converted internally from poetry.poetry.Poetry.create() to poetry.factory.Factory.create_poetry(), so I suppose this issue only happens when the plugin patches the old Poetry.create() in conjunction with using pyenv. I'll try to see if I can figure out why it only happens with pyenv, but in the meantime, could you try with a newer prerelease of Poetry and see if that clears it up for you as well?

from poetry-dynamic-versioning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.