Commit graph

66 commits

Author SHA1 Message Date
K900
2c5c418746 fix: pull in hooks directly instead of sneaking them in through pythonPackages
This does technically break people that override hooks, but they deserve it.
2022-10-28 00:40:18 +03:00
adisbladis
b95cbe19ab fix build for many wheel packages 2022-10-08 03:23:23 +13:00
adisbladis
e31b5e4d29 mk-poetry-dep: prevent use of output separation
this doesn't work in a lot of cases and I don't see the point for us
to have the split output behaviour.
2022-10-07 23:30:49 +13:00
K900
33db1f30d0 feat: big messy refactoring
- normalize package names to match PEP-503
- don't assume build dependencies on setuptools{,-scm}
- automatically generate overrides for setuptools{,-scm}
- pull known build systems directly from nixpkgs
- fix a bunch of mostly unrelated warnings

Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
2022-10-06 19:54:08 +03:00
Samuel Cormier-Iijima
5ae5d85e56 Fix determining sourceSpec for git dependencies in pyproject.toml
Fixes #702
2022-09-08 16:02:32 -04:00
K900
a6480f2ce6 fix: also ignore typing-extensions when resolving dependencies
Fixes infinite recursion with recent setuptools-scm.
2022-06-28 09:40:15 +03:00
adisbladis
62bab8891f Fix infinite recursion in project with flit-core
Closes #538
2022-02-05 13:54:22 +12:00
adisbladis
9b5fba1b71 Fix cross compilation and add cross test 2022-01-19 04:35:12 +12:00
adisbladis
230e4fbb48 Remove __isBootstrap hack
Since #466 was merged we don't need it anymore.
2022-01-19 02:20:37 +12:00
adisbladis
23be9b3cb0
Merge pull request #466 from cpcloud/remove-bootstrap-poetry
build: remove bootstrap dependency on poetry
2022-01-18 15:18:22 +12:00
László Vaskó
8e1eef3751 fetchGit: use allRefs only when it is needed
If `branch` or `tag` is given in sourceSpec, then `fetchGit` would
work as before, the only problematic setup is `rev` when used with Nix 2.4+
2022-01-18 09:53:24 +12:00
László Vaskó
5c06704d45 fetchGit: work-around bug in Nix 2.4
Another approach to make `poetry2nix` work with dependencies specified
by arbitrary `rev=<hash>` values on newer Nix revisions.

