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

pyinfra v3 WIP #996

Merged
merged 12 commits into from
Jan 23, 2024
Merged

pyinfra v3 WIP #996

merged 12 commits into from
Jan 23, 2024

Conversation

Fizzadar
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Oct 8, 2023

Codecov Report

Merging #996 (0b0c5da) into 2.x (441160f) will decrease coverage by 1.37%.
The diff coverage is 87.84%.

@@            Coverage Diff             @@
##              2.x     #996      +/-   ##
==========================================
- Coverage   91.61%   90.24%   -1.37%     
==========================================
  Files         127      129       +2     
  Lines        8180     8222      +42     
==========================================
- Hits         7494     7420      -74     
- Misses        686      802     +116     
Files Coverage Δ
pyinfra/api/arguments.py 97.87% <100.00%> (+0.50%) ⬆️
pyinfra/api/connect.py 95.45% <100.00%> (ø)
pyinfra/api/connectors.py 100.00% <100.00%> (ø)
pyinfra/api/deploy.py 89.74% <100.00%> (-2.99%) ⬇️
pyinfra/api/inventory.py 93.45% <100.00%> (+2.54%) ⬆️
pyinfra/connectors/terraform.py 100.00% <100.00%> (ø)
pyinfra/context.py 92.30% <100.00%> (+0.09%) ⬆️
pyinfra/facts/docker.py 100.00% <100.00%> (ø)
pyinfra/facts/files.py 99.24% <100.00%> (+<0.01%) ⬆️
pyinfra/facts/git.py 97.43% <100.00%> (+0.06%) ⬆️
... and 71 more

@DonDebonair
Copy link
Contributor

Hey @Fizzadar, after getting increasingly frustrated with Ansible over the past months, I was researching alternatives and found PyInfra. I'm inclined to try it out, but I noticed this draft PR which seems to suggest V3 is being actively worked on.

Can you elaborate how much V3 will differ from V2 in terms of API? How smooth will the migration path from stable to V3 be? In other words: is it safe start using the stable version of PyInfra right now with a relatively smooth upgrade to V3 once it hits?

I'm also interested in contributing. I saw that there are no Docker/Docker Compose related operations yet, and I need those. But it would be a problem if the API is going to change significantly and operations need to be changed a lot for V3.

Could you elaborate?

@Fizzadar
Copy link
Member Author

Hey @Fizzadar, after getting increasingly frustrated with Ansible over the past months, I was researching alternatives and found PyInfra. I'm inclined to try it out, but I noticed this draft PR which seems to suggest V3 is being actively worked on.

Can you elaborate how much V3 will differ from V2 in terms of API? How smooth will the migration path from stable to V3 be? In other words: is it safe start using the stable version of PyInfra right now with a relatively smooth upgrade to V3 once it hits?

I'm also interested in contributing. I saw that there are no Docker/Docker Compose related operations yet, and I need those. But it would be a problem if the API is going to change significantly and operations need to be changed a lot for V3.

Could you elaborate?

Hi @DonDebonair! Apologies for taking ages to respond here. Ultimately for the public stuff (ie anything in the docs) there should be no significant changes. Any changes will display a warning in v2. The majority of v3 changes are in the CLI (approval step by default) and internal APIs. I am intending for v3 to provide official support for API usage as well (which v1 had).

So in short: migration between v2/v3 should be trivial in almost every case, any changes needed will show as warnings in v2.

Final thing - for operations there’s no significant change to those APIs so any ops designed for 2 will work in 3 (and any contributions would be very welcomed on both versions!)

Hope this helps!

@DonDebonair
Copy link
Contributor

DonDebonair commented Nov 24, 2023

Hey @Fizzadar thanks for the response! I will start using PyInfra then. Do you want new operations - like for example ops to manage docker containers and images and interact with docker compose - to be part of this repo, or should they live somewhere separate? When I'm ready to contribute, I can make a PR to this or another repo

@Fizzadar Fizzadar force-pushed the v3 branch 4 times, most recently from be95209 to cf7955c Compare January 13, 2024 12:01
@Fizzadar
Copy link
Member Author

Github please will you run the workflow!

@Fizzadar Fizzadar force-pushed the v3 branch 2 times, most recently from ccce6d7 to 81d71f2 Compare January 14, 2024 19:17
This should enable type checking user code calling deploy wrapped functions
better, but means the wrapper has to be called `@deploy()` style.
Never used and now in v3 will become impossible to implement, which is
just fine since performance has pushed along in other areas.
Not my finest moment!
This is no longer required with the v3 eval-facts-at-runtime changes!
Fizzadar and others added 5 commits January 21, 2024 12:46
This is no longer required with the v3 eval-facts-at-runtime changes!
* Add types to get_fact and some facts

* Fix typing on default `FactBase.process` return value

* Fix mypy errors

* Inline metaclass=FactNameMeta

* Add types to get_fact and some facts

* import TypedDict if TYPE_CHECKING

* typing.Literal new in Python 3.8

* FactBase[Optional[str]] if TYPE_CHECKING

* Fix remaining type issues

* Remove unused imports

* Final type fixes for older Pythons

* Final final fix

* Skip operation error test on Windows

The operation itself isn't available on Windows `@local` targets.

---------

Co-authored-by: Nick Barrett <[email protected]>
@Fizzadar Fizzadar changed the base branch from 2.x to 3.x January 23, 2024 21:13
@Fizzadar Fizzadar merged commit fcf631d into 3.x Jan 23, 2024
21 checks passed
@Fizzadar Fizzadar deleted the v3 branch January 23, 2024 21:13
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 this pull request may close these issues.

3 participants