ansys / pyansys

Delivering PyAnsys libraries as a bundle
https://docs.pyansys.com
MIT License
141 stars 81 forks source link

Migration to setup.py #755

Open moe-ad opened 2 days ago

moe-ad commented 2 days ago

A number of files (e.g. pyproject.toml, links.py, examples.rst to name a few) have to be edited manually each time there is a new addition/subtraction to/from the pyansys metapackage. This issue will address removing this manual process by:

  1. Adding a new file (a .yml for example) which will be the only data source that will need maintenance.
  2. Creating a setup.py that will update every other file automatically as needed.
RobPasMue commented 2 days ago

I raised my concerns to @jorgepiloto yesterday... I don't think this is a good idea since it will make this Python package to no longer work as a normal, modern Python package, and also dependabot will probably stop working properly...

I know it is time consuming and implies touching a lot of places whenever a new library is added but I wouldn't move from pyproject.toml to setup.py. Most of the affected files are typically in the docs. We could restrict this "new file" approach only to the documentation if you prefer but still, there are many nuances to take into account...

greschd commented 2 days ago

I raised my concerns to @jorgepiloto yesterday... I don't think this is a good idea since it will make this Python package to no longer work as a normal, modern Python package, and also dependabot will probably stop working properly.

Agreed, this is a step backwards with respect to this being a modern Python package.

As a simple quality-of-life improvement, a pre-commit hook which either checks or updates the various places (taking pyproject.toml as input) might help. This can be a simple Python script which is executed as a local hook.

RobPasMue commented 2 days ago

Yep I agree! That would be a much easier way to handle it. Or a dedicated script that you just run when you need to add a new library.

greschd commented 2 days ago

Something closer to the original suggestion which I'd also consider workable is:

So worst case, you would have to add the library in two places (pyproject.toml, and the source-of-truth file), and get a CI error if they don't match.

RobPasMue commented 2 days ago

Works too =)

moe-ad commented 16 hours ago

Thank you both for your valuable inputs @greschd and @RobPasMue. We will start exploring doing this in a way similar to your suggestions. Once the final solution becomes available, I will tag you both for additional inputs.

jorgepiloto commented 11 hours ago

Let's start by creating the YML file:

projects:

  pymapdl:
    name: ...    
    repository: ...
    thumbnail: ...

  ...

We'll read this from the conf.py and use Jinja to short the content of the RST files.