[11:39:34] <frederfred> If maintaining a private repo, is the only "safe" way of falling back to PyPI when installing packages to use a proxying private repo?
[11:40:40] <frederfred> For instance if creating packages for ACME corp. and uploading them to a private repo using the namespace acme (acme.foopkg etc.).
[11:44:43] <frederfred> AIUI, if using --extra-index-url, there's the possibility that someone could create a dist. on PyPI with the same name as an internal dist. and a higher version, which would be then chosen in preference to the "real" company-internal dist. And it seems there's no way to register an organisational namespace on PyPI - even if ACME uploads acme.foopkg, someone else could upload acme.barpkg tomorrow, correct?
[11:57:43] <pradyunsg> frederfred: FYI -- a discussion on namespacing on PyPI -- https://discuss.python.org/t/namespace-support-in-pypi/1609/35
[11:59:01] <frederfred> pradyunsg yeah I'm already reading my way through that haha
[11:59:23] <pradyunsg> frederfred: i linked to a comment that's a pretty good summary.
[12:01:51] <frederfred> Yeah, so much as I surmised then!
[12:02:12] <frederfred> So are there any "safe" alternatives to a proxying repo?
[12:02:58] <frederfred> E.g. pip alternatives that allow for switches/config. for how to select between multiple packages with the same name from different repos?
[12:03:04] <pradyunsg> frederfred: I don't know if devpi/any-other-OSS-python-index-proxy tool has support for conditional fallbacks and what the current recommendation should/would be -- consider poking that thread to ask if anyone came around to point 3 from that summary.
[12:03:11] <frederfred> (Which the proxying private repo is just a hack for really)
[14:24:20] <pyusr> can I use [build-system] in setup.cfg ?
[14:25:42] <pyusr> seems no... so I need yet another file :/... I already have setup.py so I rather not have another file, is doing that bad (it works)
[14:36:37] <nedbat> pyusr: what happened to using tox?
[14:38:18] <pyusr> it complaint about not having cython as a dependency and I got side-tracked into figuring what's the best way to fix that..
[14:45:58] <pyusr> toad_polo: https://github.com/statsmodels/statsmodels/blob/master/pyproject.toml I did something like that but pip install -e . doesn't install cython ?
[14:49:48] <pyusr> the amazing stuff is that stackoverflow is filled with questions on how to get cython as a dependency for installation (with no real help)
[14:50:33] <pyusr> ohh, hmm.. my venv had an old setuptools / pip, trying again
[14:55:40] <toad_polo> I think you should still add `build-backend="setuptools.build_meta"`, but that should work.
[14:57:49] <toad_polo> I just created a test project and `pip install .` and `pip install -e .` both work when Cython is included in the build requirements.
[14:58:00] <toad_polo> If I remove it from the build requirements both fail.
[14:58:56] <pyusr> all I have to do is put pyproject.toml in my main dir with [build-system] requires=["cython"] ?
[14:59:32] <toad_polo> No you also need `"setuptools"` and `"wheel"`.
[15:00:41] <pyusr> yeah, tried that as well :/ i'll try a demo one like you did and see if it works!
[15:01:31] <toad_polo> Is your project on github or something/
[15:02:06] <pyusr> the cython based version not yet, I'll upload it, sec
[15:05:02] <pyusr> (don't try to run it or follow the README.md examples, I haven't finished working on them, as I'm trying to get the packaging and coverage testing to work now)
[15:05:28] <gnomeza> pyusr: virtualenv will (sometimes?) install (old) hardcoded pip and setuptools versions. Update virtualenv first.
[15:05:41] <pyusr> gnomeza: yeah I figured that and did it
[15:06:04] <gnomeza> There was also a virtualenv option to prevent that, was it --no-download?
[15:06:35] <gnomeza> pip within virtualenv must be >18 for it to pick up pyproject.toml, iirc
[15:07:06] <toad_polo> pyusr: How is it failing for you?
[15:58:58] <pyusr> that gives me on running tox: ERROR: missing build-backend key at build-system section inside /home/user/Desktop/chunkedbuffer/pyproject.toml
[16:02:35] <pyusr> yey, fixed that, now I get: ValueError: 'chunkedbuffer/*.pyx' doesn't match any files
[16:37:03] <pyusr> any idea how to make it "see" the pyx files ?
[16:51:57] <ngoldbaum> if i were in your shoes i’d look around the place in the cython codebase where that error is getting raised to try and understand what’s up
[16:52:36] <ngoldbaum> usually if a build fails in the tox virtualenv it means something is fucky with the way you’re installing the package
[16:52:51] <ngoldbaum> is the cython code in MANIFEST.in, for examole?
[16:53:17] <ngoldbaum> tix is great for ferreting out packaging bugs you don’t notice if most of the time you work from a clone of a repo
[16:53:27] <ngoldbaum> s/tix/tox i hate phone keyboards
[16:55:27] <pyusr> ngoldbaum: yes pip install -e . works perfrectly outside of tox https://github.com/tzickel/chunkedbuffer/tree/blah
[16:59:29] <pyusr> ngoldbaum: thanks ! one more step
[16:59:43] <pyusr> now I'll see how to enable that line tracing
[17:50:59] <pyusr> hmm... can anybody tell me what I've missing on why tox isn't showing me the .pyx files ?
[17:51:36] <pyusr> the dir /home/user/Desktop/chunkedbuffer/.tox/py36/lib/python3.6/site-packages/chunkedbuffer has only the *.so files not the .pyx is that the issue ? if so how to fix it ?
[17:53:48] <pyusr> (the source is updated in the link above)
[18:03:13] <pyusr> welp, found a solution, if I change the coverage test to use_develop and change --cov dir, it works :/
[18:05:28] <pyusr> toad_polo: I would agree, but unless you have a good idea on how to make that URL I linked work, it's the best option I've got
[18:05:49] <pyusr> I think the issue is that the .pyx files aren't copied to the virtualenv dir
[18:06:40] <toad_polo> One of the bigger problems is that you won't be testing "as installed", even if you switched to a src/ directory: https://blog.ganssle.io/articles/2019/08/test-as-installed.html
[18:07:14] <toad_polo> If you follow all that advice in the blog post and use `usedevelop`, because of the way `usedevelop` works, you get all the same problems.
[18:08:05] <pyusr> toad_polo: I would agree, but since I find 0 coherent documentation on how to properly do stuff like this, I don't know what to do / say
[18:08:24] <toad_polo> I spent a huge amount of time setting this up for a C project and I have not had time to write it up.
[18:08:31] <pyusr> I agree it's stupid and mad and annoying to search in github for repo that have cython and coverage support, and try random stuff
[18:08:33] <toad_polo> What is doing the code coverage? Just coverage?
[18:16:47] <pyusr> heh, on that blog you linked, there is an article related to the library I'm working on: https://blog.ganssle.io/articles/2019/11/string-concat.html
[18:16:52] <toad_polo> Or alternatively: https://discuss.python.org/c/packaging/14
[18:18:40] <pyusr> thanks for all the help getting me back to atleast able to write testing for my code !
[18:27:08] <toad_polo> pyusr: Yeah, the tox maintainers will see it if you put it either of those places.
[18:27:20] <toad_polo> It's not a tox problem at its core, though.
[19:15:14] <toad_polo> I don't think you want that.
[19:15:50] <toad_polo> I mean, maybe you want it in some alternate version build that requires debugging, but I'm not sure what the point of actually including them in the package is.
[19:15:52] <toad_polo> They just need to go in the sdist.
[19:17:01] <ngoldbaum> toad_polo: because it seems like the pep 518 build never gets them copied over from the tarball
[19:17:13] <ngoldbaum> so they aren’t present at build time
[19:17:39] <ngoldbaum> so they can be compiled into an .so?
[19:17:46] <pyusr> ngoldbaum: setup(packages=find_packages("chunkedbuffer", include=["*.pyx"]), ext_modules=cythonize("chunkedbuffer/*.pyx", language_level=3, force=True, compiler_directives={'linetrace': True})) or am I doing it wrong ?
[19:18:06] <toad_polo> As long as they go in the tarball it's fine.
[19:18:08] <ngoldbaum> i think you just need find_packages with no args?
[19:18:21] <ngoldbaum> ok well pyusr isn’t seeing that apparently
[19:19:46] <toad_polo> I have no idea what is happening here. When I run `pep517.build -s .` on this, it's generating a tarball that includes random stuff.
[19:19:50] <pyusr> setup(packages=find_packages(), ext_modules=cythonize("chunkedbuffer/*.pyx", language_level=3, force=True, compiler_directives={'linetrace': True})) ofcourse no go as well
[19:20:20] <pyusr> ngoldbaum: would be nice to show me a repo where you have this, or tell me exactly what to do instead of me keep guessing this
[19:26:23] <pyusr> btw, I've copied it from a big project (the usedevelp to get coverage working): https://github.com/statsmodels/statsmodels/blob/master/tox.ini
[19:27:36] <toad_polo> Interestingly this works fine when I pip install it.
[19:28:13] <pyusr> when you pip install, where do you run the coverage from ?
[19:43:21] <toad_polo> The other stuff is also useful. Depending on what class of errors you want to protect against, switching to a `src/` layout and explicitly doing the recursive-include for the src/ and tests/ directories would probably be safest.
[19:43:59] <pyusr> ok, now it builds, but .pyx files are still not in /home/user/Desktop/chunkedbuffer/.tox/py36/lib/python3.6/site-packages/chunkedbuffer
[19:44:04] <pyusr> should I look for it somewhere else ?
[19:48:35] <pyusr> is this the correct tox.ini command: commands = pytest --cov={toxinidir}/chunkedbuffer --cov={toxinidir}/tests --cov-append --cov-report=term-missing {posargs}
[19:49:59] <pyusr> is this a bug in coverage or something else not configured properly ?
[19:50:48] <pyusr> I've updated the repo, now running tox shows wrongly coverage
[19:51:08] <pyusr> (but atleast the .pyx show up, and it builds properly without shaningens)
[19:51:34] <pyusr> btw, where is that "chunkedbuffer" dir in my disk now ?
[19:55:16] <toad_polo> pyusr: When I ran it I got "100% coverage" but for `__init__.py` and `test_buffers.py`, the pyx files didn't show up.
[19:55:18] <toad_polo> They don't show up in the site-packages directory because they aren't being installed, because they're not code you can run, they need to be compiled - only the compiled artifacts get installed.
[19:56:07] <pyusr> toad_polo: did you try to clone the latest repo ? they do show up now
[19:56:11] <toad_polo> They don't need to be installed, but in this case I guess you want them to be installed because the coverage plugin expects them to be next to the `.so` files (which will happen if you use `usedevelop`).
[19:56:44] <pyusr> yes, we've been in this discussion witih ngoldbaum before, but this isn't what is happening
[19:57:50] <toad_polo> Why is `isolated_build` commented out in the latest version?
[19:58:06] <pyusr> because when I added the pyproject.toml to MANIFEST.in it fixedit
[20:10:01] <toad_polo> It seems weird to me that it would be that slow for ~500 lines of Cython.
[20:10:20] <pyusr> toad_polo: I did recursive-exclude * *.egg-info/ but it's still there
[20:10:55] <toad_polo> I expect it to be slower than incremental builds (which aren't used as an unfortunate side-effect of the way pip works right now), but for something this small it shouldn't be so bad.
[20:11:07] <toad_polo> pyusr: I wouldn't get hung up on it.
[20:11:19] <toad_polo> Open an issue on your repo to look into it, it's not going to hurt anything I don't think.
[20:11:19] <pyusr> k, it's not like someone is gonna use this code anytime soon anyhow :)
[20:12:29] <pyusr> well, now I can go to sleep, knowing tomorrow I can work on coverage finally :)