Relates-to: https://github.com/nix-community/poetry2nix/pull/358
Relates-to: https://github.com/NixOS/nix/issues/5128
2022-01-18 09:53:24 +12:00
Phillip Cloud
261d1d5b22
fix: remove buildInput dependency on poetry 2021-12-29 09:32:41 -05:00
Phillip Cloud
2fed7bc910
pip: remove restriction 2021-11-08 08:07:04 -05:00
adisbladis
6457976cf6
Extend setuptools-scm infinite recursion workaround 2021-09-22 22:39:14 -05:00
Phillip Cloud
3fb12decf1
fix: add tomli to recursion list 2021-09-19 09:45:41 -04:00
Rowan Skewes
5cd5f01c90 enable '+' in versions 2021-09-17 17:06:44 +10:00
Niels Kristian Lyshøj Jensen
2eb8329319
Add support for local files 2021-07-10 13:38:34 +02:00
adisbladis
8ca15bdb12
Improve error message in case of a missing suitable source/wheel for a dependency 2021-07-02 04:25:00 -05:00
Antoine Eiche
28fba9f743
Add support to the legacy Pypi API
Some private repositories (such as Devpi) expose the legacy Pypi
API (https://warehouse.pypa.io/api-reference/legacy.html).

This commit adds a dedicated fetcher which basically queries this API
to get the URL pointing to the actual file.

Since Pypi still exposes this API, it has been possible to write a
test that uses this legacy API.

Fixes https://github.com/nix-community/poetry2nix/issues/277.
2021-06-01 16:25:29 -05:00
adisbladis
4b651e043e
Merge pull request #304 from andir/fetch-api
Always fallback to querying the Pypi API when the predicted URL 404s
2021-06-01 16:14:37 -05:00
hlolli
f786624415 fix regex for darwin-aarch64 compatability 2021-05-31 04:15:54 +02:00
Andreas Rammhold
cd693810c3
Always fallback to the Pypi API when fetching sources & wheels
Previously we randomly encountered issues where the Pypi mirror URLs
wouldn't be correct with packages whos first character is frequently
written in upper case (e.g. SqlAlchemy, MarkupSafe, ...). The Pypi
mirrors are aparently not consistent in the naming of the file locations
which lead to random errors after package version bumps.

By falling back to the API lookup (that we already did for wheels) we
can workaround that situation.
2021-05-13 21:48:03 +02:00
Michael Lingelbach
9191fbae30
Ensure ref passed to builtins.fetchGit points to refs/tags/sourceSpec.tag 2021-02-02 12:43:50 +01:00
K900
324cc0cb2a Fix stdenv.platform accesses for latest nixpkgs
This fixes builds being completely broken after:
* https://github.com/NixOS/nixpkgs/pull/110726
* https://github.com/NixOS/nixpkgs/pull/110544

This also fixes poetry2nix on ARM and PowerPC platforms by introducing a
mapping from Nixpkgs targets to manylinux_* machine names and using it
when matching wheels for dependencies.
2021-01-30 20:17:54 +03:00
adisbladis
98e0220502
Use build packages in setup hook
https://github.com/NixOS/nixpkgs/pull/104201 broke this.
2020-11-26 20:28:09 +01:00
Jörg Thalheim
38704165d4
support url source types 2020-11-26 14:51:44 +01:00
adisbladis
ba41e216a6
Fix wheel builds 2020-11-26 14:46:51 +01:00
Daiderd Jordan
4beb2b2941
always include setuptools in buildInputs
When cross compiling setuptools isn't available in the build environment
but needed for eg. python setup.py egg_info.
2020-11-24 23:04:10 +01:00
adisbladis
74d3b4ff1c
Fall back to old behaviour for git references, prefer resolved_reference 2020-10-06 14:44:26 +02:00
yihuang
ef9935c98c
fix "invalid Git revision 'master'" 2020-10-04 14:20:17 +08:00
adisbladis
52a484be33
Reformat with nixpkgs-fmt 1.0.0 2020-10-01 19:08:57 +02:00
adisbladis
99cdaa7cca
mk-poetry-dep: Add pep508 evaluation to dependency selection
Poetry 1.1.0 changed the marker format in https://github.com/python-poetry/poetry/pull/2361
2020-10-01 18:20:59 +02:00
adisbladis
cd604e2384
mk-poetry-dep: Remove redundant pythonPackages argument 2020-10-01 14:35:49 +02:00
adisbladis
10e417df85
Add support for non-pyproject local dependencies
We were previously assuming that pyproject.toml always exists in a
local dependency.

This is not the case for setup.py.
2020-08-21 14:00:35 +02:00
adisbladis
1d41a55f88
Always add Poetry as a build input unless bootstrapping
Currently Poetry does not have a notion of build-time
dependencies (setup-requires) in it's lock file.

When installing a dependency built with Poetry this has to be added
via an override which is really bad UX.

This change always adds Poetry as an interim solution until we have
resolved this in upstream Poetry.
2020-07-14 15:30:07 +02:00
adisbladis
db06bdd6e7
Format with nixpkgs-fmt 0.9 2020-05-19 21:06:02 +01:00
adisbladis
4ebbfdacd1
nixpkgs-fmt broke it's format yet again 2020-04-29 14:12:59 +01:00
Raito Bezarius
54f4afca6d
Enable global preference for wheels for top-level functions 2020-04-29 14:08:21 +01:00
adisbladis
e164fdd78a
Fix semver pythonVersion checks
We're only looking at the major.minor currently. We need to look
major.minor.patch instead.

This is made slighty problematic non-cpython where the patch version
doesn't match. If major.minor is the same for both the Python version
& the derivation version we default to derivation.version otherwise we
set the pythonVersion to pythonVersion major.minor.0.
2020-04-29 13:22:20 +01:00
adisbladis
9dfb080d3f
Add canonicalisation of module names
This shouldn't be required and I think that these are actually
packaging bugs and not something that poetry2nix should really be
concerned with.

Closes #84
2020-04-15 10:24:46 +01:00
adisbladis
b9221f61b5
Automatically build most packages without passing format param
We should never have to use `format = "setuptools"` since pip can
_also_ handle setuptools packages.

This uses a custom pipBuildHook that removes pyproject.toml in case
there is also a setup.py in the same sources.
2020-04-01 00:14:30 +01:00
adisbladis
df8c9819f4
Fix git dependencies on non-default branches
Closes #73
2020-03-27 19:13:12 +00:00
adisbladis
f7e435407e
nixpkgs-fmt all the things (again...) 2020-03-14 23:13:51 +00:00
adisbladis
bb3c2d57d5
Add a default source filter when projectDir is used
Also use the same source filter for path deps.

The default source filter currently filters:
- Filters gitignore (if it exists, non-recursive)
- Filters pycache/pyc files
- Uses cleanSourceFilter to filter out .git/.hg, .o/.so, editor backup files & nix result symlinks
2020-02-29 12:05:23 +00:00
adisbladis
090e2dd957
Add fixup hook
This hook should fix common mistakes like installing `tests` in
site-packages which leads to collisions.
2020-02-28 19:45:23 +00:00
adisbladis
1f413d27c9
Implement a proper fix for #52
We need to check pyproject.toml & poetry.lock constraints
_separately_.

Consider the following scenario:

- `poetry` depends on `tox` which in turn depends on `virtualenv`.

- `poetry` _also_ depends directly on virtualenv, but only for older
python versions.

In this case we don't want `virtualenv` as a direct input to `poetry`
but we _do_ want it as an input for `tox`.
2020-02-28 14:01:46 +00:00
adisbladis
7f7499462f
Set meta.platforms to something reasonable by default 2020-02-28 08:38:36 +00:00
adisbladis
0367b93492
Turn pyproject.toml patching into a hook
We should not be setting pre/post phases as it's counter intuitive
when working with overrides.
2020-02-23 14:37:01 +00:00
Steve Purcell
71cdd20018 Remove "path" dependencies in indirectly referenced packages 2020-02-18 15:58:31 +13:00