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

Use Poetry as a dependency tool #33

Merged
merged 2 commits into from
Aug 14, 2023

Conversation

aalexfvk
Copy link
Contributor

@aalexfvk aalexfvk commented Aug 9, 2023

  1. Use Poetry as a single tool for environment, dependency managment, building packages and publishing to PyPI.
  2. Use flat source code layout instead of src-layout (like in ch-backup)
  3. Related refactoring

@aalexfvk
Copy link
Contributor Author

aalexfvk commented Aug 9, 2023

https://github.com/yandex/ch-tools/actions/runs/5810475057
Result of running this workflow for version tag pushed

- name: publish to PYPI
if: ${{ matrix.target.ubuntu == 'latest' && startsWith(github.ref, 'refs/tags/') }}
continue-on-error: true
run: make publish
Copy link
Contributor Author

@aalexfvk aalexfvk Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we get "HTTP Error 400: The name 'ch-tools' is too similar to an existing project. See https://pypi.org/help/#project-name for more information."
It looks like it is needed to come up with new name at least for uploading on PYPI
There are already similar names in PYPI search
Because PYPI ignores .,- and _, etc. in names

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try clickhouse-tools.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it. I had to change name in pyproject.toml and in several other places.
And for workflow it's working https://pypi.org/project/clickhouse-tools/.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ch-tools remains as part of different addresses email, repo etc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! clickhouse-tools / ch-tools eventually get available on pypi.

And I think it's OK to not rename everything from ch-tools to clickhouse-tools. At least, do not rush with it.

if: always()
with:
report_paths: 'tests/reports/*.xml'


push_to_dockerhub:
Copy link
Contributor Author

@aalexfvk aalexfvk Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't touched this job. We need to think about what to do with it eventually.
It takes >5 min for each push in the main.
For example, run it by button (allowed only for members of ch-backup team) and/or schedule by cron.

README.md Outdated
Comment on lines 37 to 41
make integration-tests

# integration tests (do not rebuild docker images)
# useful when you didn't change source code
cd tests; behave -D skip_setup
make integration-tests BEHAVE_ARGS="-D skip_setup"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to unify naming of targets in ch-tools and ch-backup.

In ch-backup targets are named test-integration and test-unit.
https://github.com/yandex/ch-backup/blob/8737ac84fe13f82ddb7be37e97b5b9a89fc8e18d/Makefile#L58

I have no preference on naming schema. We can rename targets either here or in ch-backup.

Also it makes sense to unify semantic of targets. In ch-backup the target test-integration implies "-D skip_setup". And there is a logic in makefile that avoid docker image rebuild if there are no source code changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I changed test target names like in ch-backup and added implicit -D skip_setup . As for other changes (manipulation of inetgration testing environments) I'd propose to to add it in a separate PR.

pyproject.toml Outdated
name = "ch-tools"
license = { file = "LICENSE" }
dynamic = ["version", "description"]
version = "2.529.131159744"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be set dynamically using value from version.txt?

And target versioning schema, I suppose, should be based on git tags. Probably with the help of https://github.com/pypa/setuptools_scm. Though this is out of scope of the given PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is updated dynamically here. I accedintally uploaded it after testing bulding deb packages. As for schema and other refinments, I use the current one and it can be changed in the next PRs.

pyproject.toml Outdated
Comment on lines 113 to 118
types-pyOpenSSL = "*"
types-python-dateutil = "*"
types-pyyaml = "*"
types-requests = "*"
types-setuptools = "*"
types-tabulate = "*"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

types-* packages don't make much sense without mypy. So it's worth to add python = ">=3.10" for types-* packages too. This should allow to use up-to-date versions of pyyaml, boto and click. At least in ch-backup it helps - yandex/ch-backup@8a02cad#diff-2b4945591edfeaa4cf4d3f155e66d4b43d1bda7a55d881d5cf3107f1b05abbbc / yandex/ch-backup#26

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Did it.

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@aalexfvk aalexfvk force-pushed the MDB-24641_try_poetry_as_dependency_tool branch 2 times, most recently from 3cc61b2 to 444bb42 Compare August 11, 2023 15:12
Makefile Outdated
@echo 'Bumping version into Debian package changelog'
DEBFULLNAME="Yandex LLC" DEBEMAIL="ch[email protected]" dch --force-bad-version --distribution stable -v `cat version.txt` Autobuild
echo 'Bumping version into Debian package changelog'
DEBFULLNAME="Yandex LLC" DEBEMAIL="clickhouse[email protected]" dch --force-bad-version --distribution stable -v $$(cat $(VERSION_FILE)) Autobuild
Copy link
Member

@Alex-Burmak Alex-Burmak Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep [email protected] for now. [email protected] is nonexistent email.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of IDE auto-replace.
Thanks for the thorough review.

@aalexfvk aalexfvk force-pushed the MDB-24641_try_poetry_as_dependency_tool branch from 444bb42 to ed49a93 Compare August 14, 2023 06:45
@aalexfvk aalexfvk merged commit a1c70c6 into main Aug 14, 2023
20 checks passed
@aalexfvk aalexfvk deleted the MDB-24641_try_poetry_as_dependency_tool branch August 14, 2023 07: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.

2 participants