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

missing _version.py after package installation #1089

Open
Borda opened this issue Nov 25, 2024 · 5 comments
Open

missing _version.py after package installation #1089

Borda opened this issue Nov 25, 2024 · 5 comments

Comments

@Borda
Copy link

Borda commented Nov 25, 2024

Hello, I may have a silly question but could find a solution. We wanted to use this package version but for some reason, the generated _version.py file is missing the insulation. I have checked and when I build the package the file is there but after installing when I wrap the import with try/expect and list files in the root module the file is missing

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/runner/work/.../sdk/__init__.py", line 47, in <module>
    raise RuntimeError(f"The version file is missing.\n {list_files}")
RuntimeError: The version file is missing.
 ['job', 'py.typed', 'api', 'utils', 'helpers.py', '__init__.py', '__pycache__', 'constants.py', 'cli']

so I have also added the file to MANIFEST.in

include sdk/_version.py

and mention it in package data - pyproject.toml

[tool.setuptools]
include-package-data = true

[tool.setuptools.package-data]
"sdk" = ["_version.py"]
@RonnyPfannschmidt
Copy link
Contributor

Please include the configuration of setuptools_scm in the question

Version files are a opt in

@Borda
Copy link
Author

Borda commented Nov 26, 2024

this is the configuration from pyproject.toml

[build-system]
requires = ["setuptools>=64", "setuptools-scm>=8", "build"]
build-backend = "setuptools.build_meta"

[project]
...
dynamic = ["version"]

[project.scripts]
lightning = "sdk.cli.entrypoint:main_cli"

[tool.setuptools_scm]
version_file = "sdk/_version.py"

[tool.setuptools]
include-package-data = true

[tool.setuptools.package-data]
"sdk" = ["_version.py"]

[tool.setuptools.packages.find]
exclude = ["tests*", "examples*"]

@RonnyPfannschmidt
Copy link
Contributor

There's need for extra details

Based on the provided information things should work

@Borda
Copy link
Author

Borda commented Nov 26, 2024

There's need for extra details

sure, but what kind of information would be helpful...
so this is an error with CI and we uploaded the very same package as the job artifact, so when we install the package locally all seems to work fine but when it is installed with CI it crashes for missing file...

@RonnyPfannschmidt
Copy link
Contributor

whats helpful
is unclear as i have no idea about the origin of the issue - the provided information so far seems to imply correctness - which is not observed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants