asottile / dockerfile

Parse a dockerfile into a high-level representation using the official go parser
MIT License
95 stars 18 forks source link

Please provide Windows wheels #156

Closed bindreams closed 11 months ago

bindreams commented 11 months ago

Hi! If this is not too much trouble, please consider distributing windows wheels along with macos and manylinux ones. We'd love to use this package as a dependency in our project but ease of installation is very important to our users.

Thanks!

asottile commented 11 months ago

I can't really - the go toolchain and python target different windows c runtimes

bindreams commented 11 months ago

Sorry I'm a bit of a noob when it comes to runtimes and binary compatibility, but what you are essentially saying is that it's theoretically impossible?

If so, then I'm fairly sure you're mistaken. For example, when I install the package on windows with go pre-installed, pip builds wheels just fine. Also I just tried to manually build wheels and it went fine. (see console log)

console log ``` PS [...]> git clone https://github.com/asottile/dockerfile Cloning into 'dockerfile'... remote: Enumerating objects: 771, done. remote: Counting objects: 100% (235/235), done. remote: Compressing objects: 100% (126/126), done. remote: Total 771 (delta 126), reused 183 (delta 103), pack-reused 536 Receiving objects: 100% (771/771), 192.28 KiB | 9.16 MiB/s, done. Resolving deltas: 100% (398/398), done. PS [...]> cd .\dockerfile\ PS [...]\dockerfile> ls Directory: [...]\dockerfile Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 25.07.2023 16:48 .github d---- 25.07.2023 16:48 pylib d---- 25.07.2023 16:48 testfiles d---- 25.07.2023 16:48 tests -a--- 25.07.2023 16:48 62 .gitignore -a--- 25.07.2023 16:48 1429 .pre-commit-config.yaml -a--- 25.07.2023 16:48 137 go.mod -a--- 25.07.2023 16:48 1078 LICENSE -a--- 25.07.2023 16:48 41 MANIFEST.in -a--- 25.07.2023 16:48 2775 parse_test.go -a--- 25.07.2023 16:48 2416 parse.go -a--- 25.07.2023 16:48 2661 README.md -a--- 25.07.2023 16:48 57 requirements-dev.txt -a--- 25.07.2023 16:48 1065 setup.cfg -a--- 25.07.2023 16:48 893 setup.py -a--- 25.07.2023 16:48 334 tox.ini PS [...]\dockerfile> pip install wheel setuptools Requirement already satisfied: wheel in [...]\appdata\local\programs\python\python311\lib\site-packages (0.40.0) Requirement already satisfied: setuptools in [...]\appdata\local\programs\python\python311\lib\site-packages (65.5.0) PS [...]\dockerfile> python setup.py sdist bdist_wheel [...]\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer. warnings.warn( running sdist running egg_info creating dockerfile.egg-info writing dockerfile.egg-info\PKG-INFO writing dependency_links to dockerfile.egg-info\dependency_links.txt writing top-level names to dockerfile.egg-info\top_level.txt writing manifest file 'dockerfile.egg-info\SOURCES.txt' reading manifest file 'dockerfile.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE' writing manifest file 'dockerfile.egg-info\SOURCES.txt' running check creating dockerfile-3.2.0 creating dockerfile-3.2.0\dockerfile.egg-info creating dockerfile-3.2.0\pylib copying files to dockerfile-3.2.0... copying LICENSE -> dockerfile-3.2.0 copying MANIFEST.in -> dockerfile-3.2.0 copying README.md -> dockerfile-3.2.0 copying go.mod -> dockerfile-3.2.0 copying parse.go -> dockerfile-3.2.0 copying parse_test.go -> dockerfile-3.2.0 copying setup.cfg -> dockerfile-3.2.0 copying setup.py -> dockerfile-3.2.0 copying dockerfile.egg-info\PKG-INFO -> dockerfile-3.2.0\dockerfile.egg-info copying dockerfile.egg-info\SOURCES.txt -> dockerfile-3.2.0\dockerfile.egg-info copying dockerfile.egg-info\dependency_links.txt -> dockerfile-3.2.0\dockerfile.egg-info copying dockerfile.egg-info\top_level.txt -> dockerfile-3.2.0\dockerfile.egg-info copying pylib\main.go -> dockerfile-3.2.0\pylib copying pylib\support.c -> dockerfile-3.2.0\pylib Writing dockerfile-3.2.0\setup.cfg creating dist Creating tar archive removing 'dockerfile-3.2.0' (and everything under it) running bdist_wheel running build running build_ext $ GOPATH='[...]' go get -d go: downloading github.com/moby/buildkit v0.9.0 go: downloading github.com/pkg/errors v0.9.1 go: downloading github.com/golang/protobuf v1.5.2 go: downloading github.com/containerd/typeurl v1.0.2 go: downloading github.com/gogo/protobuf v1.3.2 go: downloading google.golang.org/protobuf v1.26.0 $ CGO_CFLAGS='-I[...]\AppData\Local\Programs\Python\Python311\include -I[...]\AppData\Local\Programs\Python\Python311\Include -DPy_LIMITED_API' CGO_LDFLAGS='-L[...]\AppData\Local\Programs\Python\Python311\libs -lpython311' GOPATH='[...]' go build -buildmode=c-shared -o '[...]\dockerfile\build\lib.win-amd64-cpython-311\dockerfile.pyd' '-ldflags=-s -w' [...]\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( installing to build\bdist.win-amd64\wheel running install running install_lib creating build\bdist.win-amd64 creating build\bdist.win-amd64\wheel copying build\lib.win-amd64-cpython-311\dockerfile.h -> build\bdist.win-amd64\wheel\. copying build\lib.win-amd64-cpython-311\dockerfile.pyd -> build\bdist.win-amd64\wheel\. running install_egg_info Copying dockerfile.egg-info to build\bdist.win-amd64\wheel\.\dockerfile-3.2.0-py3.11.egg-info running install_scripts [...]\AppData\Local\Programs\Python\Python311\Lib\site-packages\wheel\bdist_wheel.py:100: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")): creating build\bdist.win-amd64\wheel\dockerfile-3.2.0.dist-info\WHEEL creating 'dist\dockerfile-3.2.0-cp311-cp311-win_amd64.whl' and adding 'build\bdist.win-amd64\wheel' to it adding 'dockerfile.h' adding 'dockerfile.pyd' adding 'dockerfile-3.2.0.dist-info/LICENSE' adding 'dockerfile-3.2.0.dist-info/METADATA' adding 'dockerfile-3.2.0.dist-info/WHEEL' adding 'dockerfile-3.2.0.dist-info/top_level.txt' adding 'dockerfile-3.2.0.dist-info/RECORD' removing build\bdist.win-amd64\wheel ```

Now I see a dockerfile-3.2.0-cp311-cp311-win_amd64.whl in my dist folder.

asottile commented 11 months ago

yeah and if you try and install it and import it?

asottile commented 11 months ago

and copy it to a machine that doesn't have go installed and run it?

bindreams commented 11 months ago

Just did what you said in a fresh windows vm, it worked for me (parsed a dockerfile and everything)

asottile commented 11 months ago

I wonder which camp switch compiler toolchains 🤔 this did not used to work -- we'll see if I can get CI to do it here (though I doubt I'll be able to provide 32-bit windows wheels) #157

asottile commented 11 months ago

couldn't get it to link -- so I'm not sure who your setup is working