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

Add developer install instructions #1223

Open
banesullivan opened this issue Nov 29, 2021 · 10 comments
Open

Add developer install instructions #1223

banesullivan opened this issue Nov 29, 2021 · 10 comments

Comments

@banesullivan
Copy link

banesullivan commented Nov 29, 2021

pip install -e .

does not work on Python 3.8 after cloning

$ pip install -e .
ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /Users/bane/Software/external/meshio
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)
>>> import scooby
>>> scooby.Report(['setuptools', 'distutils'])

--------------------------------------------------------------------------------
  Date: Mon Nov 29 11:40:24 2021 MST

                OS : Darwin
            CPU(s) : 16
           Machine : x86_64
      Architecture : 64bit
       Environment : Python

  Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:12:38)
  [Clang 11.0.1 ]

        setuptools : 49.6.0.post20210108
         distutils : 3.8.8
             numpy : 1.20.2
             scipy : 1.6.3
           IPython : 7.22.0
        matplotlib : 3.4.1
            scooby : 0.5.7
--------------------------------------------------------------------------------

It appears the setup.py was removed (without warning?) in #795

Since the typical way of installing isn't working, there should be an explanation of the usage of setup.cfg in the README and how to install this locally

@nschloe
Copy link
Owner

nschloe commented Nov 29, 2021

I just use tox for testing and install it with from pypi or pip install ..

@banesullivan
Copy link
Author

banesullivan commented Nov 29, 2021

But then you cannot edit the source and it be reflected in the environment. For example check this out:

I updated the init of meshio with this diff (after installing):

diff --git a/src/meshio/__init__.py b/src/meshio/__init__.py
index 035ae53..36c81ae 100644
--- a/src/meshio/__init__.py
+++ b/src/meshio/__init__.py
@@ -80,3 +80,5 @@ __all__ = [
     "topological_dimension",
     "__version__",
 ]
+
+print('this has been editted')

But then if I import meshio into Python, I cannot see that change:

$ meshio git:(main) ✗ python
Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:12:38)
[Clang 11.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import meshio
>>>

In order to see the change I have to install it again:

$ meshio git:(main) ✗ pip install .
...
$ meshio git:(main) ✗ python
Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:12:38)
[Clang 11.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import meshio
this has been editted
>>>

Without a setup.py there is no way to do a dev install (AFAIK)

@nschloe
Copy link
Owner

nschloe commented Nov 29, 2021

How about tox?

@banesullivan
Copy link
Author

Well the point is that I want to use meshio in an arbitrary virtual env outside the context of tox and testing. Can the setup.py that was removed in #795 be added back?

@stefsmeets
Copy link
Contributor

Without a setup.py there is no way to do a dev install (AFAIK)

This is also what I found. pip cannot do an editable install without a setup.py, so it seems that setup.cfg/pyproject.toml cannot completely replace setup.py yet.

@nschloe
Copy link
Owner

nschloe commented Dec 23, 2021

For the time being, you could simply add a setup.py locally.

@stefsmeets
Copy link
Contributor

Yep, that's what I did 👍

@banesullivan
Copy link
Author

banesullivan commented Dec 23, 2021

A bit embarrassingly, this took me about an hour to figure out. IMO, meshio should keep a setup.py until the new package config can support editable installations

@banesullivan
Copy link
Author

Or at least dev install instructions outlining the need for this file

@nschloe
Copy link
Owner

nschloe commented Dec 23, 2021

IMO, meshio should keep a setup.py until the new package config can support editable installations

Fair enough, fair enough. I'll add one.

goxberry added a commit to goxberry/meshio that referenced this issue May 9, 2022
This commit adds a 2-line (3-line, if you count the blank line)
`setup.py` script that provides the bare minimum needed to support
packaging with `setuptools`, e.g.:

```shell
python3 setup.py sdist bdist_wheel
```

This basic `setup.py` should also support editable installations,
as requested in nschloe#1223.

The basic rationale for `setuptools` packaging is for high-performance
computing sites that lag behind in software tooling. While projects
like Spack help update this tooling to permit updating sometimes
ancient toolchains, HPC site policies -- including the HPC site I
work at -- sometimes require repackaging Python packages from source
for internal approval and security auditing, as well as for portable
installation to air-gapped machines.

While I completely agree that `setup.py` is a relic -- and to that
effect, just spent a few hours adding source code and binary wheel
installations of `flit_core`, `flit`, `pep517`, and `build` to my HPC
site for approval -- it's much, much easier to point to upstream code
than it is to have to figure out that these lines must be added for
bespoke packaging, add them, look through project documentation like
`CONTRIBUTING.md`, discover through looking at pull requests and
issues on GitHub that such a pull request may not be accepted, and
then figure out how to pass that information on to security auditors
and colleagues.

If this solution is unacceptable, I welcome other suggestions,
including writing a statement to the effect of "Pull requests adding a
`setup.py` file will not be accepted to this repository" somewhere in
documentation, along with the suggested solution of adding

```python
from setuptools import setup

setup()
```

or similar to a local copy of the repository so as to avoid the sorts
of discussions seen in nschloe#1224.
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

Successfully merging a pull request may close this issue.

3 participants