Comments (12)
Please show your config and exact directory structure.
from hatch.
Please show your config and exact directory structure.
https://github.com/airopi/minesweeper
I tested with exactly the same pyproject.toml
and the same directory structure except with:
minesweeper.py
py.typed
Instead of:
minesweeper/
├── __init__.py
├── minesweeper.py
└── py.typed
Which gave me the stub files missing error.
And tested with
minesweeper/
├── minesweeper.py
└── py.typed
Which wasn't working at all. (Don't correspond to any of https://hatch.pypa.io/1.9/plugins/builder/wheel/#default-file-selection)
I tried to manually specify the minesweeper.minesweeper file but I couldn't do it.
from hatch.
The config file is not formatted properly so I cannot test. Can you please fix that? In any case, you could probably achieve what you want with the following: https://hatch.pypa.io/latest/config/build/#rewriting-paths
from hatch.
The config file is not formatted properly so I cannot test. Can you please fix that? In any case, you could probably achieve what you want with the following: https://hatch.pypa.io/latest/config/build/#rewriting-paths
Thanks, I will check that!
On my side, I don't have any issue with the config file, so I don't really know what to fix 😬
from hatch.
Interesting! When viewed on GitHub the formatting was all broken and there was messed up syntax highlighting because of that but now it's fixed somehow...
from hatch.
Ok with these configs, I am able to resolve the missing stubs files problem while have a singlefile package at root:
[tool.hatch.build.targets.wheel]
include = ["py.typed", "minesweeper.py"]
[tool.hatch.build.targets.wheel.sources]
"" = "minesweeper"
However, this implies to use minesweeper.minesweeper.xxx
instead of minesweeper.xxx
because the module is not directly in site-packages
, which is the case if we don't care about py.typed
.
This looks like a PEP561 limitation, but the typing_extensions
package is directly inside site-packages
without stub files issue. But maybe it is a special exception for this package, due to its utility.
By the way, the warning is raised by Pylance inside VSCode (when minesweeper.py is directly under site-packages
like typing_extensions.py
)
from hatch.
What you could do is have two remappings to the direct location and for the code make that be minesweeper/__init__.py
.
from hatch.
typing_extensions doesn't declare a py.typed as far as I can tell? What is the reason for thinking the desired goal can be achieved?
from hatch.
Ok I just founded this : python/typing#1297, my assumption was correct.
How can I map minesweeper.py
to minesweeper/__init__.py
(if this is possible)? I only see how to map directories, not files.
Otherwise, I will just keep the current structure 🤷 which works fine, but adds a useless folder.
from hatch.
https://hatch.pypa.io/latest/config/build/#forced-inclusion
[tool.hatch.build.targets.wheel.force-include]
"minesweeper.py" = "minesweeper/__init__.py"
"py.typed" = "minesweeper/py.typed"
from hatch.
Thank you! For the help and for the quick response.
This was exactly what I was looking for, it works like a charm.
from hatch.
Happy to help!
from hatch.
Related Issues (20)
- Rename the main development branch? HOT 1
- Context formatting of project.dependencies is not standard compliant? HOT 7
- Interoperability with Lmod
- Consider moving cache to build directory or as development feature only
- Persistent dynamic core metadata breaks user assumptions HOT 47
- `hatch build -t wheel:editable` fails HOT 6
- Custom hook dependencies specified in `pyproject.toml` are no longer installed HOT 5
- Hatch run with invalid pyproject.toml fails with exit code 0 HOT 1
- Install a package from apt or source HOT 1
- Support for PEP 514 (Python registration in the Windows registry) in `hatch python install` HOT 1
- Running hatch build doesn't produce any executables, only wheel and stdist. HOT 15
- Hatch config set not working with pyproject.toml HOT 3
- Docs releases are tied to hatch version, not hatchling HOT 2
- Full feature/extra support HOT 2
- Feature: Pass version to custom metadata hook
- Feature: Support dynamic `optional-dependencies` in `hatch env` HOT 2
- hatch commands do not handle case-insensitive paths as cwd on Windows HOT 3
- Composite license expressions in template.licenses do not result in multiple licenses HOT 4
- `post-install-commands` are run before installing environment dependencies HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hatch.