Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of inline tables in include on pyproject.toml. #6

Merged
merged 4 commits into from
Apr 26, 2020

Conversation

kasteph
Copy link
Member

@kasteph kasteph commented Mar 27, 2020

Resolves: #8

  • tests
  • documentation here

This PR supports inline tables in the include directive. This is similarly functional to the package directive.

@kasteph kasteph force-pushed the fix/includes branch 2 times, most recently from 6a49b8d to 9f9c96d Compare March 28, 2020 15:00
@kasteph kasteph requested a review from a team March 28, 2020 15:09
@kasteph kasteph force-pushed the fix/includes branch 3 times, most recently from cb519f5 to c6401a2 Compare March 29, 2020 16:48
poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
poetry/core/masonry/utils/module.py Outdated Show resolved Hide resolved
tests/masonry/builders/test_complete.py Outdated Show resolved Hide resolved
@abn abn added the Bug Something isn't working label Apr 1, 2020
@abn
Copy link
Member

abn commented Apr 1, 2020

@stephsamson this should also resolve python-poetry/poetry#2087 correct?

@theunkn0wn1
Copy link

theunkn0wn1 commented Apr 2, 2020

As per our discussion in discord,
The feature I would like to see out of this is to be able to embed resource files into the wheel (and subsequently the installed package) at an arbitrary location.

For instance, in my project i would like to embed the pyproject.toml into the installed sources so the library may access this resource at runtime. I wish to do this to access the version string contained in the pyproject.toml.
Presently, even if the tool.poetry.include directive is used the file does not end up in the installation directory and is consequently not usable to the installed application.

My application has the structure

/
/pyproject.toml
/src/...
/test/...

What I would like to do is copy, at build time, /pyproject.toml to /src/pyproject.toml so it may be included in the wheel and usable a resource via importlib.resources.

import importlib.resources as resources
import toml
import src  # root application package (renames are planned)
package_meta = toml.loads(resources.read_text(src, "pyproject.toml"))
src.__version__ = package_meta['tool']['poetry']['version']

@kasteph kasteph force-pushed the fix/includes branch 2 times, most recently from 0ebf500 to 1df2dc7 Compare April 5, 2020 11:48
@kasteph
Copy link
Member Author

kasteph commented Apr 5, 2020

@stephsamson this should also resolve python-poetry/poetry#2087 correct?

Yes!

poetry/core/json/schemas/poetry-schema.json Outdated Show resolved Hide resolved
poetry/core/json/schemas/poetry-schema.json Outdated Show resolved Hide resolved
poetry/core/json/schemas/poetry-schema.json Outdated Show resolved Hide resolved
poetry/core/json/schemas/poetry-schema.json Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
@kasteph kasteph force-pushed the fix/includes branch 6 times, most recently from e220f8b to 54ab491 Compare April 20, 2020 22:51
poetry/core/factory.py Show resolved Hide resolved
poetry/core/json/schemas/poetry-schema.json Show resolved Hide resolved
poetry/core/json/schemas/poetry-schema.json Outdated Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Show resolved Hide resolved
poetry/core/masonry/builders/sdist.py Outdated Show resolved Hide resolved
poetry/core/masonry/utils/include.py Outdated Show resolved Hide resolved
poetry/core/masonry/utils/include.py Outdated Show resolved Hide resolved
poetry/core/masonry/utils/include.py Outdated Show resolved Hide resolved
poetry/core/masonry/utils/include.py Outdated Show resolved Hide resolved
@kasteph kasteph force-pushed the fix/includes branch 2 times, most recently from e662057 to 1d0c316 Compare April 25, 2020 19:19
Copy link
Member

@abn abn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes

poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Show resolved Hide resolved
poetry/core/masonry/builders/builder.py Outdated Show resolved Hide resolved
poetry/core/masonry/builders/sdist.py Outdated Show resolved Hide resolved
poetry/core/masonry/builders/sdist.py Outdated Show resolved Hide resolved
…ckage` directive.

Unify common logic between WheelBuilder and Builder. Move SDistBuilder logic from Builder to SDistBuilder.
Resolves: #8
Copy link
Member

@abn abn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor improvements suggested in #31

fix/includes: minor improvements
Copy link
Member

@abn abn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused pdb import needs to be removed

tests/masonry/builders/test_complete.py Outdated Show resolved Hide resolved
@abn abn merged commit 356de20 into master Apr 26, 2020
@abn abn deleted the fix/includes branch April 26, 2020 16:11
kadler added a commit to IBM/python-itoolkit that referenced this pull request May 20, 2020
We want to ship various files in the source distribution, but they are
not packages. Including them in the packages option of poetry seemed to
work for building the sdist and wheels, but it broke poetry install.

The correct way to do this was implemented in Poetry with
python-poetry/poetry-core#6. This fix is in an as-yet
unreleased version, unfortunately.
@sdispater sdispater mentioned this pull request Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Including tests dir in sdist breaks install
3 participants